diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e93ef716364..889322e2a6a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -2,7 +2,7 @@ - [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md). - [ ] Ran the shell script under `./bin/` to update Petstore sample so that CIs can verify the change. (For instance, only need to run `./bin/{LANG}-petstore.sh` and `./bin/security/{LANG}-petstore.sh` if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in `.\bin\windows\`. -- [ ] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `3.3.x`, `4.0.x`. Default: `master`. +- [ ] Filed the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `3.4.x`, `4.0.x`. Default: `master`. - [ ] Copied the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language. ### Description of the PR diff --git a/.gitignore b/.gitignore index 55ef266102f..aff6667ce66 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ out/ *.gpg classpath.txt version.properties +modules/openapi-generator-gradle-plugin/bin/ !modules/openapi-generator-cli/src/main/resources/version.properties .project .classpath @@ -115,14 +116,14 @@ samples/client/petstore/swift/**/SwaggerClientTests/SwaggerClient.xcworkspace/xc samples/client/petstore/swift/**/SwaggerClientTests/Pods/ #samples/client/petstore/swift/**/SwaggerClientTests/Pods/Pods.xcodeproj/xcuserdata #samples/client/petstore/swift/**/SwaggerClientTests/Pods/Pods.xcodeproj/xcshareddata/xcschemes -samples/client/petstore/swift/**/SwaggerClientTests/Podfile.lock +samples/client/petstore/swift/**/SwaggerClientTests/Podfile.lock # Swift3 samples/client/petstore/swift3/**/SwaggerClientTests/SwaggerClient.xcodeproj/xcuserdata samples/client/petstore/swift3/**/SwaggerClientTests/SwaggerClient.xcworkspace/xcuserdata #samples/client/petstore/swift3/**/SwaggerClientTests/Pods/ #samples/client/petstore/swift3/**/SwaggerClientTests/Pods/Pods.xcodeproj/xcuserdata #samples/client/petstore/swift3/**/SwaggerClientTests/Pods/Pods.xcodeproj/xcshareddata/xcschemes -samples/client/petstore/swift3/**/SwaggerClientTests/Podfile.lock +samples/client/petstore/swift3/**/SwaggerClientTests/Podfile.lock # C# *.csproj.user diff --git a/.hub.online.dockerfile b/.hub.online.dockerfile index 96eda34d32b..083b84d4ead 100644 --- a/.hub.online.dockerfile +++ b/.hub.online.dockerfile @@ -26,7 +26,7 @@ RUN mkdir -p ${TARGET_DIR} WORKDIR ${TARGET_DIR} -COPY --from=builder ${GEN_DIR}/modules/openapi-generator-online/target/openapi-generator-*.jar ${TARGET_DIR}/openapi-generator-online.jar +COPY --from=builder ${GEN_DIR}/modules/openapi-generator-online/target/openapi-generator-online.jar ${TARGET_DIR}/openapi-generator-online.jar ENV GENERATOR_HOST=http://localhost diff --git a/.travis.yml b/.travis.yml index 9d83b1a1bb4..af7d9a2d910 100644 --- a/.travis.yml +++ b/.travis.yml @@ -30,6 +30,7 @@ cache: - $HOME/perl5 - $HOME/.cargo - $HOME/.stack + - $HOME/.pub-cache - $HOME/samples/server/petstore/cpp-pistache/pistache - $HOME/.npm - $HOME/.rvm/gems/ruby-2.4.1 @@ -72,6 +73,13 @@ before_install: - sudo apt-get update -qq - sudo apt-get install -qq bats - sudo apt-get install -qq curl + # install dart + #- sudo apt-get update + - sudo apt-get install apt-transport-https + - sudo sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -' + - sudo sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list' + - sudo apt-get update + - sudo apt-get install dart # install perl module #- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) #- cpanm Test::Exception Test::More Log::Any LWP::UserAgent JSON URI:Query Module::Runtime DateTime Module::Find Moose::Role @@ -96,11 +104,13 @@ install: # Add Godeps dependencies to GOPATH and PATH #- eval "$(curl -sL https://raw.githubusercontent.com/travis-ci/gimme/master/gimme | GIMME_GO_VERSION=1.4 bash)" #- export GOPATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace" - - export PATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace/bin:$HOME/.cargo/bin:$PATH" + - export PATH="${TRAVIS_BUILD_DIR}/Godeps/_workspace/bin:$HOME/.cargo/bin:$PATH:/usr/lib/dart/bin" #- go version - gcc -v - echo $CC - echo $CXX + - pub version + - dart --version script: # fail fast @@ -125,7 +135,7 @@ after_success: ./gradlew -Psigning.keyId="$SIGNING_KEY" -Psigning.password="$SIGNING_PASSPHRASE" -Psigning.secretKeyRingFile="${TRAVIS_BUILD_DIR}/sec.gpg" -PossrhUsername="${SONATYPE_USERNAME}" -PossrhPassword="${SONATYPE_PASSWORD}" uploadArchives --no-daemon; echo "Finished ./gradlew uploadArchives"; popd; - elif ([ "$TRAVIS_BRANCH" == "4.0.x" ]) ; then + elif ([[ "$TRAVIS_BRANCH" =~ ^[0-9]+\.[0-9]+\.x$ ]]) ; then mvn clean deploy --settings CI/settings.xml; echo "Finished mvn clean deploy for $TRAVIS_BRANCH"; pushd .; diff --git a/CI/circle_parallel.sh b/CI/circle_parallel.sh index 3487a09bf6e..51d81a2afaf 100755 --- a/CI/circle_parallel.sh +++ b/CI/circle_parallel.sh @@ -1,19 +1,27 @@ #!/bin/bash +# +# A bash script to run CircleCI node/test in parallel +# NODE_INDEX=${CIRCLE_NODE_INDEX:-0} - if [ "$NODE_INDEX" = "1" ]; then - echo "Running node $NODE_INDEX to test CI/pom.xml.circleci ..." - cp CI/pom.xml.circleci pom.xml + echo "Running node $NODE_INDEX to test 'samples.circleci' defined in pom.xml ..." + #cp CI/pom.xml.circleci pom.xml java -version - mvn --quiet verify -Psamples + mvn --quiet verify -Psamples.circleci +elif [ "$NODE_INDEX" = "2" ]; then + echo "Running node $NODE_INDEX to test ensure-up-to-date" + java -version + #export GO_POST_PROCESS_FILE="/usr/local/bin/gofmt -w" + # not formatting the code as different go versions may format the code a bit different + #./bin/utils/ensure-up-to-date else - echo "Running node $NODE_INDEX to test CI/pom.xml.circleci.java7 ..." + echo "Running node $NODE_INDEX to test 'samples.circleci.jdk7' defined in pom.xml ..." sudo update-java-alternatives -s java-1.7.0-openjdk-amd64 java -version - cp CI/pom.xml.circleci.java7 pom.xml - mvn --quiet verify -Psamples + #cp CI/pom.xml.circleci.java7 pom.xml + mvn --quiet verify -Psamples.circleci.jdk7 fi diff --git a/CI/pom.xml.bash b/CI/pom.xml.bash index fea6011599d..f450c15702f 100644 --- a/CI/pom.xml.bash +++ b/CI/pom.xml.bash @@ -920,10 +920,10 @@ - 2.0.2-OpenAPITools.org-1 - 2.0.1 + 2.0.4 + 2.0.4 2.11.1 - 3.3.0 + 3.4.0-SNAPSHOT 2.4 1.2 4.8.1 diff --git a/CI/pom.xml.circleci b/CI/pom.xml.circleci index c6bf0841c35..e1f9acef443 100644 --- a/CI/pom.xml.circleci +++ b/CI/pom.xml.circleci @@ -891,6 +891,7 @@ samples/client/petstore/scalaz samples/client/petstore/clojure samples/client/petstore/java/feign + samples/client/petstore/java/feign10x samples/client/petstore/java/jersey1 samples/client/petstore/java/jersey2 samples/client/petstore/java/jersey2-java8 @@ -899,6 +900,7 @@ samples/client/petstore/java/retrofit2 samples/client/petstore/java/retrofit2rx samples/client/petstore/java/retrofit2-play25 + samples/client/petstore/java/retrofit2-play26 samples/client/petstore/jaxrs-cxf-client samples/client/petstore/java/resttemplate samples/client/petstore/java/resttemplate-withXml @@ -957,6 +959,7 @@ samples/server/petstore/scala-lagom-server samples/server/petstore/scalatra samples/server/petstore/finch + samples/server/petstore/kotlin-springboot @@ -1028,10 +1031,10 @@ - 2.0.2-OpenAPITools.org-1 - 2.0.1 + 2.0.4 + 2.0.4 2.11.1 - 3.3.0 + 3.4.0-SNAPSHOT 2.4 1.2 4.8.1 diff --git a/CI/pom.xml.circleci.java7 b/CI/pom.xml.circleci.java7 index 6e6227bc937..1bee42b6440 100644 --- a/CI/pom.xml.circleci.java7 +++ b/CI/pom.xml.circleci.java7 @@ -10,7 +10,11 @@ openapi-generator-project pom openapi-generator-project +<<<<<<< HEAD 4.0.0-SNAPSHOT +======= + 3.4.0-SNAPSHOT +>>>>>>> origin/3.4.x https://github.com/openapitools/openapi-generator scm:git:git@github.com:openapitools/openapi-generator.git @@ -999,10 +1003,10 @@ - 2.0.2-OpenAPITools.org-1 - 2.0.1 + 2.0.4 + 2.0.4 2.11.1 - 3.3.0 + 3.4.0-SNAPSHOT 2.4 1.2 4.8.1 diff --git a/CI/pom.xml.ios b/CI/pom.xml.ios index eaa81180e27..d7f0bcba3aa 100644 --- a/CI/pom.xml.ios +++ b/CI/pom.xml.ios @@ -928,10 +928,10 @@ - 2.0.2-OpenAPITools.org-1 - 2.0.1 + 2.0.4 + 2.0.4 2.11.1 - 3.3.0 + 3.4.0-SNAPSHOT 2.4 1.2 4.8.1 diff --git a/README.md b/README.md index ee102011cb2..bdb4d625e2e 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,16 @@
-[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`3.2.3`): [![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) (`3.3.1`): [![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) +[`3.4.x`](https://github.com/OpenAPITools/openapi-generator/tree/3.4.x) branch: [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/3.4.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) +[![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/3.4.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) +[![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=3.4.x)](https://app.shippable.com/github/OpenAPITools/openapi-generator) +[![Windows Test](https://ci.appveyor.com/api/projects/status/github/openapitools/openapi-generator?branch=3.4.x&svg=true&passingText=Windows%20Test%20-%20OK&failingText=Windows%20Test%20-%20Fails)](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu) + [`4.0.x`](https://github.com/OpenAPITools/openapi-generator/tree/4.0.x) branch: [![Build Status](https://img.shields.io/travis/OpenAPITools/openapi-generator/4.0.x.svg?label=Integration%20Test)](https://travis-ci.org/OpenAPITools/openapi-generator) [![Integration Test2](https://circleci.com/gh/OpenAPITools/openapi-generator/tree/4.0.x.svg?style=shield)](https://circleci.com/gh/OpenAPITools/openapi-generator) [![Run Status](https://api.shippable.com/projects/5af6bf74e790f4070084a115/badge?branch=4.0.x)](https://app.shippable.com/github/OpenAPITools/openapi-generator) @@ -31,7 +36,7 @@ :notebook_with_decorative_cover: The eBook [A Beginner's Guide to Code Generation for REST APIs](https://gumroad.com/l/swagger_codegen_beginner) is a good starting point for beginners :notebook_with_decorative_cover: -:warning: If the OpenAPI spec is obtained from an untrusted source, please make sure you've reviewed the spec before using OpenAPI Generator to generate the API client, server stub or documentation as [code injection](https://en.wikipedia.org/wiki/Code_injection) may occur :warning: +:warning: If the OpenAPI spec, templates or any input (e.g. options, envirionment variables) is obtained from an untrusted source or environment, please make sure you've reviewed these inputs before using OpenAPI Generator to generate the API client, server stub or documentation to avoid potential security issues (e.g. [code injection](https://en.wikipedia.org/wiki/Code_injection)) :warning: :bangbang: Both "OpenAPI Tools" (https://OpenAPITools.org - the parent organization of OpenAPI Generator) and "OpenAPI Generator" are not affiliated with OpenAPI Initiative (OAI) :bangbang: @@ -42,11 +47,11 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se | | Languages/Frameworks | |-|-| -**API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C#** (.net 2.0, 3.5 or later), **C++** (cpprest, Qt5, Tizen), **Clojure**, **Dart**, **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), **Kotlin**, **Lua**, **Node.js** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types) **Objective-C**, **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 - 6.x), Aurelia, Fetch, Inversify, jQuery, Node) -**Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed), **Erlang**, **Go**, **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples)), **Kotlin**, **PHP** (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), Scalatra) +**API clients** | **ActionScript**, **Ada**, **Apex**, **Bash**, **C#** (.net 2.0, 3.5 or later), **C++** (cpprest, 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**, **Node.js** (ES5, ES6, AngularJS with Google Closure Compiler annotations, Flow types) **Objective-C**, **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 - 6.x), Aurelia, Axios, Fetch, Inversify, jQuery, Node) +**Server stubs** | **Ada**, **C#** (ASP.NET Core, NancyFx), **C++** (Pistache, Restbed), **Erlang**, **Go** (net/http, Gin), **Haskell** (Servant), **Java** (MSF4J, Spring, Undertow, JAX-RS: CDI, CXF, Inflector, RestEasy, Play Framework, [PKMST](https://github.com/ProKarma-Inc/pkmst-getting-started-examples)), **Kotlin** (Spring Boot), **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), Scalatra) **API documentation generators** | **HTML**, **Confluence Wiki** **Configuration files** | [**Apache2**](https://httpd.apache.org/) -**Others** | **JMeter** +**Others** | **JMeter**, **MySQL Schema** ## Table of contents @@ -83,9 +88,9 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20 OpenAPI Generator Version | Release Date | Notes ---------------------------- | ------------ | ----- 4.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/4.0.0-SNAPSHOT/)| TBD | Major release with breaking changes (no fallback) -3.3.0 (upcoming minor release)| TBD | Minor release (breaking changes with fallbacks) -3.2.3 (current master, upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.2.3-SNAPSHOT/)| TBD | Bugfix release -[3.2.2](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.2.2) (latest stable release) | 22.08.2018 | Bugfix release +3.4.0 (upcoming minor release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.4.0-SNAPSHOT/)| 01.11.2018 | Minor release (breaking changes with fallbacks) +3.3.2 (current master, upcoming patch release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/3.3.2-SNAPSHOT/) | 29.10.2018 | Bugfix release +[3.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v3.3.1) (latest stable release) | 15.10.2018 | Bugfix release OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0 @@ -141,16 +146,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/3.2.2/openapi-generator-cli-3.2.2.jar` +JAR location: `http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.3.1/openapi-generator-cli-3.3.1.jar` For **Mac/Linux** users: ```sh -wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.2.2/openapi-generator-cli-3.2.2.jar -O openapi-generator-cli.jar +wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.3.1/openapi-generator-cli-3.3.1.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/3.2.2/openapi-generator-cli-3.2.2.jar +Invoke-WebRequest -OutFile openapi-generator-cli.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.3.1/openapi-generator-cli-3.3.1.jar ``` After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage. @@ -367,21 +372,23 @@ To get a list of PHP specified options (which can be passed to the generator wit You can build a client against the [Petstore API](https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml) as follows: ```sh -./bin/java-petstore.sh +./bin/java-petstore-okhttp-gson.sh ``` -(On Windows, run `.\bin\windows\java-petstore.bat` instead) +(On Windows, run `.\bin\windows\java-petstore-okhttp-gson.bat` instead) -This will run the generator with this command: +This script uses the default library, which is `okhttp-gson`. It will run the generator with this command: ```sh 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 java \ - -o samples/client/petstore/java + -o samples/client/petstore/java/okhttp-gson ``` -with a number of options. You can get the options with the `help generate` command (below only shows partial results): +with a number of options. [The java options are documented here.](docs/generators/java.md) + +You can also get the options with the `help generate` command (below only shows partial results): ``` NAME @@ -433,16 +440,19 @@ OPTIONS You can then compile and run the client, as well as unit tests against it: ```sh -cd samples/client/petstore/java +cd samples/client/petstore/java/okhttp-gson mvn package ``` Other languages have petstore samples, too: ```sh -./bin/android-petstore.sh -./bin/java-petstore.sh +./bin/android-petstore-all.sh +./bin/java-petstore-all.sh ./bin/objc-petstore.sh ``` + +... and others. [Here is a list of all scripts.](wiki/Samples-folder#scripts) + ### [3.1 - Customization](#table-of-contents) Please refer to [customization.md](docs/customization.md) on how to customize the output (e.g. package name, version) @@ -469,13 +479,17 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - [Angular.Schule](https://angular.schule/) - [Bithost GmbH](https://www.bithost.ch) +- [Boxever](https://www.boxever.com/) - [GMO Pepabo](https://pepabo.com/en/) +- [JustStar](https://www.juststarinfo.com) +- [Myworkout](https://myworkout.com) - [Raiffeisen Schweiz Genossenschaft](https://www.raiffeisen.ch) - [RepreZen API Studio](https://www.reprezen.com/swagger-openapi-code-generation-api-first-microservices-enterprise-development) - [REST United](https://restunited.com) - [Suva](https://www.suva.ch/) - [Telstra](https://dev.telstra.com) - [unblu inc.](https://www.unblu.com/) +- [Zalando](https://www.zalando.com) ## [5 - Presentations/Videos/Tutorials/Books](#table-of-contents) @@ -486,6 +500,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in - 2018/06/21 - [Connect your JHipster apps to the world of APIs with OpenAPI and gRPC](https://fr.slideshare.net/chbornet/jhipster-conf-2018-connect-your-jhipster-apps-to-the-world-of-apis-with-openapi-and-grpc) by [Christophe Bornet](https://github.com/cbornet) at [JHipster Conf 2018](https://jhipster-conf.github.io/) - 2018/06/27 - [Lessons Learned from Leading an Open-Source Project Supporting 30+ Programming Languages](https://speakerdeck.com/wing328/lessons-learned-from-leading-an-open-source-project-supporting-30-plus-programming-languages) - [William Cheng](https://github.com/wing328) at [LinuxCon + ContainerCon + CloudOpen China 2018](http://bit.ly/2waDKKX) - 2018/07/19 - [OpenAPI Generator Contribution Quickstart - RingCentral Go SDK](https://medium.com/ringcentral-developers/openapi-generator-for-go-contribution-quickstart-8cc72bf37b53) by [John Wang](https://github.com/grokify) +- 2018/08/22 - [OpenAPI Generatorのプロジェクト構成などのメモ](https://yinm.info/20180822/) by [Yusuke Iinuma](https://github.com/yinm) ## [6 - About Us](#table-of-contents) @@ -515,7 +530,9 @@ Here is a list of template creators: * C# (.NET 4.5 refactored): @jimschubert * Clojure: @xhh * Dart: @yissachar - * Dart (refactored in 2.4.0): @joernahrens + * Dart (refactor): @joernahrens + * Dart 2: @swipesight + * Dart (Jaguar): @jaumard * Elixir: @niku * Elm: @trenneman * Eiffel: @jvelilla @@ -551,11 +568,12 @@ Here is a list of template creators: * Swift: @tkqubo * Swift 3: @hexelon * Swift 4: @ehyche - * TypeScript (Node): @mhardorf * TypeScript (Angular1): @mhardorf - * TypeScript (Fetch): @leonyu * TypeScript (Angular2): @roni-frantchi + * TypeScript (Axios): @nicokoenig + * TypeScript (Fetch): @leonyu * TypeScript (jQuery): @bherila + * TypeScript (Node): @mhardorf * Server Stubs * Ada: @stcarrez * C# ASP.NET5: @jimschubert @@ -565,6 +583,7 @@ Here is a list of template creators: * C++ Restbed: @stkrwork * Erlang Server: @galaxie * Go Server: @guohuang + * Go (Gin) Server: @kemokemo * Haskell Servant: @algas * Java MSF4J: @sanjeewa-malalgoda * Java Spring Boot: @diyfr @@ -576,6 +595,7 @@ Here is a list of template creators: * JAX-RS CXF (CDI): @nickcmaynard * JAX-RS RestEasy (JBoss EAP): @jfiala * Kotlin: @jimschubert + * Kotlin (Spring Boot): @dr4ke616 * PHP Laravel: @renepardon * PHP Lumen: @abcsun * PHP Slim: @jfastnacht @@ -590,6 +610,8 @@ Here is a list of template creators: * Confluence Wiki: @jhitchcock * Configuration * Apache2: @stkrwork + * Schema + * MySQL: @ybelenko #### How to join the core team @@ -630,16 +652,16 @@ If you want to join the committee, please kindly apply by sending an email to te | C++ | @ravinikam (2017/07) @stkrwork (2017/07) @fvarose (2017/11) @etherealjoy (2018/02) @martindelille (2018/03) | | C# | @mandrean (2017/08) @jimschubert (2017/09) | | Clojure | | -| Dart | @ircecho (2017/07) | +| Dart | @ircecho (2017/07) @swipesight (2018/09) @jaumard (2018/09) | | Eiffel | @jvelilla (2017/09) | | Elixir | | -| Elm | | +| Elm | @trenneman (2018/09) | | Erlang | @tsloughter (2017/11) | -| Go | @antihax (2017/11) @bvwells (2017/12) @grokify (2018/07) | +| Go | @antihax (2017/11) @bvwells (2017/12) @grokify (2018/07) @kemokemo (2018/09 | | Groovy | | | Haskell | | | Java | @bbdouglas (2017/07) @JFCote (2017/08) @sreeshas (2017/08) @jfiala (2017/08) @lukoyanov (2017/09) @cbornet (2017/09) @jeff9finger (2018/01) | -| Kotlin | @jimschubert (2017/09) | +| Kotlin | @jimschubert (2017/09) @dr4ke616 (2018/08) | | Lua | @daurnimator (2017/08) | | NodeJS/Javascript | @CodeNinjai (2017/07) @frol (2017/07) @cliffano (2017/07) | | ObjC | | @@ -652,7 +674,7 @@ If you want to join the committee, please kindly apply by sending an email to te | Rust | @frol (2017/07) @farcaller (2017/08) @bjgill (2017/12) | | Scala | @clasnake (2017/07) @jimschubert (2017/09) @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) | +| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @nicokoenig (2018/09) | ### [6.3 - History of OpenAPI Generator](#table-of-contents) diff --git a/Vagrantfile b/Vagrantfile index 03735a6b6af..3baf531f23a 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -6,7 +6,7 @@ VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| - config.vm.box = "ubuntu/trusty64" + config.vm.box = "ubuntu/bionic64" config.vm.provider "virtualbox" do |v| v.name = "openapi-generator" @@ -23,13 +23,15 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| #Provision config.vm.provision "shell", inline: <<-SHELL - sudo touch /var/lib/cloud/instance/locale-check.skip - sudo apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D - sudo sh -c 'echo "deb https://apt.dockerproject.org/repo ubuntu-trusty main" > /etc/apt/sources.list.d/docker.list' - sudo apt-cache policy docker-engine + sudo apt-get update + sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common + curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - + sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ + $(lsb_release -cs) stable" + sudo sh -c 'echo "deb https://apt.dockerproject.org/repo ubuntu-cosmic main" > /etc/apt/sources.list.d/docker.list' sudo apt-get update sudo apt-get upgrade -y - sudo apt-get install -y docker-engine + sudo apt-get install -y docker-ce sudo usermod -aG docker vagrant SHELL diff --git a/bin/dart-jaguar-petstore.sh b/bin/dart-jaguar-petstore.sh new file mode 100755 index 00000000000..53840c2797f --- /dev/null +++ b/bin/dart-jaguar-petstore.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +SCRIPT="$0" + +while [ -h "$SCRIPT" ] ; do + ls=`ls -ld "$SCRIPT"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=`dirname "$SCRIPT"`/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=`dirname "$SCRIPT"`/.. + APP_DIR=`cd "${APP_DIR}"; pwd` +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" + +# Generate client +ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l dart-jaguar -o samples/client/petstore/dart-jaguar/openapi -DhideGenerationTimestamp=true -DpubName=openapi" +java $JAVA_OPTS -jar $executable $ags + +# Generate non-browserClient and put it to the flutter sample app +ags="$@ generate -t modules/openapi-generator/src/main/resources/dart-jaguar -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -l dart-jaguar -o samples/client/petstore/dart-jaguar/flutter_petstore/openapi -DhideGenerationTimestamp=true -DpubName=openapi" +java $JAVA_OPTS -jar $executable $ags + +# There is a proposal to allow importing different libraries depending on the environment: +# https://github.com/munificent/dep-interface-libraries +# When this is implemented there will only be one library. + +# The current petstore test will then work for both: the browser library and the vm library. diff --git a/bin/dart-petstore.sh b/bin/dart-petstore.sh index 778c8535126..7c95f8c4aa3 100755 --- a/bin/dart-petstore.sh +++ b/bin/dart-petstore.sh @@ -29,18 +29,18 @@ fi export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" # Generate non-browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi -DhideGenerationTimestamp=true -DbrowserClient=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi -DhideGenerationTimestamp=true -DbrowserClient=false --additional-properties supportDart2=false $@" # then options to generate the library for vm would be: -#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi_vm -DbrowserClient=false -DpubName=openapi_vm $@" +#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi_vm -DbrowserClient=false -DpubName=openapi_vm --additional-properties supportDart2=false $@" java $JAVA_OPTS -jar $executable $ags # Generate browserClient -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/openapi-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true --additional-properties supportDart2=false $@" java $JAVA_OPTS -jar $executable $ags # Generate non-browserClient and put it to the flutter sample app -ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/openapi -DhideGenerationTimestamp=true -DbrowserClient=false $@" +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart/flutter_petstore/openapi -DhideGenerationTimestamp=true -DbrowserClient=false --additional-properties supportDart2=false $@" java $JAVA_OPTS -jar $executable $ags # There is a proposal to allow importing different libraries depending on the environment: diff --git a/bin/dart2-petstore.sh b/bin/dart2-petstore.sh new file mode 100755 index 00000000000..1b224bd2611 --- /dev/null +++ b/bin/dart2-petstore.sh @@ -0,0 +1,50 @@ +#!/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" + +# Generate non-browserClient +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi -DhideGenerationTimestamp=true -DbrowserClient=false $@" + +# then options to generate the library for vm would be: +#ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi_vm -DbrowserClient=false -DpubName=openapi_vm $@" +java $JAVA_OPTS -jar $executable $ags + +# Generate browserClient +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/openapi-browser-client -DhideGenerationTimestamp=true -DbrowserClient=true $@" +java $JAVA_OPTS -jar $executable $ags + +# Generate non-browserClient and put it to the flutter sample app +ags="generate -t modules/openapi-generator/src/main/resources/dart -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g dart -o samples/client/petstore/dart2/flutter_petstore/openapi -DhideGenerationTimestamp=true -DbrowserClient=false $@" +java $JAVA_OPTS -jar $executable $ags + +# There is a proposal to allow importing different libraries depending on the environment: +# https://github.com/munificent/dep-interface-libraries +# When this is implemented there will only be one library. + +# The current petstore test will then work for both: the browser library and the vm library. diff --git a/bin/elm-0.18-petstore.sh b/bin/elm-0.18-petstore.sh new file mode 100755 index 00000000000..d82f3628ad6 --- /dev/null +++ b/bin/elm-0.18-petstore.sh @@ -0,0 +1,32 @@ +#!/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 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g elm -t modules/openapi-generator/src/main/resources/elm -o samples/client/petstore/elm-0.18 --additional-properties elmVersion=0.18 $@" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/elm-petstore-all.sh b/bin/elm-petstore-all.sh new file mode 100755 index 00000000000..0d64cf613cf --- /dev/null +++ b/bin/elm-petstore-all.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +./bin/elm-0.18-petstore.sh +./bin/elm-petstore.sh + diff --git a/bin/go-gin-petstore-server.sh b/bin/go-gin-petstore-server.sh new file mode 100755 index 00000000000..6ad025fdb55 --- /dev/null +++ b/bin/go-gin-petstore-server.sh @@ -0,0 +1,34 @@ +#!/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 -t modules/openapi-generator/src/main/resources/go-gin-server -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g go-gin-server -o samples/server/petstore/go-gin-api-server -DpackageName=petstoreserver --additional-properties hideGenerationTimestamp=true -Dservice $@" + +java $JAVA_OPTS -jar $executable $ags +#!/usr/bin/env bash \ No newline at end of file diff --git a/bin/java-petstore-all.sh b/bin/java-petstore-all.sh index b8cb3014e08..b51ecebf178 100755 --- a/bin/java-petstore-all.sh +++ b/bin/java-petstore-all.sh @@ -4,6 +4,7 @@ ./bin/java-petstore-jersey1.sh ./bin/java-petstore-jersey2.sh ./bin/java-petstore-feign.sh +./bin/java-petstore-feign-10x.sh ./bin/java-petstore-okhttp-gson.sh ./bin/java-petstore-okhttp-gson-parcelable.sh ./bin/java-petstore-retrofit.sh @@ -13,6 +14,7 @@ ./bin/java8-petstore-jersey2.sh ./bin/java-petstore-retrofit2-play24.sh ./bin/java-petstore-retrofit2-play25.sh +./bin/java-petstore-retrofit2-play26.sh ./bin/java-petstore-jersey2-java6.sh ./bin/java-petstore-resttemplate.sh ./bin/java-petstore-resttemplate-withxml.sh diff --git a/bin/java-petstore-feign-10x.json b/bin/java-petstore-feign-10x.json new file mode 100644 index 00000000000..d8f09eb65a4 --- /dev/null +++ b/bin/java-petstore-feign-10x.json @@ -0,0 +1,5 @@ +{ + "library": "feign", + "artifactId": "petstore-feign-10x", + "feignVersion": "10.x" +} diff --git a/bin/java-petstore-feign-10x.sh b/bin/java-petstore-feign-10x.sh new file mode 100755 index 00000000000..43e0db98caf --- /dev/null +++ b/bin/java-petstore-feign-10x.sh @@ -0,0 +1,40 @@ +#!/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 -t modules/openapi-generator/src/main/resources/Java/libraries/feign -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-feign-10x.json -o samples/client/petstore/java/feign10x -DhideGenerationTimestamp=true -DbooleanGetterPrefix=is $@" + +echo "Removing files and folders under samples/client/petstore/java/feign10x/src/main" +rm -rf samples/client/petstore/java/feign10x/src/main +find samples/client/petstore/java/feign10x -maxdepth 1 -type f ! -name "README.md" -exec rm {} + +java $JAVA_OPTS -jar $executable $ags + +# copy additional manually written unit-tests +mkdir samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client + +cp CI/samples.ci/client/petstore/java/test-manual/common/StringUtilTest.java samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/StringUtilTest.java diff --git a/bin/java-petstore-feign-9x.json b/bin/java-petstore-feign-9x.json new file mode 100644 index 00000000000..3508a4521ce --- /dev/null +++ b/bin/java-petstore-feign-9x.json @@ -0,0 +1,5 @@ +{ + "library": "feign", + "artifactId": "petstore-feign", + "feignVersion": "9.x" +} diff --git a/bin/java-petstore-feign.json b/bin/java-petstore-feign.json index 2b1db7d5f96..187612c699c 100644 --- a/bin/java-petstore-feign.json +++ b/bin/java-petstore-feign.json @@ -1,4 +1,5 @@ { "library": "feign", - "artifactId": "petstore-feign" + "artifactId": "petstore-feign", + "feignVersion": "10.x" } diff --git a/bin/java-petstore-feign.sh b/bin/java-petstore-feign.sh index dc4eac30983..2d8dc143244 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} -XX:MaxPermSize=256M -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.json -o samples/client/petstore/java/feign -DhideGenerationTimestamp=true -DbooleanGetterPrefix=is $@" +ags="generate -t modules/openapi-generator/src/main/resources/Java/libraries/feign -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-feign-9x.json -o samples/client/petstore/java/feign -DhideGenerationTimestamp=true -DbooleanGetterPrefix=is $@" echo "Removing files and folders under samples/client/petstore/java/feign/src/main" rm -rf samples/client/petstore/java/feign/src/main @@ -37,4 +37,4 @@ java $JAVA_OPTS -jar $executable $ags # copy additional manually written unit-tests mkdir samples/client/petstore/java/feign/src/test/java/org/openapitools/client -cp CI/samples.ci/client/petstore/java/test-manual/common/StringUtilTest.java samples/client/petstore/java/feign/src/test/java/org/openapitools/client/StringUtilTest.java \ No newline at end of file +cp CI/samples.ci/client/petstore/java/test-manual/common/StringUtilTest.java samples/client/petstore/java/feign/src/test/java/org/openapitools/client/StringUtilTest.java diff --git a/bin/java-petstore-retrofit2-all.sh b/bin/java-petstore-retrofit2-all.sh index e8f28de689d..656006917a7 100755 --- a/bin/java-petstore-retrofit2-all.sh +++ b/bin/java-petstore-retrofit2-all.sh @@ -2,6 +2,7 @@ ./bin/java-petstore-retrofit2-play24.sh ./bin/java-petstore-retrofit2-play25.sh +./bin/java-petstore-retrofit2-play26.sh ./bin/java-petstore-retrofit2.sh ./bin/java-petstore-retrofit2rx.sh ./bin/java-petstore-retrofit2rx2.sh diff --git a/bin/java-petstore-retrofit2-play26.json b/bin/java-petstore-retrofit2-play26.json new file mode 100644 index 00000000000..0c7456430d4 --- /dev/null +++ b/bin/java-petstore-retrofit2-play26.json @@ -0,0 +1 @@ +{"useBeanValidation":"true","enableBuilderSupport":"true","library":"retrofit2","usePlayWS":"true","playVersion":"play26"} diff --git a/bin/java-petstore-retrofit2-play26.sh b/bin/java-petstore-retrofit2-play26.sh new file mode 100755 index 00000000000..326f5fa5b3c --- /dev/null +++ b/bin/java-petstore-retrofit2-play26.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 -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 petstore-java-client-retrofit2-play26 -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g java -c bin/java-petstore-retrofit2-play26.json -o samples/client/petstore/java/retrofit2-play26 -DhideGenerationTimestamp=true $@" + +echo "Removing files and folders under samples/client/petstore/java/retrofit2-play26/src/main" +rm -rf samples/client/petstore/java/retrofit2-play26/src/main +find samples/client/petstore/java/retrofit2-play26 -maxdepth 1 -type f ! -name "README.md" -exec rm {} + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/kotlin-springboot-petstore-server.sh b/bin/kotlin-springboot-petstore-server.sh new file mode 100755 index 00000000000..7e1c3888c8f --- /dev/null +++ b/bin/kotlin-springboot-petstore-server.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} -XX:MaxPermSize=256M -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 --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true" + +echo "Cleaning previously generated files if any from samples/server/petstore/kotlin-springboot" +rm -rf samples/server/petstore/kotlin-springboot + +echo "Generating Kotling Spring Boot server..." +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/meta-codegen.sh b/bin/meta-codegen.sh index 00b67984464..2a0f55cf8a0 100755 --- a/bin/meta-codegen.sh +++ b/bin/meta-codegen.sh @@ -26,11 +26,11 @@ then fi export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="meta -n myClientCodegen -p com.my.company.codegen -o samples/meta-codegen/lib $@" +ags="meta -n myClientCodegen -t DOCUMENTATION -p com.my.company.codegen -o samples/meta-codegen/lib $@" java $JAVA_OPTS -jar $executable $ags -mvn verify -f samples/meta-codegen/lib/pom.xml +mvn clean package -f samples/meta-codegen/pom.xml ags2="generate -g myClientCodegen -i modules/openapi-generator/src/test/resources/2_0/petstore.json -o samples/meta-codegen/usage $@" diff --git a/bin/mysql-schema-petstore.sh b/bin/mysql-schema-petstore.sh new file mode 100644 index 00000000000..6964d257164 --- /dev/null +++ b/bin/mysql-schema-petstore.sh @@ -0,0 +1,32 @@ +#!/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/mysql-schema -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g mysql-schema -o samples/schema/petstore/mysql $@" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/openapi3/jaxrs-jersey-petstore.sh b/bin/openapi3/jaxrs-jersey-petstore.sh old mode 100644 new mode 100755 diff --git a/bin/openapi3/kotlin-springboot-petstore-server.sh b/bin/openapi3/kotlin-springboot-petstore-server.sh new file mode 100755 index 00000000000..3ac7b6f68eb --- /dev/null +++ b/bin/openapi3/kotlin-springboot-petstore-server.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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -t modules/openapi-generator/src/main/resources/kotlin-spring -g kotlin-spring -o samples/server/openapi3/petstore/kotlin-springboot --additional-properties=library=spring-boot,beanValidations=true,swaggerAnnotations=true,serviceImplementation=true" + +echo "Cleaning previously generated files if any from samples/server/openapi3/petstore/kotlin-springboot" +rm -rf samples/server/openapi3/petstore/kotlin-springboot + +echo "Generating Kotling Spring Boot server..." +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/security/mysql-schema-petstore.sh b/bin/security/mysql-schema-petstore.sh new file mode 100644 index 00000000000..ebdda35fe05 --- /dev/null +++ b/bin/security/mysql-schema-petstore.sh @@ -0,0 +1,32 @@ +#!/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 + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -t modules/openapi-generator/src/main/resources/mysql-schema -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g mysql-schema -o samples/schema/petstore-security-test/mysql $@" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/security/php-petstore.sh b/bin/security/php-petstore.sh index 602a836b08d..0202a399e7b 100755 --- a/bin/security/php-petstore.sh +++ b/bin/security/php-petstore.sh @@ -33,6 +33,6 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate -t modules/openapi-generator/src/main/resources/php -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g php -o samples/client/petstore-security-test/php $@" +ags="generate -t modules/openapi-generator/src/main/resources/php -i modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml -g php -o samples/client/petstore-security-test/php/OpenAPIClient-php $@" java $JAVA_OPTS -jar $executable $ags diff --git a/bin/spring-all-pestore.sh b/bin/spring-all-pestore.sh index ca760a5f7a5..e3060626f7b 100755 --- a/bin/spring-all-pestore.sh +++ b/bin/spring-all-pestore.sh @@ -17,3 +17,4 @@ ./bin/springboot-petstore-server-beanvalidation.sh ./bin/springboot-petstore-server-implicitHeaders.sh ./bin/springboot-petstore-server-useOptional.sh +./bin/springboot-virtualan-petstore-server.sh \ No newline at end of file diff --git a/bin/springboot-petstore-server-reactive.sh b/bin/springboot-petstore-server-reactive.sh index 820daf1b8d6..f8936804ad2 100755 --- a/bin/springboot-petstore-server-reactive.sh +++ b/bin/springboot-petstore-server-reactive.sh @@ -26,7 +26,7 @@ fi # if you've executed sbt assembly previously it will use that instead. export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" -ags="generate --artifact-id springboot-reactive -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-reactive -Dreactive=true,hideGenerationTimestamp=true $@" +ags="generate --artifact-id springboot-reactive -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-reactive -Dreactive=true,delegatePattern=true,hideGenerationTimestamp=true $@" echo "Removing files and folders under samples/server/petstore/springboot-reactive/src/main" rm -rf samples/server/petstore/springboot-reactive/src/main diff --git a/bin/springboot-virtualan-petstore-server.json b/bin/springboot-virtualan-petstore-server.json new file mode 100644 index 00000000000..d02799fde62 --- /dev/null +++ b/bin/springboot-virtualan-petstore-server.json @@ -0,0 +1,7 @@ +{ + "artifactId": "springboot-virtualan", + "library": "spring-boot", + "virtualService": true, + "modelPackage" : "org.openapitools.virtualan.model", + "apiPackage" : "org.openapitools.virtualan.api" +} diff --git a/bin/springboot-virtualan-petstore-server.sh b/bin/springboot-virtualan-petstore-server.sh new file mode 100644 index 00000000000..fa7c100379f --- /dev/null +++ b/bin/springboot-virtualan-petstore-server.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 -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 springboot-virtualan -t modules/openapi-generator/src/main/resources/JavaSpring -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g spring -o samples/server/petstore/springboot-virtualan -c bin/springboot-virtualan-petstore-server.json -DhideGenerationTimestamp=true $@" + +echo "Removing files and folders under samples/server/petstore/springboot-virtualan/src/main" +rm -rf samples/server/petstore/springboot-virtualan/src/main +find samples/server/petstore/springboot-virtualan -maxdepth 1 -type f ! -name "README.md" -exec rm {} + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/tests/run-all-test b/bin/tests/run-all-test new file mode 100755 index 00000000000..963f0d2ec63 --- /dev/null +++ b/bin/tests/run-all-test @@ -0,0 +1,33 @@ +#!/bin/bash +# this bash script will loop through all the .sh files under bin/tests +# execute the script and check the result (exit code) to see if +# there's any error + +echo "IMPORTANT: this script should be run by the CI (e.g. Shippable) only. There's no need to run this script manually." +echo "Please press CTRL+C to stop or the script will continue in 10 seconds." + +sleep 10 + +successes=0 +failures=0 +for SCRIPT in $(ls -l ./bin/tests/*.sh | grep -v all) +do + if [ -f ${SCRIPT} -a -x ${SCRIPT} ]; then + echo "Running $SCRIPT (output to /dev/null)" + ${SCRIPT} 2>&1 > /dev/null + rc=$? + if [[ ${rc} != 0 ]]; then + >&2 echo "ERROR!! FAILED TO RUN ${SCRIPT}" + ((failures+=1)) + else + ((successes+=1)) + fi + fi +done + +if (( failures > 0 )); then + >&2 echo "[ERROR] ${failures} out of $((failures+successes)) scripts failed." + exit 1 +else + echo "[SUCCESS] ${successes} generators finished." +fi diff --git a/bin/tests/test-debug-supporting-files.sh b/bin/tests/test-debug-supporting-files.sh new file mode 100755 index 00000000000..7360313f5c8 --- /dev/null +++ b/bin/tests/test-debug-supporting-files.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +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 -t modules/openapi-generator/src/main/resources/python -i modules/openapi-generator/src/test/resources/3_0/issue_241.yaml -g python -o /tmp/test-debug-supporting-files/ -DpackageName=petstore_api -DdebugSupportingFiles=true $@" + +if [[ $(java $JAVA_OPTS -jar $executable $ags 2>&1 | grep "StackOverflowError") ]]; then + echo "There are StackOverflowError. Please check the result." + exit 1 +else + echo "No StackOverflowError found." +fi + diff --git a/bin/typescript-axios-petstore-all.sh b/bin/typescript-axios-petstore-all.sh new file mode 100644 index 00000000000..064014269a2 --- /dev/null +++ b/bin/typescript-axios-petstore-all.sh @@ -0,0 +1,6 @@ +#!/bin/sh + +./bin/typescript-axios-petstore-target-es6.sh +./bin/typescript-axios-petstore-with-npm-version.sh +./bin/typescript-axios-petstore-interfaces.sh +./bin/typescript-axios-petstore.sh diff --git a/bin/typescript-axios-petstore-interfaces.sh b/bin/typescript-axios-petstore-interfaces.sh new file mode 100644 index 00000000000..fecb1320664 --- /dev/null +++ b/bin/typescript-axios-petstore-interfaces.sh @@ -0,0 +1,32 @@ +#!/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 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-axios -o samples/client/petstore/typescript-axios/builds/with-interfaces -D withInterfaces=true $@" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-axios-petstore-target-es6.json b/bin/typescript-axios-petstore-target-es6.json new file mode 100644 index 00000000000..8fcf0846765 --- /dev/null +++ b/bin/typescript-axios-petstore-target-es6.json @@ -0,0 +1,7 @@ +{ + "npmName": "@swagger/typescript-axios-petstore", + "npmVersion": "1.0.0", + "npmRepository": "https://skimdb.npmjs.com/registry", + "snapshot": false, + "supportsES6": true +} diff --git a/bin/typescript-axios-petstore-target-es6.sh b/bin/typescript-axios-petstore-target-es6.sh new file mode 100644 index 00000000000..b4a49655209 --- /dev/null +++ b/bin/typescript-axios-petstore-target-es6.sh @@ -0,0 +1,32 @@ +#!/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 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-axios -c bin/typescript-axios-petstore-target-es6.json -o samples/client/petstore/typescript-axios/builds/es6-target $@" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-axios-petstore-with-npm-version.json b/bin/typescript-axios-petstore-with-npm-version.json new file mode 100644 index 00000000000..90498244f1e --- /dev/null +++ b/bin/typescript-axios-petstore-with-npm-version.json @@ -0,0 +1,6 @@ +{ + "npmName": "@swagger/typescript-axios-petstore", + "npmVersion": "1.0.0", + "npmRepository": "https://skimdb.npmjs.com/registry", + "snapshot": false +} diff --git a/bin/typescript-axios-petstore-with-npm-version.sh b/bin/typescript-axios-petstore-with-npm-version.sh new file mode 100644 index 00000000000..8c34bdf23e4 --- /dev/null +++ b/bin/typescript-axios-petstore-with-npm-version.sh @@ -0,0 +1,32 @@ +#!/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 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-axios -c bin/typescript-axios-petstore-with-npm-version.json -o samples/client/petstore/typescript-axios/builds/with-npm-version $@" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/typescript-axios-petstore.sh b/bin/typescript-axios-petstore.sh new file mode 100644 index 00000000000..7d47e544d08 --- /dev/null +++ b/bin/typescript-axios-petstore.sh @@ -0,0 +1,32 @@ +#!/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 -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g typescript-axios -o samples/client/petstore/typescript-axios/builds/default $@" + +java $JAVA_OPTS -jar $executable $ags diff --git a/bin/utils/ensure-up-to-date b/bin/utils/ensure-up-to-date index 6e2fd3a1ec2..7ce762d807e 100755 --- a/bin/utils/ensure-up-to-date +++ b/bin/utils/ensure-up-to-date @@ -18,6 +18,7 @@ sleep 5 ./bin/kotlin-client-string.sh > /dev/null 2>&1 ./bin/kotlin-client-threetenbp.sh > /dev/null 2>&1 ./bin/kotlin-server-petstore.sh > /dev/null 2>&1 +./bin/mysql-schema-petstore.sh > /dev/null 2>&1 ./bin/php-petstore.sh > /dev/null 2>&1 ./bin/php-silex-petstore-server.sh > /dev/null 2>&1 ./bin/php-symfony-petstore.sh > /dev/null 2>&1 @@ -30,8 +31,12 @@ sleep 5 ./bin/typescript-node-petstore-all.sh > /dev/null 2>&1 ./bin/typescript-inversify-petstore.sh > /dev/null 2>&1 ./bin/rust-server-petstore.sh > /dev/null 2>&1 -./bin/openapi3/haskell-http-client-petstore.sh > /dev/null 2>&1 +./bin/haskell-http-client-petstore.sh > /dev/null 2>&1 ./bin/csharp-petstore.sh > /dev/null 2>&1 +./bin/meta-codegen.sh > /dev/null 2>&1 +./bin/utils/export_docs_generators.sh > /dev/null 2>&1 +./bin/go-petstore.sh > /dev/null 2>&1 +./bin/go-gin-petstore-server.sh > /dev/null 2>&1 # Check: if [ -n "$(git status --porcelain)" ]; then diff --git a/bin/utils/export_docs_generators.sh b/bin/utils/export_docs_generators.sh new file mode 100755 index 00000000000..0e1b50998c4 --- /dev/null +++ b/bin/utils/export_docs_generators.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +SCRIPT="$0" +echo "# START SCRIPT: ${SCRIPT}" + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +for GENERATOR in $(java -jar ${executable} list --short | sed -e 's/,/\'$'\n''/g') +do + ./bin/utils/export_generator.sh ${GENERATOR} +done diff --git a/bin/utils/export_generator.sh b/bin/utils/export_generator.sh new file mode 100755 index 00000000000..918ae306eb3 --- /dev/null +++ b/bin/utils/export_generator.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +SCRIPT="$0" + +if [[ "$1" != "" ]]; then + NAME="$1" + echo "# START SCRIPT: ${SCRIPT} ${NAME}" +else + echo "Missing argument to ${SCRIPT}." + echo " Usage: ${SCRIPT} generator-name" + echo " Example: ${SCRIPT} groovy" + exit 1; +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +java -jar ${executable} config-help -g ${NAME} --named-header -o docs/generators/${NAME}.md + +echo "Back to the [generators list](README.md)" >> docs/generators/${NAME}.md diff --git a/bin/utils/export_generators_readme.sh b/bin/utils/export_generators_readme.sh new file mode 100755 index 00000000000..716528d1668 --- /dev/null +++ b/bin/utils/export_generators_readme.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +java -jar $executable list | sed -e 's/\([A-Z]*\) generators:/* \1 generators:/g' -e 's/- \([a-z0-9\-]*\)/- [\1]\(\1.md\)/g' > docs/generators/README.md diff --git a/bin/utils/release_version_update.sh b/bin/utils/release_version_update.sh index 6b91d2b15fb..72df433aa65 100755 --- a/bin/utils/release_version_update.sh +++ b/bin/utils/release_version_update.sh @@ -31,8 +31,6 @@ else exit 1; fi - -echo "IMPORTANT: this script works on Mac only" echo "Release preparation: replacing $FROM with $TO in different files" declare -a files=("CI/pom.xml.bash" @@ -45,13 +43,18 @@ declare -a files=("CI/pom.xml.bash" "modules/openapi-generator-maven-plugin/pom.xml" "modules/openapi-generator-online/pom.xml" "modules/openapi-generator/pom.xml" - "modules/openapi-generator-online/Dockerfile" + "samples/meta-codegen/lib/pom.xml" "pom.xml") +sedi () { + # Cross-platform version of sed -i that works both on Mac and Linux + sed --version >/dev/null 2>&1 && sed -i -e "$@" || sed -i "" "$@" +} + for filename in "${files[@]}"; do # e.g. sed -i '' "s/3.0.1-SNAPSHOT/3.0.1/g" CI/pom.xml.bash #echo "Running command: sed -i '' "s/$FROM/$TO/g" $filename" - if sed -i '' "s/$FROM/$TO/g" $filename; then + if sedi "s/$FROM/$TO/g" $filename; then echo "Updated $filename successfully!" else echo "ERROR: Failed to update $filename with the following command" diff --git a/bin/utils/release_version_update_docs.sh b/bin/utils/release_version_update_docs.sh index 0209e837a62..b77ad27c416 100755 --- a/bin/utils/release_version_update_docs.sh +++ b/bin/utils/release_version_update_docs.sh @@ -31,8 +31,6 @@ else exit 1; fi - -echo "IMPORTANT: this script works on Mac only" echo "Release preparation: replacing $FROM with $TO in different files" declare -a files=("modules/openapi-generator-maven-plugin/README.md" @@ -45,10 +43,15 @@ declare -a files=("modules/openapi-generator-maven-plugin/README.md" "modules/openapi-generator-gradle-plugin/samples/local-spec/README.md" "README.md") +sedi () { + # Cross-platform version of sed -i that works both on Mac and Linux + sed --version >/dev/null 2>&1 && sed -i -e "$@" || sed -i "" "$@" +} + for filename in "${files[@]}"; do # e.g. sed -i '' "s/3.0.1-SNAPSHOT/3.0.1/g" CI/pom.xml.bash #echo "Running command: sed -i '' "s/$FROM/$TO/g" $filename" - if sed -i '' "s/$FROM/$TO/g" $filename; then + if sedi "s/$FROM/$TO/g" $filename; then echo "Updated $filename successfully!" else echo "ERROR: Failed to update $filename with the following command" diff --git a/bin/windows/dart-client-petstore.bat b/bin/windows/dart-client-petstore.bat new file mode 100755 index 00000000000..6c240658f9a --- /dev/null +++ b/bin/windows/dart-client-petstore.bat @@ -0,0 +1,12 @@ +set executable=.\modules\swagger-codegen-cli\target\swagger-codegen-cli.jar + +If Not Exist %executable% ( + mvn clean package +) + +REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l dart-jaguar -o samples\client\petstore\dart-jaguar\swagger -DhideGenerationTimestamp=true -DbrowserClient=false +java %JAVA_OPTS% -jar %executable% %ags% + +set ags=generate -i modules\swagger-codegen\src\test\resources\2_0\petstore.yaml -l dart-jaguar -o samples\client\petstore\dart-jaguar\flutter_petstore\swagger -DhideGenerationTimestamp=true +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/go-gin-petstore-server.bat b/bin/windows/go-gin-petstore-server.bat new file mode 100644 index 00000000000..1439086d1b0 --- /dev/null +++ b/bin/windows/go-gin-petstore-server.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 -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g go-gin-server -o samples\server\petstore\go-gin-api-server -DpackageName=petstoreserver -Dservice + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/kotlin-springboot-petstore-server.bat b/bin/windows/kotlin-springboot-petstore-server.bat new file mode 100644 index 00000000000..6b7e1ad6e77 --- /dev/null +++ b/bin/windows/kotlin-springboot-petstore-server.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\2_0\petstore.yaml -g kotlin-spring -o samples\server\petstore\kotlin-springboot --additional-properties=library=spring-boot + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/mysql-schema-petstore.bat b/bin/windows/mysql-schema-petstore.bat new file mode 100755 index 00000000000..327b9671fae --- /dev/null +++ b/bin/windows/mysql-schema-petstore.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\2_0\petstore-with-fake-endpoints-models-for-testing.yaml -g mysql-schema -o samples\schema\petstore\mysql + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/openapi3/kotlin-springboot-petstore-server.bat b/bin/windows/openapi3/kotlin-springboot-petstore-server.bat new file mode 100644 index 00000000000..c86efaee3c8 --- /dev/null +++ b/bin/windows/openapi3/kotlin-springboot-petstore-server.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.yaml -g kotlin-spring -o samples\server\openapi3\petstore\kotlin-springboot --additional-properties=library=spring-boot + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-axios-petstore-all.bat b/bin/windows/typescript-axios-petstore-all.bat new file mode 100644 index 00000000000..4d05c71463d --- /dev/null +++ b/bin/windows/typescript-axios-petstore-all.bat @@ -0,0 +1,6 @@ +@ECHO OFF + +call bin\windows\typescript-axios-petstore.bat +call bin\windows\typescript-axios-petstore-target-es6.bat +call bin\windows\typescript-axios-petstore-with-npm-version.bat +call bin\windows\typescript-axios-petstore-interfaces.bat diff --git a/bin/windows/typescript-axios-petstore-interfaces.bat b/bin/windows/typescript-axios-petstore-interfaces.bat new file mode 100644 index 00000000000..b92c34a9f8b --- /dev/null +++ b/bin/windows/typescript-axios-petstore-interfaces.bat @@ -0,0 +1,12 @@ +@ECHO OFF + +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\2_0\petstore.yaml -g typescript-axios -o samples\client\petstore\typescript-axios\builds\with-interfaces -D withInterfaces=true + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-axios-petstore-target-es6.bat b/bin/windows/typescript-axios-petstore-target-es6.bat new file mode 100644 index 00000000000..e6a971420fb --- /dev/null +++ b/bin/windows/typescript-axios-petstore-target-es6.bat @@ -0,0 +1,12 @@ +@ECHO OFF + +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\2_0\petstore.yaml -g typescript-axios -c bin\typescript-axios-petstore-target-es6.json -o samples\client\petstore\typescript-axios\builds\es6-target + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-axios-petstore-with-npm-version.bat b/bin/windows/typescript-axios-petstore-with-npm-version.bat new file mode 100644 index 00000000000..a3ae2644e9f --- /dev/null +++ b/bin/windows/typescript-axios-petstore-with-npm-version.bat @@ -0,0 +1,12 @@ +@ECHO OFF + +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\2_0\petstore.yaml -g typescript-axios -c bin\typescript-axios-petstore-with-npm-version.json -o samples\client\petstore\typescript-axios\builds\with-npm-version + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/bin/windows/typescript-axios-petstore.bat b/bin/windows/typescript-axios-petstore.bat new file mode 100644 index 00000000000..7b21e6b66e9 --- /dev/null +++ b/bin/windows/typescript-axios-petstore.bat @@ -0,0 +1,14 @@ +@ECHO OFF + +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 + +echo +set ags=generate -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g typescript-axios -o samples\client\petstore\typescript-axios\builds\default + +java %JAVA_OPTS% -jar %executable% %ags% diff --git a/circle.yml b/circle.yml index bfbe40bcedd..cd331d259d7 100644 --- a/circle.yml +++ b/circle.yml @@ -10,7 +10,7 @@ jobs: machine: docker_layer_caching: true working_directory: ~/OpenAPITools/openapi-generator - parallelism: 2 + parallelism: 3 shell: /bin/bash --login environment: CIRCLE_ARTIFACTS: /tmp/circleci-artifacts diff --git a/docs/generators/README.md b/docs/generators/README.md new file mode 100644 index 00000000000..3a1869f4c37 --- /dev/null +++ b/docs/generators/README.md @@ -0,0 +1,110 @@ +The following generators are available: + +* CLIENT generators: + - [ada](ada.md) + - [android](android.md) + - [apex](apex.md) + - [bash](bash.md) + - [clojure](clojure.md) + - [cpp-qt5](cpp-qt5.md) + - [cpp-restsdk](cpp-restsdk.md) + - [cpp-tizen](cpp-tizen.md) + - [csharp](csharp.md) + - [csharp-dotnet2](csharp-dotnet2.md) + - [dart](dart.md) + - [eiffel](eiffel.md) + - [elixir](elixir.md) + - [elm](elm.md) + - [erlang-client](erlang-client.md) + - [flash](flash.md) + - [go](go.md) + - [groovy](groovy.md) + - [haskell-http-client](haskell-http-client.md) + - [java](java.md) + - [javascript](javascript.md) + - [javascript-closure-angular](javascript-closure-angular.md) + - [javascript-flowtyped](javascript-flowtyped.md) + - [jaxrs-cxf-client](jaxrs-cxf-client.md) + - [jmeter](jmeter.md) + - [kotlin](kotlin.md) + - [lua](lua.md) + - [objc](objc.md) + - [perl](perl.md) + - [php](php.md) + - [powershell](powershell.md) + - [python](python.md) + - [r](r.md) + - [ruby](ruby.md) + - [rust](rust.md) + - [scala-akka](scala-akka.md) + - [scala-gatling](scala-gatling.md) + - [scala-httpclient](scala-httpclient.md) + - [scalaz](scalaz.md) + - [swift2-deprecated](swift2-deprecated.md) + - [swift3](swift3.md) + - [swift4](swift4.md) + - [typescript-angular](typescript-angular.md) + - [typescript-angularjs](typescript-angularjs.md) + - [typescript-aurelia](typescript-aurelia.md) + - [typescript-fetch](typescript-fetch.md) + - [typescript-inversify](typescript-inversify.md) + - [typescript-jquery](typescript-jquery.md) + - [typescript-node](typescript-node.md) + + +* SERVER generators: + - [ada-server](ada-server.md) + - [aspnetcore](aspnetcore.md) + - [cpp-pistache-server](cpp-pistache-server.md) + - [cpp-qt5-qhttpengine-server](cpp-qt5-qhttpengine-server.md) + - [cpp-restbed-server](cpp-restbed-server.md) + - [csharp-nancyfx](csharp-nancyfx.md) + - [erlang-server](erlang-server.md) + - [go-server](go-server.md) + - [go-gin-server](go-gin-server.md) + - [haskell](haskell.md) + - [java-inflector](java-inflector.md) + - [java-msf4j](java-msf4j.md) + - [java-pkmst](java-pkmst.md) + - [java-play-framework](java-play-framework.md) + - [java-undertow-server](java-undertow-server.md) + - [java-vertx](java-vertx.md) + - [jaxrs-cxf](jaxrs-cxf.md) + - [jaxrs-cxf-cdi](jaxrs-cxf-cdi.md) + - [jaxrs-jersey](jaxrs-jersey.md) + - [jaxrs-resteasy](jaxrs-resteasy.md) + - [jaxrs-resteasy-eap](jaxrs-resteasy-eap.md) + - [jaxrs-spec](jaxrs-spec.md) + - [kotlin-server](kotlin-server.md) + - [kotlin-spring](kotlin-spring.md) + - [nodejs-server](nodejs-server.md) + - [php-laravel](php-laravel.md) + - [php-lumen](php-lumen.md) + - [php-silex](php-silex.md) + - [php-slim](php-slim.md) + - [php-symfony](php-symfony.md) + - [php-ze-ph](php-ze-ph.md) + - [python-flask](python-flask.md) + - [ruby-on-rails](ruby-on-rails.md) + - [ruby-sinatra](ruby-sinatra.md) + - [rust-server](rust-server.md) + - [scala-finch](scala-finch.md) + - [scala-lagom-server](scala-lagom-server.md) + - [scalatra](scalatra.md) + - [spring](spring.md) + + +* DOCUMENTATION generators: + - [cwiki](cwiki.md) + - [dynamic-html](dynamic-html.md) + - [html](html.md) + - [html2](html2.md) + - [openapi](openapi.md) + - [openapi-yaml](openapi-yaml.md) + + +* CONFIG generators: + - [apache2](apache2.md) + + + diff --git a/docs/generators/ada-server.md b/docs/generators/ada-server.md new file mode 100644 index 00000000000..0cc25355702 --- /dev/null +++ b/docs/generators/ada-server.md @@ -0,0 +1,19 @@ + +CONFIG OPTIONS for ada-server + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + projectName + GNAT project name (Default: defaultProject) + +Back to the [generators list](README.md) diff --git a/docs/generators/ada.md b/docs/generators/ada.md new file mode 100644 index 00000000000..d26a2a3a492 --- /dev/null +++ b/docs/generators/ada.md @@ -0,0 +1,19 @@ + +CONFIG OPTIONS for ada + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + projectName + GNAT project name (Default: defaultProject) + +Back to the [generators list](README.md) diff --git a/docs/generators/android.md b/docs/generators/android.md new file mode 100644 index 00000000000..591cf0159dc --- /dev/null +++ b/docs/generators/android.md @@ -0,0 +1,57 @@ + +CONFIG OPTIONS for android + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId for use in the generated build.gradle and pom.xml + + artifactId + artifactId for use in the generated build.gradle and pom.xml + + artifactVersion + artifact version for use in the generated build.gradle and pom.xml + + sourceFolder + source folder for generated code + + useAndroidMavenGradlePlugin + A flag to toggle android-maven gradle plugin. (Default: true) + + androidGradleVersion + gradleVersion version for use in the generated build.gradle + + androidSdkVersion + compileSdkVersion version for use in the generated build.gradle + + androidBuildToolsVersion + buildToolsVersion version for use in the generated build.gradle + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + library + library template (sub-template) to use + volley - HTTP client: Volley 1.0.19 (default) + httpclient - HTTP client: Apache HttpClient 4.3.6. JSON processing: Gson 2.3.1. IMPORTANT: Android client using HttpClient is not actively maintained and will be depecreated in the next major release. + +Back to the [generators list](README.md) diff --git a/docs/generators/apache2.md b/docs/generators/apache2.md new file mode 100644 index 00000000000..da09b39bdda --- /dev/null +++ b/docs/generators/apache2.md @@ -0,0 +1,19 @@ + +CONFIG OPTIONS for apache2 + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + userInfoPath + Path to the user and group files + +Back to the [generators list](README.md) diff --git a/docs/generators/apex.md b/docs/generators/apex.md new file mode 100644 index 00000000000..f9b7dd5b9bb --- /dev/null +++ b/docs/generators/apex.md @@ -0,0 +1,28 @@ + +CONFIG OPTIONS for apex + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + classPrefix + Prefix for generated classes. Set this to avoid overwriting existing classes in your org. + + apiVersion + The Metadata API version number to use for components in this package. + + buildMethod + The build method for this package. + + namedCredential + The named credential name for the HTTP callouts + +Back to the [generators list](README.md) diff --git a/docs/generators/aspnetcore.md b/docs/generators/aspnetcore.md new file mode 100644 index 00000000000..1db6c0b3137 --- /dev/null +++ b/docs/generators/aspnetcore.md @@ -0,0 +1,34 @@ + +CONFIG OPTIONS for aspnetcore + + packageName + C# package name (convention: Title.Case). (Default: Org.OpenAPITools) + + packageVersion + C# package version. (Default: 1.0.0) + + packageGuid + The GUID that will be associated with the C# project + + sourceFolder + source folder for generated code (Default: src) + + aspnetCoreVersion + ASP.NET Core version: 2.1 (default), 2.0 (deprecated) (Default: 2.1) + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + useDateTimeOffset + Use DateTimeOffset to model date-time properties (Default: false) + + useCollection + Deserialize array types to Collection instead of List. (Default: false) + + returnICollection + Return ICollection instead of the concrete type. (Default: false) + + useSwashbuckle + Uses the Swashbuckle.AspNetCore NuGet package for documentation. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/bash.md b/docs/generators/bash.md new file mode 100644 index 00000000000..853512c85e0 --- /dev/null +++ b/docs/generators/bash.md @@ -0,0 +1,40 @@ + +CONFIG OPTIONS for bash + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + curlOptions + Default cURL options + + processMarkdown + Convert all Markdown Markup into terminal formatting (Default: false) + + scriptName + The name of the script that will be generated (e.g. petstore-cli) + + generateBashCompletion + Whether to generate the Bash completion script (Default: false) + + generateZshCompletion + Whether to generate the Zsh completion script (Default: false) + + hostEnvironmentVariable + Name of environment variable where host can be defined (e.g. PETSTORE_HOST='http://api.openapitools.org:8080') + + basicAuthEnvironmentVariable + Name of environment variable where username and password can be defined (e.g. PETSTORE_CREDS='username:password') + + apiKeyAuthEnvironmentVariable + Name of environment variable where API key can be defined (e.g. PETSTORE_APIKEY='kjhasdGASDa5asdASD') (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/clojure.md b/docs/generators/clojure.md new file mode 100644 index 00000000000..55bc7facb49 --- /dev/null +++ b/docs/generators/clojure.md @@ -0,0 +1,37 @@ + +CONFIG OPTIONS for clojure + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + projectName + name of the project (Default: generated from info.title or "openapi-clj-client") + + projectDescription + description of the project (Default: using info.description or "Client library of ") + + projectVersion + version of the project (Default: using info.version or "1.0.0") + + projectUrl + URL of the project (Default: using info.contact.url or not included in project.clj) + + projectLicenseName + name of the license the project uses (Default: using info.license.name or not included in project.clj) + + projectLicenseUrl + URL of the license the project uses (Default: using info.license.url or not included in project.clj) + + baseNamespace + the base/top namespace (Default: generated from projectName) + +Back to the [generators list](README.md) diff --git a/docs/generators/cpp-pistache-server.md b/docs/generators/cpp-pistache-server.md new file mode 100644 index 00000000000..52f9ed18c17 --- /dev/null +++ b/docs/generators/cpp-pistache-server.md @@ -0,0 +1,10 @@ + +CONFIG OPTIONS for cpp-pistache-server + + addExternalLibs + Add the Possibility to fetch and compile external Libraries needed by this Framework. (Default: true) + + helpersPackage + Specify the package name to be used for the helpers (e.g. org.openapitools.server.helpers). (Default: org.openapitools.server.helpers) + +Back to the [generators list](README.md) diff --git a/docs/generators/cpp-qt5-qhttpengine-server.md b/docs/generators/cpp-qt5-qhttpengine-server.md new file mode 100644 index 00000000000..4d0427ee2d5 --- /dev/null +++ b/docs/generators/cpp-qt5-qhttpengine-server.md @@ -0,0 +1,19 @@ + +CONFIG OPTIONS for cpp-qt5-qhttpengine-server + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + cppNamespace + C++ namespace (convention: name::space::for::api). (Default: OpenAPI) + +Back to the [generators list](README.md) diff --git a/docs/generators/cpp-qt5.md b/docs/generators/cpp-qt5.md new file mode 100644 index 00000000000..924187fc8e4 --- /dev/null +++ b/docs/generators/cpp-qt5.md @@ -0,0 +1,22 @@ + +CONFIG OPTIONS for cpp-qt5 + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + cppNamespace + C++ namespace (convention: name::space::for::api). (Default: OpenAPI) + + optionalProjectFile + Generate client.pri. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/cpp-restbed-server.md b/docs/generators/cpp-restbed-server.md new file mode 100644 index 00000000000..0ef5dfddf05 --- /dev/null +++ b/docs/generators/cpp-restbed-server.md @@ -0,0 +1,19 @@ + +CONFIG OPTIONS for cpp-restbed-server + + modelPackage + C++ namespace for models (convention: name.space.model). (Default: org.openapitools.server.model) + + apiPackage + C++ namespace for apis (convention: name.space.api). (Default: org.openapitools.server.api) + + packageVersion + C++ package version. (Default: 1.0.0) + + declspec + C++ preprocessor to place before the class name for handling dllexport/dllimport. (Default: ) + + defaultInclude + The default include statement that should be placed in all headers for including things like the declspec (convention: #include "Commons.h" (Default: ) + +Back to the [generators list](README.md) diff --git a/docs/generators/cpp-restsdk.md b/docs/generators/cpp-restsdk.md new file mode 100644 index 00000000000..9ada7842d0d --- /dev/null +++ b/docs/generators/cpp-restsdk.md @@ -0,0 +1,22 @@ + +CONFIG OPTIONS for cpp-restsdk + + modelPackage + C++ namespace for models (convention: name.space.model). (Default: org.openapitools.client.model) + + apiPackage + C++ namespace for apis (convention: name.space.api). (Default: org.openapitools.client.api) + + packageVersion + C++ package version. (Default: 1.0.0) + + declspec + C++ preprocessor to place before the class name for handling dllexport/dllimport. (Default: ) + + defaultInclude + The default include statement that should be placed in all headers for including things like the declspec (convention: #include "Commons.h" (Default: ) + + generateGMocksForApis + Generate Google Mock classes for APIs. + +Back to the [generators list](README.md) diff --git a/docs/generators/cpp-tizen.md b/docs/generators/cpp-tizen.md new file mode 100644 index 00000000000..a9f5e3db24f --- /dev/null +++ b/docs/generators/cpp-tizen.md @@ -0,0 +1,16 @@ + +CONFIG OPTIONS for cpp-tizen + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/csharp-dotnet2.md b/docs/generators/csharp-dotnet2.md new file mode 100644 index 00000000000..79ce829f9c2 --- /dev/null +++ b/docs/generators/csharp-dotnet2.md @@ -0,0 +1,13 @@ + +CONFIG OPTIONS for csharp-dotnet2 + + packageName + C# package name (convention: Camel.Case). (Default: Org.OpenAPITools) + + packageVersion + C# package version. (Default: 1.0.0) + + clientPackage + C# client package name (convention: Camel.Case). (Default: Org.OpenAPITools.Client) + +Back to the [generators list](README.md) diff --git a/docs/generators/csharp-nancyfx.md b/docs/generators/csharp-nancyfx.md new file mode 100644 index 00000000000..209951d9f2d --- /dev/null +++ b/docs/generators/csharp-nancyfx.md @@ -0,0 +1,46 @@ + +CONFIG OPTIONS for csharp-nancyfx + + packageName + C# package name (convention: Title.Case). (Default: Org.OpenAPITools) + + packageVersion + C# package version. (Default: 1.0.0) + + sourceFolder + source folder for generated code (Default: src) + + interfacePrefix + Prefix interfaces with a community standard or widely accepted prefix. (Default: ) + + packageGuid + The GUID that will be associated with the C# project + + packageContext + Optionally overrides the PackageContext which determines the namespace (namespace=packageName.packageContext). If not set, packageContext will default to basePath. + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + optionalProjectFile + Generate {PackageName}.csproj. (Default: true) + + useDateTimeOffset + Use DateTimeOffset to model date-time properties (Default: false) + + useCollection + Deserialize array types to Collection instead of List. (Default: false) + + returnICollection + Return ICollection instead of the concrete type. (Default: false) + + immutable + Enabled by default. If disabled generates model classes with setters (Default: true) + + writeModulePath + Enabled by default. If disabled, module paths will not mirror api base path (Default: true) + + asyncServer + Set to true to enable the generation of async routes/endpoints. (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/csharp.md b/docs/generators/csharp.md new file mode 100644 index 00000000000..4cf223a515e --- /dev/null +++ b/docs/generators/csharp.md @@ -0,0 +1,72 @@ + +CONFIG OPTIONS for csharp + + packageName + C# package name (convention: Title.Case). (Default: Org.OpenAPITools) + + packageVersion + C# package version. (Default: 1.0.0) + + sourceFolder + source folder for generated code (Default: src) + + packageGuid + The GUID that will be associated with the C# project + + interfacePrefix + Prefix interfaces with a community standard or widely accepted prefix. (Default: I) + + targetFramework + The target .NET framework version. (Default: v4.5) + v3.5 - .NET Framework 3.5 compatible + v4.0 - .NET Framework 4.0 compatible + v4.5 - .NET Framework 4.5+ compatible + v5.0 - .NET Standard 1.3 compatible + uwp - Universal Windows Platform (IMPORTANT: this will be decommissioned and replaced by v5.0) + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: PascalCase) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + useDateTimeOffset + Use DateTimeOffset to model date-time properties (Default: false) + + useCollection + Deserialize array types to Collection instead of List. (Default: false) + + returnICollection + Return ICollection instead of the concrete type. (Default: false) + + optionalMethodArgument + C# Optional method argument, e.g. void square(int x=10) (.net 4.0+ only). (Default: true) + + optionalAssemblyInfo + Generate AssemblyInfo.cs. (Default: true) + + optionalProjectFile + Generate {PackageName}.csproj. (Default: true) + + optionalEmitDefaultValues + Set DataMember's EmitDefaultValue. (Default: false) + + generatePropertyChanged + Specifies a AssemblyDescription for the .NET Framework global assembly attributes stored in the AssemblyInfo file. (Default: false) + + nonPublicApi + Generates code with reduced access modifiers; allows embedding elsewhere without exposing non-public API calls to consumers. (Default: false) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + netCoreProjectFile + Use the new format (.NET Core) for .NET project files (.csproj). (Default: false) + + validatable + Generates self-validatable models. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/cwiki.md b/docs/generators/cwiki.md new file mode 100644 index 00000000000..3af892ada70 --- /dev/null +++ b/docs/generators/cwiki.md @@ -0,0 +1,46 @@ + +CONFIG OPTIONS for cwiki + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + appName + short name of the application + + appDescription + description of the application + + infoUrl + a URL where users can get more information about the application + + infoEmail + an email address to contact for inquiries about the application + + licenseInfo + a short description of the license + + licenseUrl + a URL pointing to the full license + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + +Back to the [generators list](README.md) diff --git a/docs/generators/dart-jaguar.md b/docs/generators/dart-jaguar.md new file mode 100644 index 00000000000..133455a72e9 --- /dev/null +++ b/docs/generators/dart-jaguar.md @@ -0,0 +1,37 @@ + +CONFIG OPTIONS for dart-jaguar + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + browserClient + Is the client browser based + + pubName + Name in generated pubspec + + pubVersion + Version in generated pubspec + + pubDescription + Description in generated pubspec + + useEnumExtension + Allow the 'x-enum-values' extension for enums + + sourceFolder + source folder for generated code + + supportDart2 + support dart2 (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/dart.md b/docs/generators/dart.md new file mode 100644 index 00000000000..3e552468305 --- /dev/null +++ b/docs/generators/dart.md @@ -0,0 +1,37 @@ + +CONFIG OPTIONS for dart + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + browserClient + Is the client browser based + + pubName + Name in generated pubspec + + pubVersion + Version in generated pubspec + + pubDescription + Description in generated pubspec + + useEnumExtension + Allow the 'x-enum-values' extension for enums + + sourceFolder + source folder for generated code + + supportDart2 + support dart2 (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/dynamic-html.md b/docs/generators/dynamic-html.md new file mode 100644 index 00000000000..e6f20ff0247 --- /dev/null +++ b/docs/generators/dynamic-html.md @@ -0,0 +1,28 @@ + +CONFIG OPTIONS for dynamic-html + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + +Back to the [generators list](README.md) diff --git a/docs/generators/eiffel.md b/docs/generators/eiffel.md new file mode 100644 index 00000000000..5c806df6adc --- /dev/null +++ b/docs/generators/eiffel.md @@ -0,0 +1,13 @@ + +CONFIG OPTIONS for eiffel + + packageName + Eiffel Cluster name (convention: lowercase). (Default: openapi) + + packageVersion + Eiffel package version. (Default: 1.0.0) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/elixir.md b/docs/generators/elixir.md new file mode 100644 index 00000000000..92dad5e3c0e --- /dev/null +++ b/docs/generators/elixir.md @@ -0,0 +1,25 @@ + +CONFIG OPTIONS for elixir + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + invokerPackage + The main namespace to use for all classes. e.g. Yay.Pets + + licenseHeader + The license header to prepend to the top of all source files. + + packageName + Elixir package name (convention: lowercase). + +Back to the [generators list](README.md) diff --git a/docs/generators/elm.md b/docs/generators/elm.md new file mode 100644 index 00000000000..891a281d1eb --- /dev/null +++ b/docs/generators/elm.md @@ -0,0 +1,9 @@ + +CONFIG OPTIONS for elm + + elmVersion + Elm version: 0.18, 0.19 (Default: 0.19) + 0.19 - Elm 0.19 + 0.18 - Elm 0.18 + +Back to the [generators list](README.md) diff --git a/docs/generators/erlang-client.md b/docs/generators/erlang-client.md new file mode 100644 index 00000000000..e3a2aa7ce69 --- /dev/null +++ b/docs/generators/erlang-client.md @@ -0,0 +1,10 @@ + +CONFIG OPTIONS for erlang-client + + packageName + Erlang application name (convention: lowercase). (Default: openapi) + + packageName + Erlang application version (Default: 1.0.0) + +Back to the [generators list](README.md) diff --git a/docs/generators/erlang-server.md b/docs/generators/erlang-server.md new file mode 100644 index 00000000000..29c7d51313d --- /dev/null +++ b/docs/generators/erlang-server.md @@ -0,0 +1,7 @@ + +CONFIG OPTIONS for erlang-server + + packageName + Erlang package name (convention: lowercase). (Default: openapi) + +Back to the [generators list](README.md) diff --git a/docs/generators/flash.md b/docs/generators/flash.md new file mode 100644 index 00000000000..4c84604c40a --- /dev/null +++ b/docs/generators/flash.md @@ -0,0 +1,16 @@ + +CONFIG OPTIONS for flash + + packageName + flash package name (convention: package.name) (Default: org.openapitools) + + packageVersion + flash package version (Default: 1.0.0) + + invokerPackage + root package for generated code + + sourceFolder + source folder for generated code. e.g. flash + +Back to the [generators list](README.md) diff --git a/docs/generators/go-gin-server.md b/docs/generators/go-gin-server.md new file mode 100644 index 00000000000..1589b7f42a6 --- /dev/null +++ b/docs/generators/go-gin-server.md @@ -0,0 +1,10 @@ + +CONFIG OPTIONS for go-gin-server + + packageName + Go package name (convention: lowercase). (Default: openapi) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/go-server.md b/docs/generators/go-server.md new file mode 100644 index 00000000000..462aed9db17 --- /dev/null +++ b/docs/generators/go-server.md @@ -0,0 +1,10 @@ + +CONFIG OPTIONS for go-server + + packageName + Go package name (convention: lowercase). (Default: openapi) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/go.md b/docs/generators/go.md new file mode 100644 index 00000000000..f5b1c1ae9a9 --- /dev/null +++ b/docs/generators/go.md @@ -0,0 +1,22 @@ + +CONFIG OPTIONS for go + + packageName + Go package name (convention: lowercase). (Default: openapi) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + + packageVersion + Go package version. (Default: 1.0.0) + + withGoCodegenComment + whether to include Go codegen comment to disable Go Lint and collapse by default GitHub in PRs and diffs (Default: false) + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/groovy.md b/docs/generators/groovy.md new file mode 100644 index 00000000000..9a6ff34c6cf --- /dev/null +++ b/docs/generators/groovy.md @@ -0,0 +1,119 @@ + +CONFIG OPTIONS for groovy + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + configPackage + configuration package for generated code + +Back to the [generators list](README.md) diff --git a/docs/generators/haskell-http-client.md b/docs/generators/haskell-http-client.md new file mode 100644 index 00000000000..af303d7cd44 --- /dev/null +++ b/docs/generators/haskell-http-client.md @@ -0,0 +1,73 @@ + +CONFIG OPTIONS for haskell-http-client + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + cabalPackage + Set the cabal package name, which consists of one or more alphanumeric words separated by hyphens + + cabalVersion + Set the cabal version number, consisting of a sequence of one or more integers separated by dots + + baseModule + Set the base module namespace + + requestType + Set the name of the type used to generate requests + + configType + Set the name of the type used for configuration + + allowFromJsonNulls + allow JSON Null during model decoding from JSON (Default: true) + + allowToJsonNulls + allow emitting JSON Null during model encoding to JSON (Default: false) + + allowNonUniqueOperationIds + allow different API modules to contain the same operationId. Each API must be imported qualified (Default: false) + + generateLenses + Generate Lens optics for Models (Default: true) + + generateModelConstructors + Generate smart constructors (only supply required fields) for models (Default: true) + + generateEnums + Generate specific datatypes for OpenAPI enums (Default: true) + + generateFormUrlEncodedInstances + Generate FromForm/ToForm instances for models that are used by operations that produce or consume application/x-www-form-urlencoded (Default: true) + + inlineMimeTypes + Inline (hardcode) the content-type and accept parameters on operations, when there is only 1 option (Default: true) + + modelDeriving + Additional classes to include in the deriving() clause of Models + + strictFields + Add strictness annotations to all model fields (Default: true) + + useMonadLogger + Use the monad-logger package to provide logging (if false, use the katip logging package) (Default: false) + + dateTimeFormat + format string used to parse/render a datetime + + dateFormat + format string used to parse/render a date (Default: %Y-%m-%d) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/haskell.md b/docs/generators/haskell.md new file mode 100644 index 00000000000..3fbbb3f5aee --- /dev/null +++ b/docs/generators/haskell.md @@ -0,0 +1,22 @@ + +CONFIG OPTIONS for haskell + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + +Back to the [generators list](README.md) diff --git a/docs/generators/html.md b/docs/generators/html.md new file mode 100644 index 00000000000..61384bb6c20 --- /dev/null +++ b/docs/generators/html.md @@ -0,0 +1,46 @@ + +CONFIG OPTIONS for html + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + appName + short name of the application + + appDescription + description of the application + + infoUrl + a URL where users can get more information about the application + + infoEmail + an email address to contact for inquiries about the application + + licenseInfo + a short description of the license + + licenseUrl + a URL pointing to the full license + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + +Back to the [generators list](README.md) diff --git a/docs/generators/html2.md b/docs/generators/html2.md new file mode 100644 index 00000000000..3e17d693122 --- /dev/null +++ b/docs/generators/html2.md @@ -0,0 +1,58 @@ + +CONFIG OPTIONS for html2 + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + appName + short name of the application + + appDescription + description of the application + + infoUrl + a URL where users can get more information about the application + + infoEmail + an email address to contact for inquiries about the application + + licenseInfo + a short description of the license + + licenseUrl + a URL pointing to the full license + + invokerPackage + root package for generated code + + phpInvokerPackage + root package for generated php code + + perlModuleName + root module name for generated perl code + + pythonPackageName + package name for generated python code + + packageName + C# package name + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + +Back to the [generators list](README.md) diff --git a/docs/generators/java-inflector.md b/docs/generators/java-inflector.md new file mode 100644 index 00000000000..f142ee247bd --- /dev/null +++ b/docs/generators/java-inflector.md @@ -0,0 +1,116 @@ + +CONFIG OPTIONS for java-inflector + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + +Back to the [generators list](README.md) diff --git a/docs/generators/java-msf4j.md b/docs/generators/java-msf4j.md new file mode 100644 index 00000000000..b2817e0b7c1 --- /dev/null +++ b/docs/generators/java-msf4j.md @@ -0,0 +1,133 @@ + +CONFIG OPTIONS for java-msf4j + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + implFolder + folder for generated implementation code + + title + a title describing the application + + useBeanValidation + Use BeanValidation API annotations (Default: true) + + serverPort + The port on which the server should be started + + library + library template (sub-template) to use (Default: jersey2) + jersey1 - Jersey core 1.x + jersey2 - Jersey core 2.x + +Back to the [generators list](README.md) diff --git a/docs/generators/java-pkmst.md b/docs/generators/java-pkmst.md new file mode 100644 index 00000000000..1cab3be93ba --- /dev/null +++ b/docs/generators/java-pkmst.md @@ -0,0 +1,146 @@ + +CONFIG OPTIONS for java-pkmst + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + basePackage + base package for java source code + + serviceName + Service Name + + title + server title name or client service name + + eurekaUri + Eureka URI + + zipkinUri + Zipkin URI + + springBootAdminUri + Spring-Boot URI + + pkmstInterceptor + PKMST Interceptor + +Back to the [generators list](README.md) diff --git a/docs/generators/java-play-framework.md b/docs/generators/java-play-framework.md new file mode 100644 index 00000000000..801c965df75 --- /dev/null +++ b/docs/generators/java-play-framework.md @@ -0,0 +1,143 @@ + +CONFIG OPTIONS for java-play-framework + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + title + server title name or client service name + + configPackage + configuration package for generated code + + basePackage + base package for generated code + + controllerOnly + Whether to generate only API interface stubs without the server files. (Default: false) + + useBeanValidation + Use BeanValidation API annotations (Default: true) + + useInterfaces + Makes the controllerImp implements an interface to facilitate automatic completion when updating from version x to y of your spec (Default: true) + + handleExceptions + Add a 'throw exception' to each controller function. Add also a custom error handler where you can put your custom logic (Default: true) + + wrapCalls + Add a wrapper to each controller function to handle things like metrics, response modification, etc.. (Default: true) + + useSwaggerUI + Add a route to /api which show your documentation in swagger-ui. Will also import needed dependencies (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/java-undertow-server.md b/docs/generators/java-undertow-server.md new file mode 100644 index 00000000000..facaf3aa831 --- /dev/null +++ b/docs/generators/java-undertow-server.md @@ -0,0 +1,116 @@ + +CONFIG OPTIONS for java-undertow-server + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + +Back to the [generators list](README.md) diff --git a/docs/generators/java-vertx.md b/docs/generators/java-vertx.md new file mode 100644 index 00000000000..7a2099f101c --- /dev/null +++ b/docs/generators/java-vertx.md @@ -0,0 +1,122 @@ + +CONFIG OPTIONS for java-vertx + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + rxInterface + When specified, API interfaces are generated with RX and methods return Single<> and Comparable. (Default: false) + + vertxSwaggerRouterVersion + Specify the version of the swagger router library + +Back to the [generators list](README.md) diff --git a/docs/generators/java.md b/docs/generators/java.md new file mode 100644 index 00000000000..01942712ab3 --- /dev/null +++ b/docs/generators/java.md @@ -0,0 +1,164 @@ + +CONFIG OPTIONS for java + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + useRxJava + Whether to use the RxJava adapter with the retrofit2 library. (Default: false) + + useRxJava2 + Whether to use the RxJava2 adapter with the retrofit2 library. (Default: false) + + parcelableModel + Whether to generate models for Android that implement Parcelable with the okhttp-gson library. (Default: false) + + usePlayWS + Use Play! Async HTTP client (Play WS API) (Default: false) + + playVersion + Version of Play! Framework (possible values "play24", "play25" (default), "play26") + + supportJava6 + Whether to support Java6 with the Jersey1 library. (Default: false) + + useBeanValidation + Use BeanValidation API annotations (Default: false) + + performBeanValidation + Perform BeanValidation (Default: false) + + useGzipFeature + Send gzip-encoded requests (Default: false) + + useRuntimeException + Use RuntimeException instead of Exception (Default: false) + + feignVersion + Version of OpenFeign: '10.x', '9.x' (default) (Default: false) + + library + library template (sub-template) to use (Default: okhttp-gson) + jersey1 - HTTP client: Jersey client 1.19.4. JSON processing: Jackson 2.8.9. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. + feign - HTTP client: OpenFeign 9.4.0. JSON processing: Jackson 2.8.9. To enable OpenFeign 10.x, set the 'feignVersion' option to '10.x' + jersey2 - HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.8.9 + okhttp-gson - HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.8.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'. + retrofit - HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.3.1 (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead. + retrofit2 - HTTP client: OkHttp 3.8.0. JSON processing: Gson 2.6.1 (Retrofit 2.3.0). Enable the RxJava adapter using '-DuseRxJava[2]=true'. (RxJava 1.x or 2.x) + resttemplate - HTTP client: Spring RestTemplate 4.3.9-RELEASE. JSON processing: Jackson 2.8.9 + webclient - HTTP client: Spring WebClient 5.0.7-RELEASE. JSON processing: Jackson 2.9.5 + resteasy - HTTP client: Resteasy client 3.1.3.Final. JSON processing: Jackson 2.8.9 + vertx - HTTP client: VertX client 3.2.4. JSON processing: Jackson 2.8.9 + google-api-client - HTTP client: Google API client 1.23.0. JSON processing: Jackson 2.8.9 + rest-assured - HTTP client: rest-assured : 3.1.0. JSON processing: Gson 2.6.1. Only for Java8 + +Back to the [generators list](README.md) diff --git a/docs/generators/javascript-closure-angular.md b/docs/generators/javascript-closure-angular.md new file mode 100644 index 00000000000..69f68a35840 --- /dev/null +++ b/docs/generators/javascript-closure-angular.md @@ -0,0 +1,22 @@ + +CONFIG OPTIONS for javascript-closure-angular + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + + useEs6 + use ES6 templates (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/javascript-flowtyped.md b/docs/generators/javascript-flowtyped.md new file mode 100644 index 00000000000..242bde62238 --- /dev/null +++ b/docs/generators/javascript-flowtyped.md @@ -0,0 +1,34 @@ + +CONFIG OPTIONS for javascript-flowtyped + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + + supportsES6 + Generate code that conforms to ES6. (Default: false) + + npmName + The name under which you want to publish generated npm package + + npmVersion + The version of your npm package + + npmRepository + Use this property to set an url your private npmRepo in the package.json + + snapshot + When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/javascript.md b/docs/generators/javascript.md new file mode 100644 index 00000000000..e8d9df4c650 --- /dev/null +++ b/docs/generators/javascript.md @@ -0,0 +1,67 @@ + +CONFIG OPTIONS for javascript + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + sourceFolder + source folder for generated code (Default: src) + + localVariablePrefix + prefix for generated code members and local variables + + invokerPackage + root package for generated code + + apiPackage + package for generated api classes + + modelPackage + package for generated models + + projectName + name of the project (Default: generated from info.title or "openapi-js-client") + + moduleName + module name for AMD, Node or globals (Default: generated from ) + + projectDescription + description of the project (Default: using info.description or "Client library of ") + + projectVersion + version of the project (Default: using info.version or "1.0.0") + + licenseName + name of the license the project uses (Default: using info.license.name) + + usePromises + use Promises as return values from the client API, instead of superagent callbacks (Default: false) + + emitModelMethods + generate getters and setters for model properties (Default: false) + + emitJSDoc + generate JSDoc comments (Default: true) + + useInheritance + use JavaScript prototype chains & delegation for inheritance (Default: true) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + + useES6 + use JavaScript ES6 (ECMAScript 6) (beta). Default is ES5. (Default: false) + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + +Back to the [generators list](README.md) diff --git a/docs/generators/jaxrs-cxf-cdi.md b/docs/generators/jaxrs-cxf-cdi.md new file mode 100644 index 00000000000..6f29fc10868 --- /dev/null +++ b/docs/generators/jaxrs-cxf-cdi.md @@ -0,0 +1,147 @@ + +CONFIG OPTIONS for jaxrs-cxf-cdi + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + implFolder + folder for generated implementation code + + title + a title describing the application + + useBeanValidation + Use BeanValidation API annotations (Default: true) + + serverPort + The port on which the server should be started + + library + library template (sub-template) to use (Default: ) + - JAXRS + + generatePom + Whether to generate pom.xml if the file does not already exist. (Default: true) + + interfaceOnly + Whether to generate only API interface stubs without the server files. (Default: false) + + returnResponse + Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true. (Default: false) + + useSwaggerAnnotations + Whether to generate Swagger annotations. (Default: true) + + useBeanValidation + Use BeanValidation API annotations (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/jaxrs-cxf-client.md b/docs/generators/jaxrs-cxf-client.md new file mode 100644 index 00000000000..df9f1d2b8af --- /dev/null +++ b/docs/generators/jaxrs-cxf-client.md @@ -0,0 +1,128 @@ + +CONFIG OPTIONS for jaxrs-cxf-client + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + useBeanValidation + Use BeanValidation API annotations (Default: false) + + useGzipFeatureForTests + Use Gzip Feature for tests (Default: false) + + useLoggingFeatureForTests + Use Logging Feature for tests (Default: false) + + useGenericResponse + Use generic response (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/jaxrs-cxf.md b/docs/generators/jaxrs-cxf.md new file mode 100644 index 00000000000..4fce66ff8dc --- /dev/null +++ b/docs/generators/jaxrs-cxf.md @@ -0,0 +1,179 @@ + +CONFIG OPTIONS for jaxrs-cxf + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + implFolder + folder for generated implementation code + + title + a title describing the application + + useBeanValidation + Use BeanValidation API annotations (Default: true) + + serverPort + The port on which the server should be started + + generateSpringApplication + Generate Spring application (Default: false) + + useSpringAnnotationConfig + Use Spring Annotation Config (Default: false) + + useSwaggerFeature + Use Swagger Feature (Default: false) + + useSwaggerUI + Use Swagger UI (Default: false) + + useWadlFeature + Use WADL Feature (Default: false) + + useMultipartFeature + Use Multipart Feature (Default: false) + + useGzipFeature + Use Gzip Feature (Default: false) + + useGzipFeatureForTests + Use Gzip Feature for tests (Default: false) + + useBeanValidationFeature + Use BeanValidation Feature (Default: false) + + useLoggingFeature + Use Logging Feature (Default: false) + + useLoggingFeatureForTests + Use Logging Feature for tests (Default: false) + + generateSpringBootApplication + Generate Spring Boot application (Default: false) + + generateJbossDeploymentDescriptor + Generate Jboss Deployment Descriptor (Default: false) + + addConsumesProducesJson + Add @Consumes/@Produces Json to API interface (Default: false) + + useAnnotatedBasePath + Use @Path annotations for basePath (Default: false) + + generateNonSpringApplication + Generate non-Spring application (Default: false) + + useGenericResponse + Use generic response (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/jaxrs-jersey.md b/docs/generators/jaxrs-jersey.md new file mode 100644 index 00000000000..b4b0d29c76f --- /dev/null +++ b/docs/generators/jaxrs-jersey.md @@ -0,0 +1,139 @@ + +CONFIG OPTIONS for jaxrs-jersey + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + implFolder + folder for generated implementation code + + title + a title describing the application + + useBeanValidation + Use BeanValidation API annotations (Default: true) + + serverPort + The port on which the server should be started + + library + library template (sub-template) to use (Default: jersey2) + jersey1 - Jersey core 1.x + jersey2 - Jersey core 2.x + + supportJava6 + Whether to support Java6 with the Jersey1/2 library. (Default: false) + + useTags + use tags for creating interface and controller classnames (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/jaxrs-resteasy-eap.md b/docs/generators/jaxrs-resteasy-eap.md new file mode 100644 index 00000000000..d031162a1fc --- /dev/null +++ b/docs/generators/jaxrs-resteasy-eap.md @@ -0,0 +1,137 @@ + +CONFIG OPTIONS for jaxrs-resteasy-eap + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + implFolder + folder for generated implementation code + + title + a title describing the application + + useBeanValidation + Use BeanValidation API annotations (Default: true) + + serverPort + The port on which the server should be started + + useBeanValidation + Use BeanValidation API annotations (Default: true) + + generateJbossDeploymentDescriptor + Generate Jboss Deployment Descriptor (Default: true) + + useSwaggerFeature + Use dynamic Swagger generator (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/jaxrs-resteasy.md b/docs/generators/jaxrs-resteasy.md new file mode 100644 index 00000000000..56db591b479 --- /dev/null +++ b/docs/generators/jaxrs-resteasy.md @@ -0,0 +1,131 @@ + +CONFIG OPTIONS for jaxrs-resteasy + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + implFolder + folder for generated implementation code + + title + a title describing the application + + useBeanValidation + Use BeanValidation API annotations (Default: true) + + serverPort + The port on which the server should be started + + generateJbossDeploymentDescriptor + Generate Jboss Deployment Descriptor (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/jaxrs-spec.md b/docs/generators/jaxrs-spec.md new file mode 100644 index 00000000000..1c9a9cf12d3 --- /dev/null +++ b/docs/generators/jaxrs-spec.md @@ -0,0 +1,144 @@ + +CONFIG OPTIONS for jaxrs-spec + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + implFolder + folder for generated implementation code + + title + a title describing the application + + useBeanValidation + Use BeanValidation API annotations (Default: true) + + serverPort + The port on which the server should be started + + library + library template (sub-template) to use (Default: ) + - JAXRS + + generatePom + Whether to generate pom.xml if the file does not already exist. (Default: true) + + interfaceOnly + Whether to generate only API interface stubs without the server files. (Default: false) + + returnResponse + Whether generate API interface should return javax.ws.rs.core.Response instead of a deserialized entity. Only useful if interfaceOnly is true. (Default: false) + + useSwaggerAnnotations + Whether to generate Swagger annotations. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/jmeter.md b/docs/generators/jmeter.md new file mode 100644 index 00000000000..c9a8d2a0e9f --- /dev/null +++ b/docs/generators/jmeter.md @@ -0,0 +1,16 @@ + +CONFIG OPTIONS for jmeter + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/kotlin-server.md b/docs/generators/kotlin-server.md new file mode 100644 index 00000000000..08b3996237f --- /dev/null +++ b/docs/generators/kotlin-server.md @@ -0,0 +1,41 @@ + +CONFIG OPTIONS for kotlin-server + + sourceFolder + source folder for generated code (Default: src/main/kotlin) + + packageName + Generated artifact package name (e.g. io.swagger). + + groupId + Generated artifact package's organization (i.e. maven groupId). (Default: org.openapitools) + + artifactId + Generated artifact id (name of jar). + + artifactVersion + Generated artifact's package version. (Default: 1.0.0) + + enumPropertyNaming + Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original' (Default: camelCase) + + library + library template (sub-template) to use (Default: ktor) + ktor - ktor framework + + featureAutoHead + Automatically provide responses to HEAD requests for existing routes that have the GET verb defined. (Default: true) + + featureConditionalHeaders + Avoid sending content if client already has same content, by checking ETag or LastModified properties. (Default: false) + + featureHSTS + Avoid sending content if client already has same content, by checking ETag or LastModified properties. (Default: true) + + featureCORS + Ktor by default provides an interceptor for implementing proper support for Cross-Origin Resource Sharing (CORS). See enable-cors.org. (Default: false) + + featureCompression + Adds ability to compress outgoing content using gzip, deflate or custom encoder and thus reduce size of the response. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/kotlin-spring.md b/docs/generators/kotlin-spring.md new file mode 100644 index 00000000000..dace2b33af9 --- /dev/null +++ b/docs/generators/kotlin-spring.md @@ -0,0 +1,59 @@ + +CONFIG OPTIONS for kotlin-spring + + sourceFolder + source folder for generated code (Default: src/main/kotlin) + + packageName + Generated artifact package name (e.g. io.swagger). + + groupId + Generated artifact package's organization (i.e. maven groupId). (Default: org.openapitools) + + artifactId + Generated artifact id (name of jar). + + artifactVersion + Generated artifact's package version. (Default: 1.0.0) + + enumPropertyNaming + Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original' (Default: camelCase) + + title + server title name or client service name (Default: OpenAPI Kotlin Spring) + + basePackage + base package (invokerPackage) for generated code (Default: org.openapitools) + + serverPort + configuration the port in which the sever is to run on (Default: 8080) + + modelPackage + model package for generated code (Default: org.openapitools.model) + + apiPackage + api package for generated code (Default: org.openapitools.api) + + exceptionHandler + generate default global exception handlers (Default: true) + + gradleBuildFile + generate a gradle build file using the Kotlin DSL (Default: true) + + swaggerAnnotations + generate swagger annotations to go alongside controllers and models (Default: false) + + serviceInterface + generate service interfaces to go alongside controllers. In most cases this option would be used to update an existing project, so not to override implementations. Useful to help facilitate the generation gap pattern (Default: false) + + serviceImplementation + generate stub service implementations that extends service interfaces. If this is set to true service interfaces will also be generated (Default: false) + + useBeanValidation + Use BeanValidation API annotations to validate data types (Default: true) + + library + library template (sub-template) to use (Default: spring-boot) + spring-boot - Spring-boot Server application. + +Back to the [generators list](README.md) diff --git a/docs/generators/kotlin.md b/docs/generators/kotlin.md new file mode 100644 index 00000000000..e2184b546bf --- /dev/null +++ b/docs/generators/kotlin.md @@ -0,0 +1,28 @@ + +CONFIG OPTIONS for kotlin + + sourceFolder + source folder for generated code (Default: src/main/kotlin) + + packageName + Generated artifact package name (e.g. io.swagger). + + groupId + Generated artifact package's organization (i.e. maven groupId). (Default: org.openapitools) + + artifactId + Generated artifact id (name of jar). + + artifactVersion + Generated artifact's package version. (Default: 1.0.0) + + enumPropertyNaming + Naming convention for enum properties: 'camelCase', 'PascalCase', 'snake_case', 'UPPERCASE', and 'original' (Default: camelCase) + + dateLibrary + Option. Date library to use + string - String + java8 - Java 8 native JSR310 + threetenbp - Threetenbp + +Back to the [generators list](README.md) diff --git a/docs/generators/lua.md b/docs/generators/lua.md new file mode 100644 index 00000000000..721da77eddf --- /dev/null +++ b/docs/generators/lua.md @@ -0,0 +1,13 @@ + +CONFIG OPTIONS for lua + + packageName + Lua package name (convention: lowercase). (Default: swagger-client) + + packageVersion + Lua package version. (Default: 1.0.0-1) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/mysql-schema.md b/docs/generators/mysql-schema.md new file mode 100644 index 00000000000..ae70f7db075 --- /dev/null +++ b/docs/generators/mysql-schema.md @@ -0,0 +1,10 @@ + +CONFIG OPTIONS for mysql-schema + + defaultDatabaseName + Default database name for all MySQL queries (Default: ) + + jsonDataTypeEnabled + Use special JSON MySQL data type for complex model properties. Requires MySQL version 5.7.8. Generates TEXT data type when disabled (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/nodejs-server.md b/docs/generators/nodejs-server.md new file mode 100644 index 00000000000..c7a2ce24d44 --- /dev/null +++ b/docs/generators/nodejs-server.md @@ -0,0 +1,25 @@ + +CONFIG OPTIONS for nodejs-server + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + googleCloudFunctions + When specified, it will generate the code which runs within Google Cloud Functions instead of standalone Node.JS server. See https://cloud.google.com/functions/docs/quickstart for the details of how to deploy the generated code. (Default: false) + + exportedName + When the generated code will be deployed to Google Cloud Functions, this option can be used to update the name of the exported function. By default, it refers to the basePath. This does not affect normal standalone nodejs server code. + + serverPort + TCP port to listen on. + +Back to the [generators list](README.md) diff --git a/docs/generators/objc.md b/docs/generators/objc.md new file mode 100644 index 00000000000..4ef100c93cb --- /dev/null +++ b/docs/generators/objc.md @@ -0,0 +1,28 @@ + +CONFIG OPTIONS for objc + + coreData + Should generate core data models (Default: false) + + classPrefix + prefix for generated classes (convention: Abbreviation of pod name e.g. `HN` for `HackerNews`).` (Default: OAI) + + podName + cocoapods package name (convention: CameCase). (Default: OpenAPIClient) + + podVersion + cocoapods package version. (Default: 1.0.0) + + authorName + Name to use in the podspec file. (Default: OpenAPI) + + authorEmail + Email to use in the podspec file. (Default: team@openapitools.org) + + gitRepoURL + URL for the git repo where this podspec should point to. (Default: https://github.com/openapitools/openapi-generator) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/openapi-yaml.md b/docs/generators/openapi-yaml.md new file mode 100644 index 00000000000..1bdbb8771f8 --- /dev/null +++ b/docs/generators/openapi-yaml.md @@ -0,0 +1,19 @@ + +CONFIG OPTIONS for openapi-yaml + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + outputFile + output filename + +Back to the [generators list](README.md) diff --git a/docs/generators/openapi.md b/docs/generators/openapi.md new file mode 100644 index 00000000000..8e8bb15a425 --- /dev/null +++ b/docs/generators/openapi.md @@ -0,0 +1,16 @@ + +CONFIG OPTIONS for openapi + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/perl.md b/docs/generators/perl.md new file mode 100644 index 00000000000..75beaed1d1f --- /dev/null +++ b/docs/generators/perl.md @@ -0,0 +1,22 @@ + +CONFIG OPTIONS for perl + + moduleName + Perl module name (convention: CamelCase or Long::Module). (Default: OpenAPIClient) + + moduleVersion + Perl module version. (Default: 1.0.0) + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/php-laravel.md b/docs/generators/php-laravel.md new file mode 100644 index 00000000000..7a4ae180b58 --- /dev/null +++ b/docs/generators/php-laravel.md @@ -0,0 +1,43 @@ + +CONFIG OPTIONS for php-laravel + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + variableNamingConvention + naming convention of variable name, e.g. camelCase. (Default: snake_case) + + invokerPackage + The main namespace to use for all classes. e.g. Yay\Pets + + packageName + The main package name for classes. e.g. GeneratedPetstore + + srcBasePath + The directory to serve as source root. + + gitUserId + Git user ID, e.g. openapitools. + + gitRepoId + Git repo ID, e.g. openapi-generator. + + artifactVersion + The version to use in the composer package version field. e.g. 1.2.3 + +Back to the [generators list](README.md) diff --git a/docs/generators/php-lumen.md b/docs/generators/php-lumen.md new file mode 100644 index 00000000000..10d0a3af209 --- /dev/null +++ b/docs/generators/php-lumen.md @@ -0,0 +1,43 @@ + +CONFIG OPTIONS for php-lumen + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + variableNamingConvention + naming convention of variable name, e.g. camelCase. (Default: snake_case) + + invokerPackage + The main namespace to use for all classes. e.g. Yay\Pets + + packageName + The main package name for classes. e.g. GeneratedPetstore + + srcBasePath + The directory to serve as source root. + + gitUserId + Git user ID, e.g. openapitools. + + gitRepoId + Git repo ID, e.g. openapi-generator. + + artifactVersion + The version to use in the composer package version field. e.g. 1.2.3 + +Back to the [generators list](README.md) diff --git a/docs/generators/php-silex.md b/docs/generators/php-silex.md new file mode 100644 index 00000000000..c7c8705b294 --- /dev/null +++ b/docs/generators/php-silex.md @@ -0,0 +1,16 @@ + +CONFIG OPTIONS for php-silex + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/php-slim.md b/docs/generators/php-slim.md new file mode 100644 index 00000000000..629056bb928 --- /dev/null +++ b/docs/generators/php-slim.md @@ -0,0 +1,46 @@ + +CONFIG OPTIONS for php-slim + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + variableNamingConvention + naming convention of variable name, e.g. camelCase. (Default: camelCase) + + invokerPackage + The main namespace to use for all classes. e.g. Yay\Pets + + packageName + The main package name for classes. e.g. GeneratedPetstore + + srcBasePath + The directory to serve as source root. + + gitUserId + Git user ID, e.g. openapitools. + + gitRepoId + Git repo ID, e.g. openapi-generator. + + artifactVersion + The version to use in the composer package version field. e.g. 1.2.3 + + phpcsStandard + PHP CodeSniffer option. Accepts name or path of the coding standard to use. (Default: PSR12) + +Back to the [generators list](README.md) diff --git a/docs/generators/php-symfony.md b/docs/generators/php-symfony.md new file mode 100644 index 00000000000..f85157e9c15 --- /dev/null +++ b/docs/generators/php-symfony.md @@ -0,0 +1,58 @@ + +CONFIG OPTIONS for php-symfony + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + variableNamingConvention + naming convention of variable name, e.g. camelCase. (Default: snake_case) + + invokerPackage + The main namespace to use for all classes. e.g. Yay\Pets + + packageName + The main package name for classes. e.g. GeneratedPetstore + + srcBasePath + The directory to serve as source root. + + gitUserId + Git user ID, e.g. openapitools. + + gitRepoId + Git repo ID, e.g. openapi-generator. + + artifactVersion + The version to use in the composer package version field. e.g. 1.2.3 + + composerVendorName + The vendor name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. yaypets + + bundleName + The name of the Symfony bundle. The template uses {{bundleName}} + + composerProjectName + The project name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. petstore-client + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + + phpLegacySupport + Should the generated code be compatible with PHP 5.x? (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/php-ze-ph.md b/docs/generators/php-ze-ph.md new file mode 100644 index 00000000000..c920817d2aa --- /dev/null +++ b/docs/generators/php-ze-ph.md @@ -0,0 +1,43 @@ + +CONFIG OPTIONS for php-ze-ph + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + variableNamingConvention + naming convention of variable name, e.g. camelCase. (Default: snake_case) + + invokerPackage + The main namespace to use for all classes. e.g. Yay\Pets + + packageName + The main package name for classes. e.g. GeneratedPetstore + + srcBasePath + The directory to serve as source root. + + gitUserId + Git user ID, e.g. openapitools. + + gitRepoId + Git repo ID, e.g. openapi-generator. + + artifactVersion + The version to use in the composer package version field. e.g. 1.2.3 + +Back to the [generators list](README.md) diff --git a/docs/generators/php.md b/docs/generators/php.md new file mode 100644 index 00000000000..8604127fd83 --- /dev/null +++ b/docs/generators/php.md @@ -0,0 +1,52 @@ + +CONFIG OPTIONS for php + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + variableNamingConvention + naming convention of variable name, e.g. camelCase. (Default: snake_case) + + invokerPackage + The main namespace to use for all classes. e.g. Yay\Pets + + packageName + The main package name for classes. e.g. GeneratedPetstore + + srcBasePath + The directory to serve as source root. + + gitUserId + Git user ID, e.g. openapitools. + + gitRepoId + Git repo ID, e.g. openapi-generator. + + artifactVersion + The version to use in the composer package version field. e.g. 1.2.3 + + composerVendorName + The vendor name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. yaypets. IMPORTANT NOTE (2016/03): composerVendorName will be deprecated and replaced by gitUserId in the next openapi-generator release + + composerProjectName + The project name used in the composer package name. The template uses {{composerVendorName}}/{{composerProjectName}} for the composer package name. e.g. petstore-client. IMPORTANT NOTE (2016/03): composerProjectName will be deprecated and replaced by gitRepoId in the next openapi-generator release + + hideGenerationTimestamp + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/powershell.md b/docs/generators/powershell.md new file mode 100644 index 00000000000..8fdc4171cc6 --- /dev/null +++ b/docs/generators/powershell.md @@ -0,0 +1,13 @@ + +CONFIG OPTIONS for powershell + + packageName + Client package name (e.g. org.openapitools.client). (Default: Org.OpenAPITools) + + packageGuid + GUID for PowerShell module (e.g. a27b908d-2a20-467f-bc32-af6f3a654ac5). A random GUID will be generated by default. + + csharpClientPath + Path to the C# API client generated by OpenAPI Generator, e.g. $ScriptDir\..\csharp\OpenAPIClient where $ScriptDir is the current directory. NOTE: you will need to generate the C# API client separately. (Default: $ScriptDir\csharp\OpenAPIClient) + +Back to the [generators list](README.md) diff --git a/docs/generators/python-flask.md b/docs/generators/python-flask.md new file mode 100644 index 00000000000..113916f815e --- /dev/null +++ b/docs/generators/python-flask.md @@ -0,0 +1,34 @@ + +CONFIG OPTIONS for python-flask + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + packageName + python package name (convention: snake_case). (Default: openapi_server) + + packageVersion + python package version. (Default: 1.0.0) + + controllerPackage + controller package (Default: controllers) + + defaultController + default controller (Default: default_controller) + + supportPython2 + support python2 (Default: false) + + serverPort + TCP port to listen to in app.run (Default: 8080) + +Back to the [generators list](README.md) diff --git a/docs/generators/python.md b/docs/generators/python.md new file mode 100644 index 00000000000..7eebca2137d --- /dev/null +++ b/docs/generators/python.md @@ -0,0 +1,28 @@ + +CONFIG OPTIONS for python + + packageName + python package name (convention: snake_case). (Default: openapi_client) + + projectName + python project name in setup.py (e.g. petstore-api). + + packageVersion + python package version. (Default: 1.0.0) + + packageUrl + python package URL. + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + + generateSourceCodeOnly + Specifies that only a library source code is to be generated. (Default: false) + + library + library template (sub-template) to use: asyncio, tornado, urllib3 (Default: urllib3) + +Back to the [generators list](README.md) diff --git a/docs/generators/r.md b/docs/generators/r.md new file mode 100644 index 00000000000..8253566f41f --- /dev/null +++ b/docs/generators/r.md @@ -0,0 +1,13 @@ + +CONFIG OPTIONS for r + + packageName + R package name (convention: lowercase). (Default: openapi) + + packageVersion + R package version. (Default: 1.0.0) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/ruby-on-rails.md b/docs/generators/ruby-on-rails.md new file mode 100644 index 00000000000..b32fc0a017e --- /dev/null +++ b/docs/generators/ruby-on-rails.md @@ -0,0 +1,7 @@ + +CONFIG OPTIONS for ruby-on-rails + + databaseAdapter + The adapter for database (e.g. mysql, sqlite). Default: sqlite (Default: sqlite) + +Back to the [generators list](README.md) diff --git a/docs/generators/ruby-sinatra.md b/docs/generators/ruby-sinatra.md new file mode 100644 index 00000000000..9603ad75618 --- /dev/null +++ b/docs/generators/ruby-sinatra.md @@ -0,0 +1,4 @@ + +CONFIG OPTIONS for ruby-sinatra + +Back to the [generators list](README.md) diff --git a/docs/generators/ruby.md b/docs/generators/ruby.md new file mode 100644 index 00000000000..97719919a72 --- /dev/null +++ b/docs/generators/ruby.md @@ -0,0 +1,49 @@ + +CONFIG OPTIONS for ruby + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + gemName + gem name (convention: underscore_case). (Default: openapi_client) + + moduleName + top module name (convention: CamelCase, usually corresponding to gem name). (Default: OpenAPIClient) + + gemVersion + gem version. (Default: 1.0.0) + + gemLicense + gem license. (Default: proprietary) + + gemRequiredRubyVersion + gem required Ruby version. (Default: >= 1.9) + + gemHomepage + gem homepage. (Default: http://org.openapitools) + + gemSummary + gem summary. (Default: A ruby wrapper for the REST APIs) + + gemDescription + gem description. (Default: This gem maps to a REST API) + + gemAuthor + gem author (only one is supported). + + gemAuthorEmail + gem author email (only one is supported). + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/rust-server.md b/docs/generators/rust-server.md new file mode 100644 index 00000000000..7e7b340a990 --- /dev/null +++ b/docs/generators/rust-server.md @@ -0,0 +1,10 @@ + +CONFIG OPTIONS for rust-server + + packageName + Rust crate name (convention: snake_case). (Default: swagger_client) + + packageVersion + Rust crate version. (Default: 1.0.0) + +Back to the [generators list](README.md) diff --git a/docs/generators/rust.md b/docs/generators/rust.md new file mode 100644 index 00000000000..c8779939a30 --- /dev/null +++ b/docs/generators/rust.md @@ -0,0 +1,13 @@ + +CONFIG OPTIONS for rust + + packageName + Rust package name (convention: lowercase). (Default: openapi) + + packageVersion + Rust package version. (Default: 1.0.0) + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/scala-akka.md b/docs/generators/scala-akka.md new file mode 100644 index 00000000000..4c53a0dbcb7 --- /dev/null +++ b/docs/generators/scala-akka.md @@ -0,0 +1,28 @@ + +CONFIG OPTIONS for scala-akka + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + sourceFolder + source folder for generated code + + mainPackage + Top-level package name, which defines 'apiPackage', 'modelPackage', 'invokerPackage' (Default: org.openapitools.client) + +Back to the [generators list](README.md) diff --git a/docs/generators/scala-finch.md b/docs/generators/scala-finch.md new file mode 100644 index 00000000000..a6f40be09f3 --- /dev/null +++ b/docs/generators/scala-finch.md @@ -0,0 +1,13 @@ + +CONFIG OPTIONS for scala-finch + + packageName + Finch package name (e.g. org.openapitools). (Default: org.openapitools) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + +Back to the [generators list](README.md) diff --git a/docs/generators/scala-gatling.md b/docs/generators/scala-gatling.md new file mode 100644 index 00000000000..e12674ccd2c --- /dev/null +++ b/docs/generators/scala-gatling.md @@ -0,0 +1,25 @@ + +CONFIG OPTIONS for scala-gatling + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + sourceFolder + source folder for generated code + +Back to the [generators list](README.md) diff --git a/docs/generators/scala-httpclient.md b/docs/generators/scala-httpclient.md new file mode 100644 index 00000000000..a21cee7caa3 --- /dev/null +++ b/docs/generators/scala-httpclient.md @@ -0,0 +1,28 @@ + +CONFIG OPTIONS for scala-httpclient + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + sourceFolder + source folder for generated code + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + +Back to the [generators list](README.md) diff --git a/docs/generators/scala-lagom-server.md b/docs/generators/scala-lagom-server.md new file mode 100644 index 00000000000..3c9beeb4961 --- /dev/null +++ b/docs/generators/scala-lagom-server.md @@ -0,0 +1,28 @@ + +CONFIG OPTIONS for scala-lagom-server + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + sourceFolder + source folder for generated code + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + +Back to the [generators list](README.md) diff --git a/docs/generators/scalatra.md b/docs/generators/scalatra.md new file mode 100644 index 00000000000..b512627bfce --- /dev/null +++ b/docs/generators/scalatra.md @@ -0,0 +1,25 @@ + +CONFIG OPTIONS for scalatra + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + sourceFolder + source folder for generated code + +Back to the [generators list](README.md) diff --git a/docs/generators/scalaz.md b/docs/generators/scalaz.md new file mode 100644 index 00000000000..eec98a7a7c5 --- /dev/null +++ b/docs/generators/scalaz.md @@ -0,0 +1,28 @@ + +CONFIG OPTIONS for scalaz + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + sourceFolder + source folder for generated code + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + +Back to the [generators list](README.md) diff --git a/docs/generators/spring.md b/docs/generators/spring.md new file mode 100644 index 00000000000..ab0e1ad15a6 --- /dev/null +++ b/docs/generators/spring.md @@ -0,0 +1,173 @@ + +CONFIG OPTIONS for spring + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPackage + package for generated models + + apiPackage + package for generated api classes + + invokerPackage + root package for generated code + + groupId + groupId in generated pom.xml + + artifactId + artifactId in generated pom.xml + + artifactVersion + artifact version in generated pom.xml + + artifactUrl + artifact URL in generated pom.xml + + artifactDescription + artifact description in generated pom.xml + + scmConnection + SCM connection in generated pom.xml + + scmDeveloperConnection + SCM developer connection in generated pom.xml + + scmUrl + SCM URL in generated pom.xml + + developerName + developer name in generated pom.xml + + developerEmail + developer email in generated pom.xml + + developerOrganization + developer organization in generated pom.xml + + developerOrganizationUrl + developer organization URL in generated pom.xml + + licenseName + The name of the license + + licenseUrl + The URL of the license + + sourceFolder + source folder for generated code + + localVariablePrefix + prefix for generated code members and local variables + + serializableModel + boolean - toggle "implements Serializable" for generated models (Default: false) + + bigDecimalAsString + Treat BigDecimal values as Strings to avoid precision loss. (Default: false) + + fullJavaUtil + whether to use fully qualified name for classes under java.util. This option only works for Java API client (Default: false) + + hideGenerationTimestamp + hides the timestamp when files were generated + + withXml + whether to include support for application/xml content type and include XML annotations in the model (works with libraries that provide support for JSON and XML) (Default: false) + + dateLibrary + Option. Date library to use + joda - Joda (for legacy app only) + legacy - Legacy java.util.Date (if you really have a good reason not to use threetenbp + java8-localdatetime - Java 8 using LocalDateTime (for legacy app only) + java8 - Java 8 native JSR310 (preferred for jdk 1.8+) - note: this also sets "java8" to true + threetenbp - Backport of JSR310 (preferred for jdk < 1.8) + + 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 + + disableHtmlEscaping + Disable HTML escaping of JSON strings when using gson (needed to avoid problems with byte[] fields) (Default: false) + + booleanGetterPrefix + Set booleanGetterPrefix (default value 'get') + + parentGroupId + parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentArtifactId + parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + parentVersion + parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect + + title + server title name or client service name + + configPackage + configuration package for generated code + + basePackage + base package (invokerPackage) for generated code + + interfaceOnly + Whether to generate only API interface stubs without the server files. (Default: false) + + delegatePattern + Whether to generate the server files using the delegate pattern (Default: false) + + singleContentTypes + Whether to select only one produces/consumes content-type by operation. (Default: false) + + java8 + use java8 default interface (Default: true) + + async + use async Callable controllers (Default: false) + + reactive + wrap responses in Mono/Flux Reactor types (spring-boot only) (Default: false) + + responseWrapper + wrap the responses in given type (Future,Callable,CompletableFuture,ListenableFuture,DeferredResult,HystrixCommand,RxObservable,RxSingle or fully qualified type) + + virtualService + Generates the virtual service. For more details refer - https://github.com/elan-venture/virtualan/wiki (Default: false) + + useTags + use tags for creating interface and controller classnames (Default: false) + + useBeanValidation + Use BeanValidation API annotations (Default: true) + + implicitHeaders + Use of @ApiImplicitParams for headers. (Default: false) + + swaggerDocketConfig + Generate Spring OpenAPI Docket configuration class. (Default: false) + + apiFirst + Generate the API from the OAI spec at server compile time (API first approach) (Default: false) + + useOptional + Use Optional container for optional parameters (Default: false) + + library + library template (sub-template) to use (Default: spring-boot) + spring-boot - Spring-boot Server application using the SpringFox integration. + spring-mvc - Spring-MVC Server application using the SpringFox integration. + spring-cloud - Spring-Cloud-Feign client with Spring-Boot auto-configured settings. + +Back to the [generators list](README.md) diff --git a/docs/generators/swift2-deprecated.md b/docs/generators/swift2-deprecated.md new file mode 100644 index 00000000000..630a0e1a2e0 --- /dev/null +++ b/docs/generators/swift2-deprecated.md @@ -0,0 +1,64 @@ + +CONFIG OPTIONS for swift2-deprecated + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + projectName + Project name in Xcode + + responseAs + Optionally use libraries to manage response. Currently PromiseKit, RxSwift are available. + + 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 + + podSource + Source information used for Podspec + + podVersion + Version used for Podspec + + podAuthors + Authors used for Podspec + + podSocialMediaURL + Social Media URL used for Podspec + + podDocsetURL + Docset URL used for Podspec + + podLicense + License used for Podspec + + podHomepage + Homepage used for Podspec + + podSummary + Summary used for Podspec + + podDescription + Description used for Podspec + + podScreenshots + Screenshots used for Podspec + + podDocumentationURL + Documentation URL used for Podspec + + swiftUseApiNamespace + Flag to make all the API classes inner-class of {{projectName}}API + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + +Back to the [generators list](README.md) diff --git a/docs/generators/swift3.md b/docs/generators/swift3.md new file mode 100644 index 00000000000..42674fdb262 --- /dev/null +++ b/docs/generators/swift3.md @@ -0,0 +1,70 @@ + +CONFIG OPTIONS for swift3 + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + projectName + Project name in Xcode + + responseAs + Optionally use libraries to manage response. Currently PromiseKit, RxSwift are available. + + 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 + + objcCompatible + Add additional properties and methods for Objective-C compatibility (default: false) + + podSource + Source information used for Podspec + + podVersion + Version used for Podspec + + podAuthors + Authors used for Podspec + + podSocialMediaURL + Social Media URL used for Podspec + + podDocsetURL + Docset URL used for Podspec + + podLicense + License used for Podspec + + podHomepage + Homepage used for Podspec + + podSummary + Summary used for Podspec + + podDescription + Description used for Podspec + + podScreenshots + Screenshots used for Podspec + + podDocumentationURL + Documentation URL used for Podspec + + swiftUseApiNamespace + Flag to make all the API classes inner-class of {{projectName}}API + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + + lenientTypeCast + Accept and cast values for simple types (string->bool, string->int, int->string) (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/swift4.md b/docs/generators/swift4.md new file mode 100644 index 00000000000..6e824970759 --- /dev/null +++ b/docs/generators/swift4.md @@ -0,0 +1,70 @@ + +CONFIG OPTIONS for swift4 + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + projectName + Project name in Xcode + + responseAs + Optionally use libraries to manage response. Currently PromiseKit, RxSwift are available. + + 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 + + objcCompatible + Add additional properties and methods for Objective-C compatibility (default: false) + + podSource + Source information used for Podspec + + podVersion + Version used for Podspec + + podAuthors + Authors used for Podspec + + podSocialMediaURL + Social Media URL used for Podspec + + podDocsetURL + Docset URL used for Podspec + + podLicense + License used for Podspec + + podHomepage + Homepage used for Podspec + + podSummary + Summary used for Podspec + + podDescription + Description used for Podspec + + podScreenshots + Screenshots used for Podspec + + podDocumentationURL + Documentation URL used for Podspec + + swiftUseApiNamespace + Flag to make all the API classes inner-class of {{projectName}}API + + hideGenerationTimestamp + Hides the generation timestamp when files are generated. (Default: true) + + lenientTypeCast + Accept and cast values for simple types (string->bool, string->int, int->string) (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/typescript-angular.md b/docs/generators/typescript-angular.md new file mode 100644 index 00000000000..e459084760d --- /dev/null +++ b/docs/generators/typescript-angular.md @@ -0,0 +1,61 @@ + +CONFIG OPTIONS for typescript-angular + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + + supportsES6 + Generate code that conforms to ES6. (Default: false) + + npmName + The name under which you want to publish generated npm package. Required to generate a full angular package + + npmVersion + The version of your npm package. Default is '1.0.0' + + npmRepository + Use this property to set an url your private npmRepo in the package.json + + snapshot + When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm (Default: false) + + withInterfaces + Setting this property to true will generate interfaces next to the default class implementations. (Default: false) + + taggedUnions + Use discriminators to create tagged unions instead of extending interfaces. (Default: false) + + providedInRoot + Use this property to provide Injectables in root (it is only valid in angular version greater or equal to 6.0.0). (Default: false) + + ngVersion + The version of Angular. Default is '4.3' + + serviceSuffix + The suffix of the generated service. Default is 'Service'. + + serviceFileSuffix + The suffix of the file of the generated service (service.ts). Default is '.service'. + + modelSuffix + The suffix of the generated model. Default is ''. + + modelFileSuffix + The suffix of the file of the generated model (model.ts). Default is ''. + + fileNaming + Naming convention for the output files: 'camelCase', 'kebab-case'. Default is 'camelCase'. + +Back to the [generators list](README.md) diff --git a/docs/generators/typescript-angularjs.md b/docs/generators/typescript-angularjs.md new file mode 100644 index 00000000000..7f8fd7720c0 --- /dev/null +++ b/docs/generators/typescript-angularjs.md @@ -0,0 +1,22 @@ + +CONFIG OPTIONS for typescript-angularjs + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + + supportsES6 + Generate code that conforms to ES6. (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/typescript-aurelia.md b/docs/generators/typescript-aurelia.md new file mode 100644 index 00000000000..dd9c7f14e2f --- /dev/null +++ b/docs/generators/typescript-aurelia.md @@ -0,0 +1,28 @@ + +CONFIG OPTIONS for typescript-aurelia + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + + supportsES6 + Generate code that conforms to ES6. (Default: false) + + npmName + The name under which you want to publish generated npm package + + npmVersion + The version of your npm package + +Back to the [generators list](README.md) diff --git a/docs/generators/typescript-axios.md b/docs/generators/typescript-axios.md new file mode 100644 index 00000000000..654858710c4 --- /dev/null +++ b/docs/generators/typescript-axios.md @@ -0,0 +1,37 @@ + +CONFIG OPTIONS for typescript-axios + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + + supportsES6 + Generate code that conforms to ES6. (Default: false) + + npmName + The name under which you want to publish generated npm package + + npmVersion + The version of your npm package + + npmRepository + Use this property to set an url your private npmRepo in the package.json + + snapshot + When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm (Default: false) + + withInterfaces + Setting this property to true will generate interfaces next to the default class implementations. (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/typescript-fetch.md b/docs/generators/typescript-fetch.md new file mode 100644 index 00000000000..97633d03ebf --- /dev/null +++ b/docs/generators/typescript-fetch.md @@ -0,0 +1,37 @@ + +CONFIG OPTIONS for typescript-fetch + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + + supportsES6 + Generate code that conforms to ES6. (Default: false) + + npmName + The name under which you want to publish generated npm package + + npmVersion + The version of your npm package + + npmRepository + Use this property to set an url your private npmRepo in the package.json + + snapshot + When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm (Default: false) + + withInterfaces + Setting this property to true will generate interfaces next to the default class implementations. (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/typescript-inversify.md b/docs/generators/typescript-inversify.md new file mode 100644 index 00000000000..9354cd8b4a6 --- /dev/null +++ b/docs/generators/typescript-inversify.md @@ -0,0 +1,43 @@ + +CONFIG OPTIONS for typescript-inversify + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + + supportsES6 + Generate code that conforms to ES6. (Default: false) + + npmName + The name under which you want to publish generated npm package + + npmVersion + The version of your npm package + + npmRepository + Use this property to set an url your private npmRepo in the package.json + + snapshot + When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm (Default: false) + + withInterfaces + Setting this property to true will generate interfaces next to the default class implementations. (Default: false) + + usePromise + Setting this property to use promise instead of observable inside every service. (Default: false) + + taggedUnions + Use discriminators to create tagged unions instead of extending interfaces. (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/typescript-jquery.md b/docs/generators/typescript-jquery.md new file mode 100644 index 00000000000..eeef27289c0 --- /dev/null +++ b/docs/generators/typescript-jquery.md @@ -0,0 +1,37 @@ + +CONFIG OPTIONS for typescript-jquery + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + + supportsES6 + Generate code that conforms to ES6. (Default: false) + + npmName + The name under which you want to publish generated npm package + + npmVersion + The version of your npm package + + npmRepository + Use this property to set an url your private npmRepo in the package.json + + snapshot + When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm (Default: false) + + jqueryAlreadyImported + When using this in legacy app using mix of typescript and javascript, this will only declare jquery and not import it (Default: false) + +Back to the [generators list](README.md) diff --git a/docs/generators/typescript-node.md b/docs/generators/typescript-node.md new file mode 100644 index 00000000000..008dae08c09 --- /dev/null +++ b/docs/generators/typescript-node.md @@ -0,0 +1,34 @@ + +CONFIG OPTIONS for typescript-node + + sortParamsByRequiredFlag + Sort method arguments to place required parameters before optional parameters. (Default: true) + + ensureUniqueParams + Whether to ensure parameter names are unique in an operation (rename parameters that are not). (Default: true) + + allowUnicodeIdentifiers + boolean, toggles whether unicode identifiers are allowed in names or not, default is false (Default: false) + + prependFormOrBodyParameters + Add form or body parameters to the beginning of the parameter list. (Default: false) + + modelPropertyNaming + Naming convention for the property: 'camelCase', 'PascalCase', 'snake_case' and 'original', which keeps the original name (Default: camelCase) + + supportsES6 + Generate code that conforms to ES6. (Default: false) + + npmName + The name under which you want to publish generated npm package + + npmVersion + The version of your npm package + + npmRepository + Use this property to set an url your private npmRepo in the package.json + + snapshot + When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm (Default: false) + +Back to the [generators list](README.md) diff --git a/modules/openapi-generator-cli/pom.xml b/modules/openapi-generator-cli/pom.xml index aff5c6e3e80..9facdbe9f21 100644 --- a/modules/openapi-generator-cli/pom.xml +++ b/modules/openapi-generator-cli/pom.xml @@ -38,7 +38,7 @@ org.apache.maven.plugins maven-shade-plugin - 2.3 + 3.2.0 process-resources @@ -98,7 +98,7 @@ ch.qos.logback logback-classic - 1.0.13 + 1.2.3 org.testng diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ConfigHelp.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ConfigHelp.java index b6c4f9b89bc..4a5cb6bb62d 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ConfigHelp.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ConfigHelp.java @@ -26,6 +26,9 @@ import org.openapitools.codegen.GeneratorNotFoundException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.*; +import java.nio.charset.StandardCharsets; + import static org.apache.commons.lang3.StringUtils.isEmpty; import static org.apache.commons.lang3.StringUtils.isNotEmpty; @@ -42,6 +45,16 @@ public class ConfigHelp implements Runnable { description = "generator to get config help for") private String generatorName; + @Option(name = {"--named-header"}, title = "named header", + description = "Header includes the generator name, for clarity in output") + private Boolean namedHeader; + + @Option(name = {"-o", "--output"}, title = "output location", + description = "Optionally write help to this location, otherwise default is standard output") + private String outputFile; + + private String newline = System.lineSeparator(); + @Override public void run() { @@ -57,19 +70,47 @@ public class ConfigHelp implements Runnable { } try { + StringBuilder sb = new StringBuilder(); CodegenConfig config = CodegenConfigLoader.forName(generatorName); - System.out.println(); - System.out.println("CONFIG OPTIONS"); - for (CliOption langCliOption : config.cliOptions()) { - System.out.println("\t" + langCliOption.getOpt()); - System.out.println("\t " - + langCliOption.getOptionHelp().replaceAll("\n", System.lineSeparator() + "\t ")); - System.out.println(); + + generatePlainTextHelp(sb, config); + + if (!isEmpty(outputFile)) { + File out = new File(outputFile); + //noinspection ResultOfMethodCallIgnored + out.mkdirs(); + + Writer writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(out), StandardCharsets.UTF_8)); + + writer.write(sb.toString()); + writer.close(); + } else { + System.out.print(sb.toString()); } } catch (GeneratorNotFoundException e) { System.err.println(e.getMessage()); System.err.println("[error] Check the spelling of the generator's name and try again."); System.exit(1); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void generatePlainTextHelp(StringBuilder sb, CodegenConfig config) { + sb.append(newline); + sb.append("CONFIG OPTIONS"); + if (Boolean.TRUE.equals(namedHeader)) { + sb.append(" for ").append(generatorName).append(newline); + } + + sb.append(newline); + + for (CliOption langCliOption : config.cliOptions()) { + sb.append("\t").append(langCliOption.getOpt()); + sb.append(newline); + sb.append("\t ").append(langCliOption.getOptionHelp().replaceAll("\n", System.lineSeparator() + "\t ")); + sb.append(newline); + sb.append(newline); } } } diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java index ae3613c41a9..a19dcf06c9e 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Generate.java @@ -208,6 +208,9 @@ public class Generate implements Runnable { + " Useful for piping the JSON output of debug options (e.g. `-DdebugOperations`) to an external parser directly while testing a generator.") private Boolean logToStderr; + @Option(name = {"--enable-post-process-file"}, title = "enable post-process file", description = CodegenConstants.ENABLE_POST_PROCESS_FILE) + private Boolean enablePostProcessFile; + @Override public void run() { if (logToStderr != null) { @@ -329,6 +332,10 @@ public class Generate implements Runnable { configurator.setRemoveOperationIdPrefix(removeOperationIdPrefix); } + if (enablePostProcessFile != null) { + configurator.setEnablePostProcessFile(enablePostProcessFile); + } + applySystemPropertiesKvpList(systemProperties, configurator); applyInstantiationTypesKvpList(instantiationTypes, configurator); applyImportMappingsKvpList(importMappings, configurator); diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ListGenerators.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ListGenerators.java index edd85ff79af..83a3ada42c9 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ListGenerators.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/ListGenerators.java @@ -1,7 +1,10 @@ package org.openapitools.codegen.cmd; +import com.google.common.base.Objects; + import io.airlift.airline.Command; import io.airlift.airline.Option; + import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenConfigLoader; import org.openapitools.codegen.CodegenType; @@ -10,6 +13,7 @@ import java.util.Arrays; import java.util.Comparator; import java.util.List; import java.util.Locale; +import java.util.stream.Collectors; // NOTE: List can later have subcommands such as list languages, list types, list frameworks, etc. @Command(name = "list", description = "Lists the available generators") @@ -41,19 +45,29 @@ public class ListGenerators implements Runnable { sb.append(System.lineSeparator()); for (CodegenType type : types) { - sb.append(type.name()).append(" generators:"); - sb.append(System.lineSeparator()); - - generators.stream() - .filter(g -> g.getTag().equals(type)) - .sorted(Comparator.comparing(CodegenConfig::getName)) - .forEach(generator -> sb.append(" - ").append(generator.getName()).append(System.lineSeparator())); - - sb.append(System.lineSeparator()); - sb.append(System.lineSeparator()); + appendForType(sb, type, type.name(), generators); } + appendForType(sb, null, "UNSPECIFIED", generators); } - System.out.printf(Locale.ROOT,"%s%n", sb.toString()); + System.out.printf(Locale.ROOT, "%s%n", sb.toString()); + } + + private void appendForType(StringBuilder sb, CodegenType type, String typeName, List generators) { + List list = generators.stream() + .filter(g -> Objects.equal(type, g.getTag())) + .sorted(Comparator.comparing(CodegenConfig::getName)) + .collect(Collectors.toList()); + + if(list.size() > 0) { + sb.append(typeName).append(" generators:"); + sb.append(System.lineSeparator()); + + list.stream() + .forEach(generator -> sb.append(" - ").append(generator.getName()).append(System.lineSeparator())); + + sb.append(System.lineSeparator()); + sb.append(System.lineSeparator()); + } } } diff --git a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Meta.java b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Meta.java index 1865550ca91..c373aaa8c70 100644 --- a/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Meta.java +++ b/modules/openapi-generator-cli/src/main/java/org/openapitools/codegen/cmd/Meta.java @@ -67,6 +67,11 @@ public class Meta implements Runnable { description = "the package to put the main class into (defaults to org.openapitools.codegen)") private String targetPackage = "org.openapitools.codegen"; + @Option(name = {"-t", "--type"}, title = "type", + description = "the type of generator that is created", + allowedValues = {"CLIENT", "SERVER", "DOCUMENTATION", "CONFIG", "OTHER"}) + private String type = "OTHER"; + @Override public void run() { final File targetDir = new File(outputFolder); @@ -87,8 +92,11 @@ public class Meta implements Runnable { String currentVersion = Version.readVersionFromResources(); Map data = - new ImmutableMap.Builder().put("generatorPackage", targetPackage) - .put("generatorClass", mainClass).put("name", name) + new ImmutableMap.Builder() + .put("generatorPackage", targetPackage) + .put("generatorClass", mainClass) + .put("name", name) + .put("generatorType", type) .put("fullyQualifiedGeneratorClass", targetPackage + "." + mainClass) .put("openapiGeneratorVersion", currentVersion).build(); diff --git a/modules/openapi-generator-cli/src/main/resources/logback.xml b/modules/openapi-generator-cli/src/main/resources/logback.xml index 91effef2e98..62800526bdd 100644 --- a/modules/openapi-generator-cli/src/main/resources/logback.xml +++ b/modules/openapi-generator-cli/src/main/resources/logback.xml @@ -24,7 +24,7 @@ - + diff --git a/modules/openapi-generator-gradle-plugin/README.adoc b/modules/openapi-generator-gradle-plugin/README.adoc index c1fb0d0b8d2..ebe411abb59 100644 --- a/modules/openapi-generator-gradle-plugin/README.adoc +++ b/modules/openapi-generator-gradle-plugin/README.adoc @@ -48,7 +48,7 @@ buildscript { mavenCentral() } dependencies { - classpath "org.openapitools:openapi-generator-gradle-plugin:3.2.2" + classpath "org.openapitools:openapi-generator-gradle-plugin:3.3.1" } } diff --git a/modules/openapi-generator-gradle-plugin/build.gradle b/modules/openapi-generator-gradle-plugin/build.gradle index c639b67a162..5f09ef12209 100644 --- a/modules/openapi-generator-gradle-plugin/build.gradle +++ b/modules/openapi-generator-gradle-plugin/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.2.41' + ext.kotlin_version = '1.2.60' repositories { mavenCentral() maven { @@ -14,7 +14,7 @@ buildscript { } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "gradle.plugin.org.gradle.kotlin:gradle-kotlin-dsl-plugins:0.17.5" + classpath "gradle.plugin.org.gradle.kotlin:gradle-kotlin-dsl-plugins:1.0-rc-3" } } diff --git a/modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties b/modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties index 16d28051c9c..7e3739c46a5 100644 --- a/modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties +++ b/modules/openapi-generator-gradle-plugin/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/modules/openapi-generator-gradle-plugin/pom.xml b/modules/openapi-generator-gradle-plugin/pom.xml index 76e8f1aa7f1..26d6e55c971 100644 --- a/modules/openapi-generator-gradle-plugin/pom.xml +++ b/modules/openapi-generator-gradle-plugin/pom.xml @@ -15,6 +15,7 @@ true + 4.10.2 @@ -54,7 +55,7 @@ gradle-maven-plugin 1.0.8 - 4.7 + ${gradleVersion} -P openApiGeneratorVersion=${project.version} @@ -76,6 +77,13 @@ + + + org.gradle + gradle-tooling-api + ${gradleVersion} + + 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 13889d521b8..f05264d9b5d 100644 --- a/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/README.md @@ -17,5 +17,5 @@ gradle generateGoWithInvalidSpec The samples can be tested against other versions of the plugin using the `openApiGeneratorVersion` property. For example: ```bash -gradle -PopenApiGeneratorVersion=3.2.2 openApiValidate +gradle -PopenApiGeneratorVersion=3.3.1 openApiValidate ``` diff --git a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties index ed174a94c40..b4627afc3cc 100644 --- a/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties +++ b/modules/openapi-generator-gradle-plugin/samples/local-spec/gradle.properties @@ -1 +1 @@ -openApiGeneratorVersion=3.2.2 +openApiGeneratorVersion=3.3.1 diff --git a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/OpenApiGeneratorPlugin.kt b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/OpenApiGeneratorPlugin.kt index b4a2089c11b..fc40080f515 100644 --- a/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/OpenApiGeneratorPlugin.kt +++ b/modules/openapi-generator-gradle-plugin/src/main/kotlin/org/openapitools/generator/gradle/plugin/OpenApiGeneratorPlugin.kt @@ -18,7 +18,6 @@ package org.openapitools.generator.gradle.plugin import org.gradle.api.Plugin import org.gradle.api.Project -import org.gradle.kotlin.dsl.invoke import org.openapitools.generator.gradle.plugin.extensions.OpenApiGeneratorGenerateExtension import org.openapitools.generator.gradle.plugin.extensions.OpenApiGeneratorMetaExtension import org.openapitools.generator.gradle.plugin.extensions.OpenApiGeneratorValidateExtension @@ -56,12 +55,13 @@ class OpenApiGeneratorPlugin : Plugin { generate.outputDir.set("$buildDir/generate-resources/main") - tasks { - "openApiGenerators"(GeneratorsTask::class) { + tasks.apply { + create("openApiGenerators", GeneratorsTask::class.java) { group = pluginGroup description = "Lists generators available via Open API Generators." } - "openApiMeta"(MetaTask::class) { + + create("openApiMeta", MetaTask::class.java) { group = pluginGroup description = "Generates a new generator to be consumed via Open API Generator." @@ -69,13 +69,15 @@ class OpenApiGeneratorPlugin : Plugin { packageName.set(meta.packageName) outputFolder.set(meta.outputFolder) } - "openApiValidate"(ValidateTask::class) { + + create("openApiValidate", ValidateTask::class.java) { group = pluginGroup description = "Validates an Open API 2.0 or 3.x specification document." inputSpec.set(validate.inputSpec) } - "openApiGenerate"(GenerateTask::class) { + + create("openApiGenerate", GenerateTask::class.java) { group = pluginGroup description = "Generate code via Open API Tools Generator for Open API 2.0 or 3.x specification documents." diff --git a/modules/openapi-generator-maven-plugin/README.md b/modules/openapi-generator-maven-plugin/README.md index 299ebbab346..18055978fc4 100644 --- a/modules/openapi-generator-maven-plugin/README.md +++ b/modules/openapi-generator-maven-plugin/README.md @@ -11,7 +11,7 @@ Add to your `build->plugins` section (default phase is `generate-sources` phase) org.openapitools openapi-generator-maven-plugin - 3.2.2 + 3.3.1 diff --git a/modules/openapi-generator-maven-plugin/examples/java-client.xml b/modules/openapi-generator-maven-plugin/examples/java-client.xml index 05b285d9ce8..878382a5ad6 100644 --- a/modules/openapi-generator-maven-plugin/examples/java-client.xml +++ b/modules/openapi-generator-maven-plugin/examples/java-client.xml @@ -12,7 +12,7 @@ org.openapitools openapi-generator-maven-plugin - 3.2.2 + 3.3.1 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 35e5ce02e4a..fdc8a4bf901 100644 --- a/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml +++ b/modules/openapi-generator-maven-plugin/examples/non-java-invalid-spec.xml @@ -12,7 +12,7 @@ org.openapitools openapi-generator-maven-plugin - 3.2.2 + 3.3.1 diff --git a/modules/openapi-generator-maven-plugin/examples/non-java.xml b/modules/openapi-generator-maven-plugin/examples/non-java.xml index eece8d6efbe..880f2be04d9 100644 --- a/modules/openapi-generator-maven-plugin/examples/non-java.xml +++ b/modules/openapi-generator-maven-plugin/examples/non-java.xml @@ -12,7 +12,7 @@ org.openapitools openapi-generator-maven-plugin - 3.2.2 + 3.3.1 diff --git a/modules/openapi-generator-maven-plugin/pom.xml b/modules/openapi-generator-maven-plugin/pom.xml index 337f2dddee5..87deb4f0594 100644 --- a/modules/openapi-generator-maven-plugin/pom.xml +++ b/modules/openapi-generator-maven-plugin/pom.xml @@ -11,9 +11,6 @@ openapi-generator (maven-plugin) maven-plugin maven plugin to build modules from OpenAPI Generator - - 3.2.5 - UTF-8 @@ -62,7 +59,7 @@ org.apache.maven.plugins maven-plugin-plugin - 3.5.1 + 3.5.2 true diff --git a/modules/openapi-generator-online/pom.xml b/modules/openapi-generator-online/pom.xml index c23f4fa0f8d..132a83e95a1 100644 --- a/modules/openapi-generator-online/pom.xml +++ b/modules/openapi-generator-online/pom.xml @@ -27,6 +27,7 @@ + openapi-generator-online src/main/java diff --git a/modules/openapi-generator/pom.xml b/modules/openapi-generator/pom.xml index 8e72af82bd1..30e56ac2abf 100644 --- a/modules/openapi-generator/pom.xml +++ b/modules/openapi-generator/pom.xml @@ -44,7 +44,7 @@ org.codehaus.mojo exec-maven-plugin - 1.5.0 + 1.6.0 @@ -81,7 +81,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.0.2 + 3.1.0 @@ -103,7 +103,7 @@ org.apache.maven.plugins maven-site-plugin - 3.5.1 + 3.7.1 org.apache.maven.plugins @@ -174,7 +174,7 @@ org.apache.maven.plugins maven-jxr-plugin - 2.5 + 3.0.0 true @@ -182,7 +182,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 2.9 + 3.0.0 @@ -195,7 +195,7 @@ 1.3.0 - 20.0 + 26.0-jre @@ -203,8 +203,8 @@ swagger-core ${swagger-core-version} - - org.openapitools.swagger.parser + + io.swagger.parser.v3 swagger-parser ${swagger-parser-version} @@ -270,12 +270,12 @@ com.atlassian.commonmark commonmark - 0.9.0 + 0.11.0 org.mockito mockito-core - 2.8.47 + 2.23.0 test 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 new file mode 100644 index 00000000000..3dcf7cfbeae --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenCallback.java @@ -0,0 +1,80 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen; + +import java.util.*; + +public class CodegenCallback { + public String name; + public boolean hasMore; + public List urls = new ArrayList<>(); + public Map vendorExtensions = new HashMap<>(); + + public static class Url { + public String expression; + public boolean hasMore; + public List requests = new ArrayList<>(); + public Map vendorExtensions = new HashMap<>(); + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + Url that = (Url) o; + return Objects.equals(that.expression, expression) && Objects.equals(that.hasMore, hasMore) && + Objects.equals(that.requests, requests) && Objects.equals(that.vendorExtensions, vendorExtensions); + } + @Override + public int hashCode() { + return Objects.hash(expression, hasMore, requests, vendorExtensions); + } + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("CodegenCallback.Urls {\n"); + sb.append(" expression: ").append(expression).append("\n"); + requests.forEach(r -> sb.append(" ").append(r).append("\n")); + sb.append("}"); + return sb.toString(); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + + CodegenCallback that = (CodegenCallback) o; + 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(); + sb.append("CodegenCallback {\n"); + sb.append(" name: ").append(name).append("\n"); + urls.forEach(u -> sb.append(" ").append(u).append("\n")); + sb.append("}"); + return sb.toString(); + } +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java index 61b98db1bef..275d12205bc 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConfig.java @@ -26,6 +26,7 @@ import io.swagger.v3.oas.models.security.SecurityScheme; import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.oas.models.servers.ServerVariable; +import java.io.File; import java.util.List; import java.util.Map; import java.util.Set; @@ -254,4 +255,10 @@ public interface CodegenConfig { String sanitizeName(String name); + void postProcessFile(File file, String fileType); + + boolean isEnablePostProcessFile(); + + public void setEnablePostProcessFile(boolean isEnablePostProcessFile); + } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java index d96fda52687..7bcfb843538 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenConstants.java @@ -182,6 +182,7 @@ public class CodegenConstants { public static final String DOTNET_FRAMEWORK_DESC = "The target .NET framework version."; public static enum MODEL_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, original} + public static enum ENUM_PROPERTY_NAMING_TYPE {camelCase, PascalCase, snake_case, original, UPPERCASE} public static final String ENUM_PROPERTY_NAMING = "enumPropertyNaming"; @@ -232,6 +233,9 @@ public class CodegenConstants { public static final String GENERATE_MODELS = "generateModels"; public static final String GENERATE_MODEL_DOCS = "generateModelDocs"; + public static final String VIRTUAL_SERVICE = "virtualService"; + public static final String VIRTUAL_SERVICE_DESC = "Generate Spring boot rest service as virtual service with Virtualan"; + public static final String GENERATE_MODEL_TESTS = "generateModelTests"; public static final String GENERATE_MODEL_TESTS_DESC = "Specifies that model tests are to be generated."; @@ -262,4 +266,16 @@ public class CodegenConstants { public static final String DATABASE_ADAPTER = "databaseAdapter"; public static final String DATABASE_ADAPTER_DESC = "The adapter for database (e.g. mysql, sqlite). Default: sqlite"; -} + public static final String PARENT_GROUP_ID = "parentGroupId"; + public static final String PARENT_GROUP_ID_DESC = "parent groupId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect"; + + public static final String PARENT_ARTIFACT_ID = "parentArtifactId"; + public static final String PARENT_ARTIFACT_ID_DESC = "parent artifactId in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect"; + + public static final String PARENT_VERSION = "parentVersion"; + public static final String PARENT_VERSION_DESC = "parent version in generated pom N.B. parentGroupId, parentArtifactId and parentVersion must all be specified for any of them to take effect"; + + public static final String ENABLE_POST_PROCESS_FILE = "enablePostProcessFile"; + public static final String ENABLE_POST_PROCESS_FILE_DESC = "Enable post-processing file using environment variables."; + +} \ No newline at end of file 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 80ff121c361..8251bb22316 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 @@ -28,6 +28,9 @@ import java.util.Objects; import java.util.Set; import java.util.TreeSet; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +@JsonIgnoreProperties({"parentModel", "interfaceModels"}) public class CodegenModel { public String parent, parentSchema; public List interfaces; 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 1e66e45edef..acc15ba3212 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 @@ -36,7 +36,7 @@ public class CodegenOperation { isListContainer, isMultipart, hasMore = true, isResponseBinary = false, isResponseFile = false, hasReference = false, isRestfulIndex, isRestfulShow, isRestfulCreate, isRestfulUpdate, isRestfulDestroy, - isRestful, isDeprecated; + isRestful, isDeprecated, isCallbackRequest; public String path, operationId, returnType, httpMethod, returnBaseType, returnContainer, summary, unescapedNotes, notes, baseName, defaultResponse; public CodegenDiscriminator discriminator; @@ -54,6 +54,7 @@ public class CodegenOperation { public List authMethods; public List tags; public List responses = new ArrayList(); + public List callbacks = new ArrayList<>(); public Set imports = new HashSet(); public List> examples; public List> requestBodyExamples; @@ -293,6 +294,8 @@ public class CodegenOperation { return false; if (isDeprecated != that.isDeprecated) return false; + if (isCallbackRequest != that.isCallbackRequest) + return false; if (path != null ? !path.equals(that.path) : that.path != null) return false; if (operationId != null ? !operationId.equals(that.operationId) : that.operationId != null) @@ -347,6 +350,8 @@ public class CodegenOperation { return false; if (responses != null ? !responses.equals(that.responses) : that.responses != null) return false; + if (callbacks != null ? !callbacks.equals(that.callbacks) : that.callbacks != null) + return false; if (imports != null ? !imports.equals(that.imports) : that.imports != null) return false; if (examples != null ? !examples.equals(that.examples) : that.examples != null) @@ -386,6 +391,7 @@ public class CodegenOperation { result = 31 * result + (isResponseFile ? 13:31); result = 31 * result + (hasReference ? 13:31); result = 31 * result + (isDeprecated ? 13:31); + result = 31 * result + (isCallbackRequest ? 13:31); result = 31 * result + (path != null ? path.hashCode() : 0); result = 31 * result + (operationId != null ? operationId.hashCode() : 0); result = 31 * result + (returnType != null ? returnType.hashCode() : 0); @@ -413,6 +419,7 @@ public class CodegenOperation { result = 31 * result + (authMethods != null ? authMethods.hashCode() : 0); result = 31 * result + (tags != null ? tags.hashCode() : 0); result = 31 * result + (responses != null ? responses.hashCode() : 0); + result = 31 * result + (callbacks != null ? callbacks.hashCode() : 0); result = 31 * result + (imports != null ? imports.hashCode() : 0); result = 31 * result + (examples != null ? examples.hashCode() : 0); result = 31 * result + (externalDocs != null ? externalDocs.hashCode() : 0); 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 eb6522a9318..d290aa5c6ab 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 @@ -41,6 +41,7 @@ public class CodegenParameter { public CodegenProperty mostInnerItems; public Map vendorExtensions = new HashMap(); public boolean hasValidation; + public boolean isNullable; /** * Determines whether this parameter is mandatory. If the parameter is in "path", @@ -150,6 +151,7 @@ public class CodegenParameter { output.vendorExtensions = new HashMap(this.vendorExtensions); } output.hasValidation = this.hasValidation; + output.isNullable = this.isNullable; output.isBinary = this.isBinary; output.isByteArray = this.isByteArray; output.isString = this.isString; @@ -269,6 +271,8 @@ public class CodegenParameter { return false; if (hasValidation != that.hasValidation) return false; + if (isNullable != that.isNullable) + return false; if (required != that.required) return false; if (maximum != null ? !maximum.equals(that.maximum) : that.maximum != null) @@ -344,6 +348,7 @@ public class CodegenParameter { result = 31 * result + (mostInnerItems != null ? mostInnerItems.hashCode() : 0); result = 31 * result + (vendorExtensions != null ? vendorExtensions.hashCode() : 0); result = 31 * result + (hasValidation ? 13:31); + result = 31 * result + (isNullable ? 13:31); result = 31 * result + (required ? 13:31); result = 31 * result + (maximum != null ? maximum.hashCode() : 0); result = 31 * result + (exclusiveMaximum ? 13:31); @@ -409,6 +414,7 @@ public class CodegenParameter { ", mostInnerItems=" + mostInnerItems + ", vendorExtensions=" + vendorExtensions + ", hasValidation=" + hasValidation + + ", isNullable=" + isNullable + ", required=" + required + ", maximum='" + maximum + '\'' + ", exclusiveMaximum=" + exclusiveMaximum + diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenType.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenType.java index 958fabc2b85..dda89fe50c0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenType.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/CodegenType.java @@ -25,7 +25,7 @@ import java.util.Locale; import java.util.Map; public enum CodegenType { - CLIENT, SERVER, DOCUMENTATION, CONFIG, OTHER; + CLIENT, SERVER, DOCUMENTATION, SCHEMA, CONFIG, OTHER; private static Map names = new HashMap(); @@ -49,6 +49,7 @@ public enum CodegenType { names.put("client", CLIENT); names.put("server", SERVER); names.put("documentation", DOCUMENTATION); + names.put("schema", SCHEMA); names.put("other", OTHER); } } 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 61d1ae83155..3e5cef43850 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 @@ -24,6 +24,7 @@ import com.samskivert.mustache.Mustache.Compiler; import io.swagger.v3.core.util.Json; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.callbacks.Callback; import io.swagger.v3.oas.models.examples.Example; import io.swagger.v3.oas.models.headers.Header; import io.swagger.v3.oas.models.media.ArraySchema; @@ -50,6 +51,7 @@ import io.swagger.v3.parser.util.SchemaTypeUtil; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.tuple.Pair; import org.openapitools.codegen.CodegenDiscriminator.MappedModel; import org.openapitools.codegen.examples.ExampleGenerator; import org.openapitools.codegen.serializer.SerializerUtils; @@ -76,6 +78,11 @@ import java.util.TreeSet; import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import java.util.stream.Stream; + +import static org.openapitools.codegen.utils.StringUtils.camelize; +import static org.openapitools.codegen.utils.StringUtils.underscore; +import static org.openapitools.codegen.utils.StringUtils.escape; public class DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(DefaultCodegen.class); @@ -126,8 +133,10 @@ public class DefaultCodegen implements CodegenConfig { protected Boolean prependFormOrBodyParameters = false; // The extension of the generated documentation files (defaults to markdown .md) protected String docExtension; - protected String ignoreFilePathOverride; + // flag to indicate whether to use environment variable to post process file + protected boolean enablePostProcessFile = false; + public List cliOptions() { return cliOptions; @@ -189,6 +198,11 @@ public class DefaultCodegen implements CodegenConfig { this.setDocExtension(String.valueOf(additionalProperties .get(CodegenConstants.DOCEXTENSION).toString())); } + + if (additionalProperties.containsKey(CodegenConstants.ENABLE_POST_PROCESS_FILE)) { + this.setEnablePostProcessFile(Boolean.valueOf(additionalProperties + .get(CodegenConstants.ENABLE_POST_PROCESS_FILE).toString())); + } } // override with any special post-processing for all models @@ -232,6 +246,7 @@ public class DefaultCodegen implements CodegenConfig { parent.setChildren(new ArrayList()); } parent.getChildren().add(cm); + parent.hasChildren = true; if (parent.getDiscriminator() == null) { parent = allModels.get(parent.getParent()); } else { @@ -284,6 +299,8 @@ public class DefaultCodegen implements CodegenConfig { enumVar.put("isString", isDataTypeString(cm.dataType)); enumVars.add(enumVar); } + // if "x-enum-varnames" defined, update varnames + updateEnumVarsWithExtensions(enumVars, cm.getVendorExtensions()); cm.allowableValues.put("enumVars", enumVars); } @@ -772,7 +789,7 @@ public class DefaultCodegen implements CodegenConfig { if (reservedWords.contains(name)) { return escapeReservedWord(name); } else if (((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains("" + ((char) character)))) { - return escapeSpecialCharacters(name, null, null); + return escape(name, specialCharReplacements, null, null); } else { return name; } @@ -790,7 +807,7 @@ public class DefaultCodegen implements CodegenConfig { if (reservedWords.contains(name)) { return escapeReservedWord(name); } else if (((CharSequence) name).chars().anyMatch(character -> specialCharReplacements.keySet().contains("" + ((char) character)))) { - return escapeSpecialCharacters(name, null, null); + return escape(name, specialCharReplacements, null, null); } return name; } @@ -838,21 +855,12 @@ public class DefaultCodegen implements CodegenConfig { * @return the escaped word *

* throws Runtime exception as word is not escaped properly. + * @see org.openapitools.codegen.utils.StringUtils#escape directly instead + * @deprecated since version 3.2.3, may be removed with the next major release (4.0) */ + @Deprecated public String escapeSpecialCharacters(String name, List charactersToAllow, String appdendixToReplacement) { - String result = (String) ((CharSequence) name).chars().mapToObj(c -> { - String character = "" + (char) c; - if (charactersToAllow != null && charactersToAllow.contains(character)) { - return character; - } else if (specialCharReplacements.containsKey(character)) { - return specialCharReplacements.get(character) + (appdendixToReplacement != null ? appdendixToReplacement : ""); - } else { - return character; - } - }).reduce((c1, c2) -> "" + c1 + c2).orElse(null); - - if (result != null) return result; - throw new RuntimeException("Word '" + name + "' could not be escaped."); + return escape(name, specialCharReplacements, charactersToAllow, appdendixToReplacement); } /** @@ -1095,11 +1103,6 @@ public class DefaultCodegen implements CodegenConfig { public String toInstantiationType(Schema schema) { if (ModelUtils.isMapSchema(schema)) { Schema additionalProperties = ModelUtils.getAdditionalProperties(schema); - String type = additionalProperties.getType(); - if (null == type) { - LOGGER.error("No Type defined for Additional Property " + additionalProperties + "\n" // - + "\tIn Property: " + schema); - } String inner = getSchemaType(additionalProperties); return instantiationTypes.get("map") + ""; } else if (ModelUtils.isArraySchema(schema)) { @@ -1750,7 +1753,7 @@ public class DefaultCodegen implements CodegenConfig { if (name == null || name.length() == 0) { return name; } - return camelize(toVarName(name)); + return org.openapitools.codegen.utils.StringUtils.camelize(toVarName(name)); } /** @@ -1769,17 +1772,14 @@ public class DefaultCodegen implements CodegenConfig { CodegenProperty property = CodegenModelFactory.newInstance(CodegenModelType.PROPERTY); property.name = toVarName(name); property.baseName = name; - property.nameInCamelCase = camelize(property.name, false); + property.nameInCamelCase = org.openapitools.codegen.utils.StringUtils.camelize(property.name, false); property.nameInSnakeCase = CaseFormat.UPPER_CAMEL.to(CaseFormat.UPPER_UNDERSCORE, property.nameInCamelCase); property.description = escapeText(p.getDescription()); property.unescapedDescription = p.getDescription(); property.title = p.getTitle(); property.getter = toGetter(name); property.setter = toSetter(name); - String example = toExampleValue(p); - if (!"null".equals(example)) { - property.example = example; - } + property.example = toExampleValue(p); property.defaultValue = toDefaultValue(p); property.defaultValueWithParam = toDefaultValueWithParam(name, p); property.jsonSchema = Json.pretty(p); @@ -2228,14 +2228,17 @@ public class DefaultCodegen implements CodegenConfig { Map schemas, OpenAPI openAPI) { LOGGER.debug("fromOperation => operation: " + operation); + if (operation == null) + throw new RuntimeException("operation cannot be null in fromOperation"); + CodegenOperation op = CodegenModelFactory.newInstance(CodegenModelType.OPERATION); Set imports = new HashSet(); if (operation.getExtensions() != null && !operation.getExtensions().isEmpty()) { op.vendorExtensions.putAll(operation.getExtensions()); - } - if (operation == null) - throw new RuntimeException("operation cannot be null in fromOperation"); + Object isCallbackRequest = op.vendorExtensions.remove("x-callback-request"); + op.isCallbackRequest = Boolean.TRUE.equals(isCallbackRequest); + } // store the original operationId for plug-in op.operationIdOriginal = operation.getOperationId(); @@ -2249,7 +2252,12 @@ public class DefaultCodegen implements CodegenConfig { } } operationId = removeNonNameElementToCamelCase(operationId); - op.path = path; + + if (path.startsWith("/")) { + op.path = path; + } else { + op.path = "/" + path; + } op.operationId = toOperationId(operationId); op.summary = escapeText(operation.getSummary()); op.unescapedNotes = operation.getDescription(); @@ -2286,7 +2294,10 @@ public class DefaultCodegen implements CodegenConfig { op.responses.get(op.responses.size() - 1).hasMore = false; if (methodResponse != null) { - final Schema responseSchema = ModelUtils.getSchemaFromResponse(methodResponse); + Schema responseSchema = ModelUtils.getSchemaFromResponse(methodResponse); + if (openAPI != null && openAPI.getComponents() != null) { // has models/aliases defined + responseSchema = ModelUtils.unaliasSchema(openAPI.getComponents().getSchemas(), responseSchema); + } if (responseSchema != null) { CodegenProperty cm = fromProperty("response", responseSchema); @@ -2340,6 +2351,15 @@ public class DefaultCodegen implements CodegenConfig { } } + if (operation.getCallbacks() != null && !operation.getCallbacks().isEmpty()) { + operation.getCallbacks().forEach((name, callback) -> { + CodegenCallback c = fromCallback(name, callback, schemas, openAPI); + c.hasMore = true; + op.callbacks.add(c); + }); + op.callbacks.get(op.callbacks.size() - 1).hasMore = false; + } + List parameters = operation.getParameters(); List allParams = new ArrayList(); List bodyParams = new ArrayList(); @@ -2617,6 +2637,79 @@ public class DefaultCodegen implements CodegenConfig { return r; } + /** + * Convert OAS Callback object to Codegen Callback object + * + * @param name callback name + * @param callback OAS Callback object + * @param schemas a map of OAS models + * @param openAPI a OAS object representing the spec + * @return Codegen Response object + */ + public CodegenCallback fromCallback(String name, Callback callback, Map schemas, OpenAPI openAPI) { + CodegenCallback c = new CodegenCallback(); + c.name = name; + + if (callback.getExtensions() != null && !callback.getExtensions().isEmpty()) { + c.vendorExtensions.putAll(callback.getExtensions()); + } + + callback.forEach((expression, pi) -> { + CodegenCallback.Url u = new CodegenCallback.Url(); + u.expression = expression; + u.hasMore = true; + + if (pi.getExtensions() != null && !pi.getExtensions().isEmpty()) { + u.vendorExtensions.putAll(pi.getExtensions()); + } + + Stream.of( + Pair.of("get", pi.getGet()), + Pair.of("head", pi.getHead()), + Pair.of("put", pi.getPut()), + Pair.of("post", pi.getPost()), + Pair.of("delete", pi.getDelete()), + Pair.of("patch", pi.getPatch()), + Pair.of("options", pi.getOptions())) + .filter(p -> p.getValue() != null) + .forEach(p -> { + String method = p.getKey(); + Operation op = p.getValue(); + + boolean genId = op.getOperationId() == null; + if (genId) { + op.setOperationId(getOrGenerateOperationId(op, c.name + "_" + expression.replaceAll("\\{\\$.*}", ""), method)); + } + + if (op.getExtensions() == null) { + op.setExtensions(new HashMap<>()); + } + // This extension will be removed later by `fromOperation()` as it is only needed here to + // distinguish between normal operations and callback requests + op.getExtensions().put("x-callback-request", true); + + CodegenOperation co = fromOperation(expression, method, op, schemas, openAPI); + if (genId) { + co.operationIdOriginal = null; + // legacy (see `fromOperation()`) + co.nickname = co.operationId; + } + u.requests.add(co); + }); + + if (!u.requests.isEmpty()) { + u.requests.get(u.requests.size() - 1).hasMore = false; + } + c.urls.add(u); + }); + + if (!c.urls.isEmpty()) { + c.urls.get(c.urls.size() - 1).hasMore = false; + } + + return c; + } + /** * Convert OAS Parameter object to Codegen Parameter object * @@ -2649,10 +2742,14 @@ public class DefaultCodegen implements CodegenConfig { LOGGER.warn("warning! Schema not found for parameter \"" + parameter.getName() + "\", using String"); parameterSchema = new StringSchema().description("//TODO automatically added by openapi-generator due to missing type definition."); } - // set default value - if (parameterSchema.getDefault() != null) { - codegenParameter.defaultValue = toDefaultValue(parameterSchema); + + if (Boolean.TRUE.equals(parameterSchema.getNullable())) { // use nullable defined in the spec + codegenParameter.isNullable = true; } + + // set default value + codegenParameter.defaultValue = toDefaultValue(parameterSchema); + // TDOO revise collectionFormat String collectionFormat = null; if (ModelUtils.isArraySchema(parameterSchema)) { // for array parameter @@ -3139,8 +3236,8 @@ public class DefaultCodegen implements CodegenConfig { } co.operationId = uniqueName; co.operationIdLowerCase = uniqueName.toLowerCase(Locale.ROOT); - co.operationIdCamelCase = DefaultCodegen.camelize(uniqueName); - co.operationIdSnakeCase = DefaultCodegen.underscore(uniqueName); + co.operationIdCamelCase = org.openapitools.codegen.utils.StringUtils.camelize(uniqueName); + co.operationIdSnakeCase = org.openapitools.codegen.utils.StringUtils.underscore(uniqueName); opList.add(co); co.baseName = tag; } @@ -3169,23 +3266,12 @@ public class DefaultCodegen implements CodegenConfig { * * @param word The word * @return The underscored version of the word + * @see org.openapitools.codegen.utils.StringUtils#underscore + * @deprecated since version 3.2.3, may be removed with the next major release (4.0) */ + @Deprecated public static String underscore(String word) { - String firstPattern = "([A-Z]+)([A-Z][a-z])"; - String secondPattern = "([a-z\\d])([A-Z])"; - String replacementPattern = "$1_$2"; - // Replace package separator with slash. - word = word.replaceAll("\\.", "/"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. - // Replace $ with two underscores for inner classes. - word = word.replaceAll("\\$", "__"); - // Replace capital letter with _ plus lowercase letter. - word = word.replaceAll(firstPattern, replacementPattern); - word = word.replaceAll(secondPattern, replacementPattern); - word = word.replace('-', '_'); - // replace space with underscore - word = word.replace(' ', '_'); - word = word.toLowerCase(Locale.ROOT); - return word; + return org.openapitools.codegen.utils.StringUtils.underscore(word); } /** @@ -3193,10 +3279,13 @@ public class DefaultCodegen implements CodegenConfig { * * @param word The word * @return The dashized version of the word, e.g. "my-name" + * @see org.openapitools.codegen.utils.StringUtils#dashize + * @deprecated since version 3.2.3, may be removed with the next major release (4.0) */ @SuppressWarnings("static-method") + @Deprecated protected String dashize(String word) { - return underscore(word).replaceAll("[_ ]", "-"); + return org.openapitools.codegen.utils.StringUtils.dashize(word); } /** @@ -3396,6 +3485,7 @@ public class DefaultCodegen implements CodegenConfig { return result; } + /** * Camelize name (parameter, property, method, etc) with upper case for first letter * copied from Twitter elephant bird @@ -3403,9 +3493,12 @@ public class DefaultCodegen implements CodegenConfig { * * @param word string to be camelize * @return camelized string + * @see org.openapitools.codegen.utils.StringUtils#camelize(String) + * @deprecated since version 3.2.3, may be removed with the next major release (4.0) */ + @Deprecated public static String camelize(String word) { - return camelize(word, false); + return org.openapitools.codegen.utils.StringUtils.camelize(word); } /** @@ -3414,80 +3507,15 @@ public class DefaultCodegen implements CodegenConfig { * @param word string to be camelize * @param lowercaseFirstLetter lower case for first letter if set to true * @return camelized string + * @see org.openapitools.codegen.utils.StringUtils#camelize(String, boolean) + * @deprecated since version 3.2.3, may be removed with the next major release (4.0) */ + @Deprecated public static String camelize(String word, boolean lowercaseFirstLetter) { - // Replace all slashes with dots (package separator) - Pattern p = Pattern.compile("\\/(.?)"); - Matcher m = p.matcher(word); - while (m.find()) { - word = m.replaceFirst("." + m.group(1)/*.toUpperCase(Locale.ROOT)*/); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. - m = p.matcher(word); - } - - // case out dots - String[] parts = word.split("\\."); - StringBuilder f = new StringBuilder(); - for (String z : parts) { - if (z.length() > 0) { - f.append(Character.toUpperCase(z.charAt(0))).append(z.substring(1)); - } - } - word = f.toString(); - - m = p.matcher(word); - while (m.find()) { - word = m.replaceFirst("" + Character.toUpperCase(m.group(1).charAt(0)) + m.group(1).substring(1)/*.toUpperCase(Locale.ROOT)*/); - m = p.matcher(word); - } - - // Uppercase the class name. - p = Pattern.compile("(\\.?)(\\w)([^\\.]*)$"); - m = p.matcher(word); - if (m.find()) { - String rep = m.group(1) + m.group(2).toUpperCase(Locale.ROOT) + m.group(3); - rep = rep.replaceAll("\\$", "\\\\\\$"); - word = m.replaceAll(rep); - } - - // Remove all underscores (underscore_case to camelCase) - p = Pattern.compile("(_)(.)"); - m = p.matcher(word); - while (m.find()) { - String original = m.group(2); - String upperCase = original.toUpperCase(Locale.ROOT); - if (original.equals(upperCase)) { - word = word.replaceFirst("_", ""); - } else { - word = m.replaceFirst(upperCase); - } - m = p.matcher(word); - } - - // Remove all hyphens (hyphen-case to camelCase) - p = Pattern.compile("(-)(.)"); - m = p.matcher(word); - while (m.find()) { - word = m.replaceFirst(m.group(2).toUpperCase(Locale.ROOT)); - m = p.matcher(word); - } - - if (lowercaseFirstLetter && word.length() > 0) { - int i = 0; - char charAt = word.charAt(i); - while (i + 1 < word.length() && !((charAt >= 'a' && charAt <= 'z') || (charAt >= 'A' && charAt <= 'Z'))) { - i = i + 1; - charAt = word.charAt(i); - } - i = i + 1; - word = word.substring(0, i).toLowerCase(Locale.ROOT) + word.substring(i); - } - - // remove all underscore - word = word.replaceAll("_", ""); - - return word; + return org.openapitools.codegen.utils.StringUtils.camelize(word, lowercaseFirstLetter); } + public String apiFilename(String templateName, String tag) { String suffix = apiTemplateFiles().get(templateName); return apiFileFolder() + File.separator + toApiFilename(tag) + suffix; @@ -3902,6 +3930,8 @@ public class DefaultCodegen implements CodegenConfig { enumVar.put("isString", isDataTypeString(dataType)); enumVars.add(enumVar); } + // if "x-enum-varnames" defined, update varnames + updateEnumVarsWithExtensions(enumVars, var.getVendorExtensions()); allowableValues.put("enumVars", enumVars); // handle default value for enum, e.g. available => StatusEnum.AVAILABLE @@ -3919,6 +3949,16 @@ public class DefaultCodegen implements CodegenConfig { } } + private void updateEnumVarsWithExtensions(List> enumVars, Map vendorExtensions) { + if (vendorExtensions != null && vendorExtensions.containsKey("x-enum-varnames")) { + List alias = (List) vendorExtensions.get("x-enum-varnames"); + int size = Math.min(enumVars.size(), alias.size()); + for (int i = 0; i < size; i++) { + enumVars.get(i).put("name", alias.get(i)); + } + } + } + /** * If the pattern misses the delimiter, add "/" to the beginning and end * Otherwise, return the original pattern @@ -4179,12 +4219,12 @@ public class DefaultCodegen implements CodegenConfig { protected String getParentName(ComposedSchema composedSchema, Map allSchemas) { if (composedSchema.getAllOf() != null && !composedSchema.getAllOf().isEmpty()) { - Schema schema = composedSchema.getAllOf().get(0); - String ref = schema.get$ref(); - if (StringUtils.isBlank(ref)) { - return null; + for (Schema schema : composedSchema.getAllOf()) { + String ref = schema.get$ref(); + if (!StringUtils.isBlank(ref)) { + return ModelUtils.getSimpleRef(ref); + } } - return ModelUtils.getSimpleRef(ref); } return null; } @@ -4265,6 +4305,9 @@ public class DefaultCodegen implements CodegenConfig { // default to csv: codegenParameter.collectionFormat = StringUtils.isEmpty(collectionFormat) ? "csv" : collectionFormat; + // set nullable + setParameterNullable(codegenParameter, codegenProperty); + // recursively add import while (codegenProperty != null) { imports.add(codegenProperty.baseType); @@ -4293,7 +4336,7 @@ public class DefaultCodegen implements CodegenConfig { public CodegenParameter fromFormProperty(String name, Schema propertySchema, Set imports) { CodegenParameter codegenParameter = CodegenModelFactory.newInstance(CodegenModelType.PARAMETER); - LOGGER.debug("Debugging fromFormProperty: " + name); + LOGGER.debug("Debugging fromFormProperty {}: {}", name, propertySchema); CodegenProperty codegenProperty = fromProperty(name, propertySchema); codegenParameter.isFormParam = Boolean.TRUE; @@ -4307,7 +4350,6 @@ public class DefaultCodegen implements CodegenConfig { codegenParameter.jsonSchema = Json.pretty(propertySchema); codegenParameter.defaultValue = codegenProperty.getDefaultValue(); - if (codegenProperty.getVendorExtensions() != null && !codegenProperty.getVendorExtensions().isEmpty()) { codegenParameter.vendorExtensions = codegenProperty.getVendorExtensions(); } @@ -4366,6 +4408,8 @@ public class DefaultCodegen implements CodegenConfig { setParameterBooleanFlagWithCodegenProperty(codegenParameter, codegenProperty); setParameterExampleValue(codegenParameter); + // set nullable + setParameterNullable(codegenParameter, codegenProperty); //TODO collectionFormat for form parameter not yet supported //codegenParameter.collectionFormat = getCollectionFormat(propertySchema); @@ -4415,6 +4459,9 @@ public class DefaultCodegen implements CodegenConfig { codegenParameter.isMapContainer = Boolean.TRUE; setParameterBooleanFlagWithCodegenProperty(codegenParameter, codegenProperty); + + // set nullable + setParameterNullable(codegenParameter, codegenProperty); } else if (ModelUtils.isArraySchema(schema)) { final ArraySchema arraySchema = (ArraySchema) schema; Schema inner = arraySchema.getItems(); @@ -4454,6 +4501,8 @@ public class DefaultCodegen implements CodegenConfig { codegenParameter.isListContainer = Boolean.TRUE; setParameterBooleanFlagWithCodegenProperty(codegenParameter, codegenProperty); + // set nullable + setParameterNullable(codegenParameter, codegenProperty); while (codegenProperty != null) { imports.add(codegenProperty.baseType); @@ -4516,6 +4565,8 @@ public class DefaultCodegen implements CodegenConfig { } } setParameterBooleanFlagWithCodegenProperty(codegenParameter, codegenProperty); + // set nullable + setParameterNullable(codegenParameter, codegenProperty); } } else { @@ -4539,6 +4590,8 @@ public class DefaultCodegen implements CodegenConfig { } setParameterBooleanFlagWithCodegenProperty(codegenParameter, codegenProperty); + // set nullable + setParameterNullable(codegenParameter, codegenProperty); } // set the parameter's example value @@ -4636,4 +4689,41 @@ public class DefaultCodegen implements CodegenConfig { } return codegenServerVariables; } + + private void setParameterNullable(CodegenParameter parameter, CodegenProperty property) { + parameter.isNullable = property.isNullable; + } + + /** + * Post-process the auto-generated file, e.g. using go-fmt to format the Go code. The file type can be "model-test", + * "model-doc", "model", "api", "api-test", "api-doc", "supporting-mustache", "supporting-common", + * "openapi-generator-ignore", "openapi-generator-version" + *

+ * TODO: store these values in enum instead + * + * @param file file to be processed + * @param fileType file type + */ + public void postProcessFile(File file, String fileType) { + LOGGER.debug("Post processing file {} ({})", file, fileType); + } + + /** + * Boolean value indicating the state of the option for post-processing file using envirionment variables. + * + * @return true if the option is enabled + */ + public boolean isEnablePostProcessFile() { + return enablePostProcessFile; + } + + /** + * Set the boolean value indicating the state of the option for post-processing file using envirionment variables. + * + * @param enablePostProcessFile true to enable post-processing file + */ + public void setEnablePostProcessFile(boolean enablePostProcessFile) { + this.enablePostProcessFile = enablePostProcessFile; + } + } 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 71e90105422..a18fffa3582 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 @@ -193,15 +193,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { } URL url = URLPathUtils.getServerURL(openAPI); - contextPath = config.escapeText(url.getPath()); - basePathWithoutHost = contextPath; // for backward compatibility - basePath = config.escapeText(URLPathUtils.getHost(openAPI)); - if ("/".equals(basePath.substring(basePath.length() - 1))) { - // remove trailing "/" - // https://host.example.com/ => https://host.example.com - basePath = basePath.substring(0, basePath.length() - 1); - } - + contextPath = config.escapeText(url.getPath()).replaceAll("/$", ""); // for backward compatibility + basePathWithoutHost = contextPath; + basePath = config.escapeText(URLPathUtils.getHost(openAPI)).replaceAll("/$", ""); } private void configureOpenAPIInfo() { @@ -279,6 +273,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { File written = processTemplateToFile(models, templateName, filename); if (written != null) { files.add(written); + if (config.isEnablePostProcessFile()) { + config.postProcessFile(written, "model-test"); + } } } } @@ -295,6 +292,27 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { File written = processTemplateToFile(models, templateName, filename); if (written != null) { files.add(written); + if (config.isEnablePostProcessFile()) { + config.postProcessFile(written, "model-doc"); + } + } + } + } + + private void generateModel(List files, Map models, String modelName) throws IOException { + for (String templateName : config.modelTemplateFiles().keySet()) { + String suffix = config.modelTemplateFiles().get(templateName); + String filename = config.modelFileFolder() + File.separator + config.toModelFilename(modelName) + suffix; + if (!config.shouldOverwrite(filename)) { + LOGGER.info("Skipped overwriting " + filename); + continue; + } + File written = processTemplateToFile(models, templateName, filename); + if (written != null) { + files.add(written); + if (config.isEnablePostProcessFile()) { + config.postProcessFile(written, "model"); + } } } } @@ -442,19 +460,11 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { allModels.add(modelTemplate); - for (String templateName : config.modelTemplateFiles().keySet()) { - String suffix = config.modelTemplateFiles().get(templateName); - String filename = config.modelFileFolder() + File.separator + config.toModelFilename(modelName) + suffix; - if (!config.shouldOverwrite(filename)) { - LOGGER.info("Skipped overwriting " + filename); - continue; - } - File written = processTemplateToFile(models, templateName, filename); - if (written != null) { - files.add(written); - } - } + // to generate model files + generateModel(files, models, modelName); + if (generateModelTests) { + // to generate model test files generateModelTests(files, models, modelName); } if (generateModelDocumentation) { @@ -548,6 +558,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { File written = processTemplateToFile(operation, templateName, filename); if (written != null) { files.add(written); + if (config.isEnablePostProcessFile()) { + config.postProcessFile(written, "api"); + } } } @@ -564,6 +577,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { File written = processTemplateToFile(operation, templateName, filename); if (written != null) { files.add(written); + if (config.isEnablePostProcessFile()) { + config.postProcessFile(written, "api-test"); + } } } } @@ -581,6 +597,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { File written = processTemplateToFile(operation, templateName, filename); if (written != null) { files.add(written); + if (config.isEnablePostProcessFile()) { + config.postProcessFile(written, "api-doc"); + } } } } @@ -651,7 +670,11 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { .compile(template); writeToFile(outputFilename, tmpl.execute(bundle)); - files.add(new File(outputFilename)); + File written = new File(outputFilename); + files.add(written); + if (config.isEnablePostProcessFile()) { + config.postProcessFile(written, "supporting-mustache"); + } } else { InputStream in = null; @@ -665,6 +688,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { } File outputFile = writeInputStreamToFile(outputFilename, in, templateFile); files.add(outputFile); + if (config.isEnablePostProcessFile()) { + config.postProcessFile(outputFile, "supporting-common"); + } } } else { LOGGER.info("Skipped generation of " + outputFilename + " due to rule in .openapi-generator-ignore"); @@ -688,6 +714,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { throw new RuntimeException("Could not generate supporting file '" + openapiGeneratorIgnore + "'", e); } files.add(ignoreFile); + if (config.isEnablePostProcessFile()) { + config.postProcessFile(ignoreFile, "openapi-generator-ignore"); + } } if (generateMetadata) { @@ -696,6 +725,9 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { try { writeToFile(versionMetadata, ImplementationVersion.read()); files.add(versionMetadataFile); + if (config.isEnablePostProcessFile()) { + config.postProcessFile(ignoreFile, "openapi-generator-version"); + } } catch (IOException e) { throw new RuntimeException("Could not generate supporting file '" + versionMetadata + "'", e); } @@ -762,7 +794,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { bundle.put("authMethods", authMethods); bundle.put("hasAuthMethods", true); } - + List servers = config.fromServers(openAPI.getServers()); if (servers != null && !servers.isEmpty()) { bundle.put("servers", servers); @@ -1008,6 +1040,7 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { } if (mapping != null) { im.put("import", mapping); + im.put("classname", nextImport); if (!imports.contains(im)) { // avoid duplicates imports.add(im); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java index a1993a6d967..36399cd8b89 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/config/CodegenConfigurator.java @@ -96,6 +96,7 @@ public class CodegenConfigurator implements Serializable { private boolean skipOverwrite; private boolean removeOperationIdPrefix; private boolean validateSpec; + private boolean enablePostProcessFile; private String templateDir; private String auth; private String apiPackage; @@ -210,6 +211,15 @@ public class CodegenConfigurator implements Serializable { return this; } + public boolean getEnablePostProcessFile() { + return enablePostProcessFile; + } + + public CodegenConfigurator setEnablePostProcessFile(boolean enablePostProcessFile) { + this.enablePostProcessFile = enablePostProcessFile; + return this; + } + public String getModelNameSuffix() { return modelNameSuffix; } @@ -503,6 +513,7 @@ public class CodegenConfigurator implements Serializable { config.setSkipOverwrite(skipOverwrite); config.setIgnoreFilePathOverride(ignoreFileOverride); config.setRemoveOperationIdPrefix(removeOperationIdPrefix); + config.setEnablePostProcessFile(enablePostProcessFile); config.instantiationTypes().putAll(instantiationTypes); config.typeMapping().putAll(typeMappings); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java index d15b57315da..02e193d8f47 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractAdaCodegen.java @@ -24,6 +24,8 @@ 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 io.swagger.v3.oas.models.security.SecurityRequirement; +import io.swagger.v3.oas.models.security.SecurityScheme; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenModel; @@ -44,6 +46,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; + abstract public class AbstractAdaCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractAdaCodegen.class); @@ -413,9 +416,38 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg } } } + + // Add a vendor extension attribute that provides a map of auth methods and the scopes + // which are expected by the operation. This map is then used by postProcessOperationsWithModels + // to build another vendor extension that provides a subset of the auth methods with only + // the scopes required by the operation. + final List securities = operation.getSecurity(); + if (securities != null && securities.size() > 0) { + final Map securitySchemes = openAPI.getComponents() != null ? openAPI.getComponents().getSecuritySchemes() : null; + final List globalSecurities = openAPI.getSecurity(); + + Map> scopes = getAuthScopes(securities, securitySchemes); + if (scopes.isEmpty() && globalSecurities != null) { + scopes = getAuthScopes(globalSecurities, securitySchemes); + } + op.vendorExtensions.put("x-scopes", scopes); + } return op; } + private Map> getAuthScopes(List securities, Map securitySchemes) { + final Map> scopes = new HashMap<>(); + for (SecurityRequirement requirement : securities) { + for (String key : requirement.keySet()) { + SecurityScheme securityScheme = securitySchemes.get(key); + if (securityScheme != null) { + scopes.put(key, requirement.get(key)); + } + } + } + return scopes; + } + @SuppressWarnings("unchecked") @Override public Map postProcessOperationsWithModels(Map objs, List allModels) { @@ -448,7 +480,14 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg p.dataType = "Swagger.File_Part_Type"; } } - postProcessAuthMethod(op1.authMethods); + + // Given the operation scopes and the auth methods, build a list of auth methods that only + // describe the auth methods and scopes required by the operation. + final Map> scopes = (Map>) op1.vendorExtensions.get("x-scopes"); + List opScopes = postProcessAuthMethod(op1.authMethods, scopes); + if (opScopes != null) { + op1.vendorExtensions.put("x-auth-scopes", opScopes); + } /* * Scan the path parameter to construct a x-path-index that tells the index of @@ -583,7 +622,7 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg * Collect the scopes to generate unique identifiers for each of them. */ List authMethods = (List) objs.get("authMethods"); - postProcessAuthMethod(authMethods); + postProcessAuthMethod(authMethods, null); return super.postProcessSupportingFileData(objs); } @@ -592,8 +631,11 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg * Collect the scopes to generate a unique identifier for each of them. * * @param authMethods the auth methods with their scopes. + * @param scopes the optional auth methods and scopes required by an operation + * @return the authMethods to be used by the operation with its required scopes. */ - private void postProcessAuthMethod(List authMethods) { + private List postProcessAuthMethod(List authMethods, Map> scopes) { + List result = (scopes == null) ? null : new ArrayList(); if (authMethods != null) { for (CodegenSecurity authMethod : authMethods) { if (authMethod.scopes != null) { @@ -619,8 +661,39 @@ abstract public class AbstractAdaCodegen extends DefaultCodegen implements Codeg } } } - authMethod.name = camelize(sanitizeName(authMethod.name), true); + + // If we have operation scopes, filter the auth method to describe the operation auth + // method with only the scope that it requires. We have to create a new auth method + // instance because the original object must not be modified. + List opScopes = (scopes == null) ? null : scopes.get(authMethod.name); + authMethod.name = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(authMethod.name), true); + if (opScopes != null) { + CodegenSecurity opSecurity = new CodegenSecurity(); + opSecurity.name = authMethod.name; + opSecurity.type = authMethod.type; + opSecurity.hasMore = false; + opSecurity.isBasic = authMethod.isBasic; + opSecurity.isApiKey = authMethod.isApiKey; + opSecurity.isKeyInCookie = authMethod.isKeyInCookie; + opSecurity.isKeyInHeader = authMethod.isKeyInHeader; + opSecurity.isKeyInQuery = authMethod.isKeyInQuery; + opSecurity.flow = authMethod.flow; + opSecurity.tokenUrl = authMethod.tokenUrl; + List> opAuthScopes = new ArrayList>(); + for (String opScopeName : opScopes) { + for (Map scope : authMethod.scopes) { + String name = (String) scope.get("scope"); + if (opScopeName.equals(name)) { + opAuthScopes.add(scope); + break; + } + } + } + opSecurity.scopes = opAuthScopes; + result.add(opSecurity); + } } } + return result; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractApexCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractApexCodegen.java index 3968eaaca51..54abf6168e4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractApexCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractApexCodegen.java @@ -36,6 +36,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; + public abstract class AbstractApexCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractApexCodegen.class); @@ -112,7 +113,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code // camelize (lower first character) the variable name // pet_id => petId - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -159,7 +160,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code // camelize the model name // phone_number => PhoneNumber - final String camelizedName = camelize(nameWithPrefixSuffix); + final String camelizedName = org.openapitools.codegen.utils.StringUtils.camelize(nameWithPrefixSuffix); // model name cannot use reserved keyword, e.g. return if (isReservedWord(camelizedName)) { @@ -422,11 +423,11 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code throw new RuntimeException("Empty method/operation name (operationId) not allowed"); } - operationId = camelize(sanitizeName(operationId), true); + operationId = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true); // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - String newOperationId = camelize("call_" + operationId, true); + String newOperationId = org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId, true); LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); return newOperationId; } @@ -515,7 +516,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code @Override public String toEnumName(CodegenProperty property) { - return sanitizeName(camelize(property.name)) + "Enum"; + return sanitizeName(org.openapitools.codegen.utils.StringUtils.camelize(property.name)) + "Enum"; } @Override @@ -669,7 +670,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code @Override public String sanitizeTag(String tag) { - return camelize(sanitizeName(tag)); + return org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(tag)); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java index 92c9f536068..305453319c3 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractCSharpCodegen.java @@ -20,6 +20,7 @@ package org.openapitools.codegen.languages; import com.google.common.collect.ImmutableMap; import com.samskivert.mustache.Mustache; import io.swagger.v3.core.util.Json; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.utils.*; @@ -39,6 +40,7 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.util.*; + public abstract class AbstractCSharpCodegen extends DefaultCodegen implements CodegenConfig { protected boolean optionalAssemblyInfoFlag = true; @@ -212,6 +214,10 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co public void processOpts() { super.processOpts(); + if (StringUtils.isEmpty(System.getenv("CSHARP_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable CSHARP_POST_PROCESS_FILE not defined so the C# code may not be properly formatted by uncrustify (0.66 or later) or other code formatter. To define it, try `export CSHARP_POST_PROCESS_FILE=\"/usr/local/bin/uncrustify --no-backup\" && export UNCRUSTIFY_CONFIG=/path/to/uncrustify-rules.cfg` (Linux/Mac). Note: replace /path/to with the location of uncrustify-rules.cfg"); + } + // {{packageVersion}} if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) { setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION)); @@ -421,8 +427,6 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co var.allowableValues = refModel.allowableValues; var.isEnum = true; - updateCodegenPropertyEnum(var); - // We do these after updateCodegenPropertyEnum to avoid generalities that don't mesh with C#. var.isPrimitiveType = true; } @@ -600,17 +604,17 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId))); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId))); operationId = "call_" + operationId; } // operationId starts with a number if (operationId.matches("^\\d.*")) { - LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId))); + LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId))); operationId = "call_" + operationId; } - return camelize(sanitizeName(operationId)); + return org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId)); } @Override @@ -625,7 +629,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co // camelize the variable name // pet_id => PetId - name = camelize(name); + name = org.openapitools.codegen.utils.StringUtils.camelize(name); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -648,9 +652,9 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co return name; } - // camelize(lower) the variable name + // org.openapitools.codegen.utils.StringUtils.camelize(lower) the variable name // pet_id => petId - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -836,19 +840,19 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. return => ModelReturn (after camelize) } // model name starts with number if (name.matches("^\\d.*")) { - LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override @@ -936,7 +940,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co // for symbol, e.g. $, # if (getSymbolName(name) != null) { - return camelize(getSymbolName(name)); + return org.openapitools.codegen.utils.StringUtils.camelize(getSymbolName(name)); } String enumName = sanitizeName(name); @@ -944,7 +948,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co enumName = enumName.replaceFirst("^_", ""); enumName = enumName.replaceFirst("_$", ""); - enumName = camelize(enumName) + "Enum"; + enumName = org.openapitools.codegen.utils.StringUtils.camelize(enumName) + "Enum"; if (enumName.matches("\\d.*")) { // starts with number return "_" + enumName; @@ -955,7 +959,7 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co @Override public String toEnumName(CodegenProperty property) { - return sanitizeName(camelize(property.name)) + "Enum"; + return sanitizeName(org.openapitools.codegen.utils.StringUtils.camelize(property.name)) + "Enum"; } public String testPackageName() { @@ -1014,6 +1018,33 @@ public abstract class AbstractCSharpCodegen extends DefaultCodegen implements Co } else if (Boolean.TRUE.equals(codegenParameter.isString)) { codegenParameter.example = codegenParameter.paramName + "_example"; } + } + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String csharpPostProcessFile = System.getenv("CSHARP_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(csharpPostProcessFile)) { + return; // skip if CSHARP_POST_PROCESS_FILE env variable is not defined + } + + // only process files with .cs extension + if ("cs".equals(FilenameUtils.getExtension(file.toString()))) { + String command = csharpPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java index 116a27d1cac..a9ad50d4b67 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractEiffelCodegen.java @@ -17,6 +17,8 @@ package org.openapitools.codegen.languages; +import static com.google.common.base.Strings.isNullOrEmpty; + import com.google.common.collect.ArrayListMultimap; import com.google.common.collect.Multimap; import io.swagger.v3.core.util.Json; @@ -204,7 +206,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co // (after camelize) } - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); } @Override @@ -215,7 +217,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co // methods parameters as 'final'. // e.g. PetApi.go => pet_api.go - return underscore(name) + "_api"; + return org.openapitools.codegen.utils.StringUtils.underscore(name) + "_api"; } @Override @@ -333,7 +335,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co // method name cannot use reserved keyword, e.g. return if (isReservedWord(sanitizedOperationId)) { LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " - + camelize("call_" + operationId)); + + org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId)); sanitizedOperationId = "call_" + sanitizedOperationId; } // method name from updateSomething to update_Something. @@ -351,7 +353,7 @@ public abstract class AbstractEiffelCodegen extends DefaultCodegen implements Co for (CodegenOperation operation : operations) { // http method verb conversion (e.g. PUT => Put) - operation.httpMethod = camelize(operation.httpMethod.toLowerCase(Locale.ROOT)); + operation.httpMethod = org.openapitools.codegen.utils.StringUtils.camelize(operation.httpMethod.toLowerCase(Locale.ROOT)); } // remove model imports to avoid error 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 e6d60a99df2..45779ac0af9 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 @@ -20,11 +20,14 @@ package org.openapitools.codegen.languages; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.io.FilenameUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; +import java.io.IOException; import java.util.*; public abstract class AbstractGoCodegen extends DefaultCodegen implements CodegenConfig { @@ -112,6 +115,15 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege .defaultValue(Boolean.TRUE.toString())); } + @Override + public void processOpts() { + super.processOpts(); + + if (StringUtils.isEmpty(System.getenv("GO_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable GO_POST_PROCESS_FILE not defined so Go code may not be properly formatted. To define it, try `export GO_POST_PROCESS_FILE=\"/usr/local/bin/gofmt -w\"` (Linux/Mac)"); + } + } + /** * Escapes a reserved word as defined in the `reservedWords` array. Handle escaping * those terms here. This logic is only called if a variable matches the reserved words @@ -134,7 +146,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege if (this.reservedWordsMappings().containsKey(name)) { return this.reservedWordsMappings().get(name); } - return camelize(name) + '_'; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + '_'; } @Override @@ -149,7 +161,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege // camelize (lower first character) the variable name // pet_id => PetId - name = camelize(name); + name = org.openapitools.codegen.utils.StringUtils.camelize(name); // for reserved word append _ if (isReservedWord(name)) { @@ -174,7 +186,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege // params should be lowerCamelCase. E.g. "person Person", instead of // "Person Person". // - name = camelize(toVarName(name), true); + name = org.openapitools.codegen.utils.StringUtils.camelize(toVarName(name), true); // REVISIT: Actually, for idiomatic go, the param name should // really should just be a letter, e.g. "p Person"), but we'll get @@ -191,7 +203,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege public String toModelName(String name) { // camelize the model name // phone_number => PhoneNumber - return camelize(toModel(name)); + return org.openapitools.codegen.utils.StringUtils.camelize(toModel(name)); } @Override @@ -228,7 +240,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); } @Override @@ -237,7 +249,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // e.g. PetApi.go => pet_api.go - name = "api_" + underscore(name); + name = "api_" + org.openapitools.codegen.utils.StringUtils.underscore(name); if (name.endsWith("_test")) { LOGGER.warn(name + ".go with `_test.go` suffix (reserved word) cannot be used as filename. Renamed to " + name + "_.go"); name += "_"; @@ -308,17 +320,17 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege // method name cannot use reserved keyword, e.g. return if (isReservedWord(sanitizedOperationId)) { LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " - + camelize("call_" + sanitizedOperationId)); + + org.openapitools.codegen.utils.StringUtils.camelize("call_" + sanitizedOperationId)); sanitizedOperationId = "call_" + sanitizedOperationId; } // operationId starts with a number if (sanitizedOperationId.matches("^\\d.*")) { - LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize("call_" + sanitizedOperationId)); + LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("call_" + sanitizedOperationId)); sanitizedOperationId = "call_" + sanitizedOperationId; } - return camelize(sanitizedOperationId); + return org.openapitools.codegen.utils.StringUtils.camelize(sanitizedOperationId); } @Override @@ -329,7 +341,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege List operations = (List) objectMap.get("operation"); for (CodegenOperation operation : operations) { // http method verb conversion (e.g. PUT => Put) - operation.httpMethod = camelize(operation.httpMethod.toLowerCase(Locale.ROOT)); + operation.httpMethod = org.openapitools.codegen.utils.StringUtils.camelize(operation.httpMethod.toLowerCase(Locale.ROOT)); } // remove model imports to avoid error @@ -371,8 +383,8 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege } } - // import "optionals" package if the parameter is primitive and optional - if (!param.required && param.isPrimitiveType) { + // import "optionals" package if the parameter is optional + if (!param.required) { if (!addedOptionalImport) { imports.add(createMapping("import", "github.com/antihax/optional")); addedOptionalImport = true; @@ -560,7 +572,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege } // string - String enumName = sanitizeName(underscore(name).toUpperCase(Locale.ROOT)); + String enumName = sanitizeName(org.openapitools.codegen.utils.StringUtils.underscore(name).toUpperCase(Locale.ROOT)); enumName = enumName.replaceFirst("^_", ""); enumName = enumName.replaceFirst("_$", ""); @@ -575,7 +587,7 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege @Override public String toEnumName(CodegenProperty property) { - String enumName = underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); + String enumName = org.openapitools.codegen.utils.StringUtils.underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); // remove [] for array or map of enum enumName = enumName.replace("[]", ""); @@ -603,4 +615,46 @@ public abstract class AbstractGoCodegen extends DefaultCodegen implements Codege return null; } } + + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String goPostProcessFile = System.getenv("GO_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(goPostProcessFile)) { + return; // skip if GO_POST_PROCESS_FILE env variable is not defined + } + + // only procees the following type (or we can simply rely on the file extension to check if it's a Go file) + Set supportedFileType = new HashSet( + Arrays.asList( + "supporting-mustache", + "model-test", + "model", + "api-test", + "api")); + if (!supportedFileType.contains(fileType)) { + return; + } + + // only process files with go extension + if ("go".equals(FilenameUtils.getExtension(file.toString()))) { + // e.g. "gofmt -w yourcode.go" + // e.g. "go fmt path/to/your/package" + String command = goPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } } 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 eb0d56a9470..595df4ebd76 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 @@ -53,6 +53,9 @@ import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; +import static org.openapitools.codegen.utils.StringUtils.escape; + + public abstract class AbstractJavaCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractJavaCodegen.class); @@ -102,6 +105,10 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code protected boolean disableHtmlEscaping = false; protected String booleanGetterPrefix = BOOLEAN_GETTER_PREFIX_DEFAULT; protected boolean useNullForUnknownEnumValue = false; + protected String parentGroupId = ""; + protected String parentArtifactId = ""; + protected String parentVersion = ""; + protected boolean parentOverridden = false; public AbstractJavaCodegen() { super(); @@ -195,6 +202,10 @@ 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)")); cliOptions.add(CliOption.newString(BOOLEAN_GETTER_PREFIX, "Set booleanGetterPrefix (default value '" + BOOLEAN_GETTER_PREFIX_DEFAULT + "')")); + + 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)); + cliOptions.add(CliOption.newString(CodegenConstants.PARENT_VERSION, CodegenConstants.PARENT_VERSION_DESC)); } @Override @@ -372,6 +383,22 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code this.setWithXml(Boolean.valueOf(additionalProperties.get(WITH_XML).toString())); } additionalProperties.put(WITH_XML, withXml); + + if (additionalProperties.containsKey(CodegenConstants.PARENT_GROUP_ID)) { + this.setParentGroupId((String) additionalProperties.get(CodegenConstants.PARENT_GROUP_ID)); + } + + if (additionalProperties.containsKey(CodegenConstants.PARENT_ARTIFACT_ID)) { + this.setParentArtifactId((String) additionalProperties.get(CodegenConstants.PARENT_ARTIFACT_ID)); + } + + if (additionalProperties.containsKey(CodegenConstants.PARENT_VERSION)) { + this.setParentVersion((String) additionalProperties.get(CodegenConstants.PARENT_VERSION)); + } + + if (!StringUtils.isEmpty(parentGroupId) && !StringUtils.isEmpty(parentArtifactId) && !StringUtils.isEmpty(parentVersion)) { + additionalProperties.put("parentOverridden", true); + } // make api and model doc path available in mustache template additionalProperties.put("apiDocPath", apiDocPath); @@ -552,7 +579,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code if (name.length() == 0) { return "DefaultApi"; } - return camelize(name) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override @@ -587,12 +614,12 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code List allowedCharacters = new ArrayList<>(); allowedCharacters.add("_"); allowedCharacters.add("$"); - name = escapeSpecialCharacters(name, allowedCharacters, "_"); + name = escape(name, specialCharReplacements, allowedCharacters, "_"); } // camelize (lower first character) the variable name // pet_id => petId - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -644,7 +671,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code // camelize the model name // phone_number => PhoneNumber - final String camelizedName = camelize(nameWithPrefixSuffix); + final String camelizedName = org.openapitools.codegen.utils.StringUtils.camelize(nameWithPrefixSuffix); // model name cannot use reserved keyword, e.g. return if (isReservedWord(camelizedName)) { @@ -751,7 +778,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code return p.getDefault().toString(); } } - return "null"; + return null; } else if (ModelUtils.isNumberSchema(p)) { if (p.getDefault() != null) { if (SchemaTypeUtil.FLOAT_FORMAT.equals(p.getFormat())) { @@ -760,12 +787,12 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code return p.getDefault().toString() + "d"; } } - return "null"; + return null; } else if (ModelUtils.isBooleanSchema(p)) { if (p.getDefault() != null) { return p.getDefault().toString(); } - return "null"; + return null; } else if (ModelUtils.isStringSchema(p)) { if (p.getDefault() != null) { String _default = (String) p.getDefault(); @@ -776,7 +803,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code return _default; } } - return "null"; + return null; } return super.toDefaultValue(p); } @@ -837,7 +864,18 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code if (example == null) { example = "null"; } else if (Boolean.TRUE.equals(p.isListContainer)) { - example = "Arrays.asList(" + example + ")"; + + if (p.items.defaultValue != null) { + String innerExample; + if ("String".equals(p.items.dataType)) { + innerExample = "\"" + p.items.defaultValue + "\""; + } else { + innerExample = p.items.defaultValue; + } + example = "Arrays.asList(" + innerExample + ")"; + } else { + example = "Arrays.asList()"; + } } else if (Boolean.TRUE.equals(p.isMapContainer)) { example = "new HashMap()"; } @@ -850,7 +888,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code if (p.getExample() != null) { return escapeText(p.getExample().toString()); } else { - return super.toExampleValue(p); + return null; } } @@ -876,19 +914,19 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code throw new RuntimeException("Empty method/operation name (operationId) not allowed"); } - operationId = camelize(sanitizeName(operationId), true); + operationId = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true); // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - String newOperationId = camelize("call_" + operationId, true); + String newOperationId = org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId, true); LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); return newOperationId; } // operationId starts with a number if (operationId.matches("^\\d.*")) { - LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true); - operationId = camelize("call_" + operationId, true); + LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId), true); + operationId = org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId, true); } return operationId; @@ -1039,7 +1077,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code @Override public String toEnumName(CodegenProperty property) { - return sanitizeName(camelize(property.name)) + "Enum"; + return sanitizeName(org.openapitools.codegen.utils.StringUtils.camelize(property.name)) + "Enum"; } @Override @@ -1335,7 +1373,7 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code @Override public String sanitizeTag(String tag) { - tag = camelize(underscore(sanitizeName(tag))); + tag = org.openapitools.codegen.utils.StringUtils.camelize(org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName(tag))); // tag starts with numbers if (tag.matches("^\\d.*")) { @@ -1344,4 +1382,19 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code return tag; } + public void setParentGroupId(final String parentGroupId) { + this.parentGroupId = parentGroupId; + } + + public void setParentArtifactId(final String parentArtifactId) { + this.parentArtifactId = parentArtifactId; + } + + public void setParentVersion(final String parentVersion) { + this.parentVersion = parentVersion; + } + + public void setParentOverridden(final boolean parentOverridden) { + this.parentOverridden = parentOverridden; + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java index e24b1e7bd76..b57ca9e244e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaJAXRSServerCodegen.java @@ -40,6 +40,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; + public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen implements BeanValidationFeatures { public static final String SERVER_PORT = "serverPort"; /** @@ -250,7 +251,7 @@ public abstract class AbstractJavaJAXRSServerCodegen extends AbstractJavaCodegen return "DefaultApi"; } computed = sanitizeName(computed); - return camelize(computed) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(computed) + "Api"; } @Override 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 774c96fe33f..37c5124c9f0 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 @@ -19,6 +19,7 @@ package org.openapitools.codegen.languages; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; +import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenConstants; @@ -28,11 +29,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; -import java.util.Arrays; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Locale; -import java.util.Map; +import java.util.*; + public abstract class AbstractKotlinCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractKotlinCodegen.class); @@ -55,6 +53,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co languageSpecificPrimitives = new HashSet(Arrays.asList( "kotlin.Byte", + "kotlin.ByteArray", "kotlin.Short", "kotlin.Int", "kotlin.Long", @@ -139,6 +138,7 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co defaultIncludes = new HashSet(Arrays.asList( "kotlin.Byte", + "kotlin.ByteArray", "kotlin.Short", "kotlin.Int", "kotlin.Long", @@ -159,21 +159,22 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co typeMapping.put("float", "kotlin.Float"); typeMapping.put("long", "kotlin.Long"); typeMapping.put("double", "kotlin.Double"); + typeMapping.put("ByteArray", "kotlin.ByteArray"); typeMapping.put("number", "java.math.BigDecimal"); typeMapping.put("date-time", "java.time.LocalDateTime"); typeMapping.put("date", "java.time.LocalDateTime"); typeMapping.put("file", "java.io.File"); typeMapping.put("array", "kotlin.Array"); - typeMapping.put("list", "kotlin.Array"); + typeMapping.put("list", "kotlin.collections.List"); typeMapping.put("map", "kotlin.collections.Map"); typeMapping.put("object", "kotlin.Any"); typeMapping.put("binary", "kotlin.Array"); typeMapping.put("Date", "java.time.LocalDateTime"); typeMapping.put("DateTime", "java.time.LocalDateTime"); - instantiationTypes.put("array", "arrayOf"); - instantiationTypes.put("list", "arrayOf"); - instantiationTypes.put("map", "mapOf"); + instantiationTypes.put("array", "kotlin.arrayOf"); + instantiationTypes.put("list", "kotlin.arrayOf"); + instantiationTypes.put("map", "kotlin.mapOf"); importMapping = new HashMap(); importMapping.put("BigDecimal", "java.math.BigDecimal"); @@ -400,16 +401,16 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co break; case camelCase: // NOTE: Removes hyphens and underscores - modified = camelize(modified, true); + modified = org.openapitools.codegen.utils.StringUtils.camelize(modified, true); break; case PascalCase: // NOTE: Removes hyphens and underscores - String result = camelize(modified); + String result = org.openapitools.codegen.utils.StringUtils.camelize(modified); modified = titleCase(result); break; case snake_case: // NOTE: Removes hyphens - modified = underscore(modified); + modified = org.openapitools.codegen.utils.StringUtils.underscore(modified); break; case UPPERCASE: modified = modified.toUpperCase(Locale.ROOT); @@ -471,15 +472,55 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co modifiedName = sanitizeKotlinSpecificNames(modifiedName); // Camelize name of nested properties - modifiedName = camelize(modifiedName); + modifiedName = org.openapitools.codegen.utils.StringUtils.camelize(modifiedName); - if (reservedWords.contains(modifiedName)) { - modifiedName = escapeReservedWord(modifiedName); + // model name cannot use reserved keyword, e.g. return + if (isReservedWord(modifiedName)) { + final String modelName = "Model" + modifiedName; + LOGGER.warn(modifiedName + " (reserved word) cannot be used as model name. Renamed to " + modelName); + return modelName; + } + + // model name starts with number + if (modifiedName.matches("^\\d.*")) { + final String modelName = "Model" + modifiedName; // e.g. 200Response => Model200Response (after camelize) + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName); + return modelName; } return titleCase(modifiedName); } + /** + * Return the operation ID (method name) + * + * @param operationId operation ID + * @return the sanitized method name + */ + @Override + public String toOperationId(String operationId) { + // throw exception if method name is empty + if (StringUtils.isEmpty(operationId)) + throw new RuntimeException("Empty method/operation name (operationId) not allowed"); + + operationId = camelize(sanitizeName(operationId), true); + + // method name cannot use reserved keyword, e.g. return + if (isReservedWord(operationId)) { + String newOperationId = camelize("call_" + operationId, true); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); + return newOperationId; + } + + // operationId starts with a number + if (operationId.matches("^\\d.*")) { + LOGGER.warn(operationId + " (starting with a number) cannot be used as method sname. Renamed to " + camelize("call_" + operationId), true); + operationId = camelize("call_" + operationId, true); + } + + return operationId; + } + @Override public String toModelFilename(String name) { // Should be the same as the model name @@ -577,4 +618,70 @@ public abstract class AbstractKotlinCodegen extends DefaultCodegen implements Co public boolean isDataTypeString(final String dataType) { return "String".equals(dataType) || "kotlin.String".equals(dataType); } + + @Override + public String toParamName(String name) { + // to avoid conflicts with 'callback' parameter for async call + if ("callback".equals(name)) { + return "paramCallback"; + } + + // should be the same as variable name + return toVarName(name); + } + + @Override + public String toVarName(String name) { + // sanitize name + name = sanitizeName(name, "\\W-[\\$]"); + + if (name.toLowerCase(Locale.ROOT).matches("^_*class$")) { + return "propertyClass"; + } + + if ("_".equals(name)) { + name = "_u"; + } + + // if it's all uppper case, do nothing + if (name.matches("^[A-Z_]*$")) { + return name; + } + + if (startsWithTwoUppercaseLetters(name)) { + name = name.substring(0, 2).toLowerCase(Locale.ROOT) + name.substring(2); + } + + // If name contains special chars -> replace them. + if ((name.chars().anyMatch(character -> specialCharReplacements.keySet().contains("" + ((char) character))))) { + List allowedCharacters = new ArrayList<>(); + allowedCharacters.add("_"); + allowedCharacters.add("$"); + name = escapeSpecialCharacters(name, allowedCharacters, "_"); + } + + // camelize (lower first character) the variable name + // pet_id => petId + name = camelize(name, true); + + // for reserved word or word starting with number or containing dollar symbol, escape it + if (isReservedWord(name) || name.matches("(^\\d.*)|(.*[$].*)")) { + name = escapeReservedWord(name); + } + + return name; + } + + @Override + public String toRegularExpression(String pattern) { + return escapeText(pattern); + } + + private boolean startsWithTwoUppercaseLetters(String name) { + boolean startsWithTwoUppercaseLetters = false; + if (name.length() > 1) { + startsWithTwoUppercaseLetters = name.substring(0, 2).equals(name.substring(0, 2).toUpperCase(Locale.ROOT)); + } + return startsWithTwoUppercaseLetters; + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java index 98161179c1c..2490293204d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPhpCodegen.java @@ -40,6 +40,12 @@ import java.util.Locale; import java.util.Map; import java.util.regex.Matcher; +import org.apache.commons.lang3.StringUtils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + + public abstract class AbstractPhpCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractPhpCodegen.class); @@ -63,6 +69,9 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg protected String variableNamingConvention = "snake_case"; protected String apiDocPath = docsBasePath + File.separator + apiDirName; protected String modelDocPath = docsBasePath + File.separator + modelDirName; + protected String interfaceNamePrefix = "", interfaceNameSuffix = "Interface"; + protected String abstractNamePrefix = "Abstract", abstractNameSuffix = ""; + protected String traitNamePrefix = "", traitNameSuffix = "Trait"; public AbstractPhpCodegen() { super(); @@ -235,6 +244,14 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg // make test path available in mustache template additionalProperties.put("testBasePath", testBasePath); + // make class prefixes and suffixes available in mustache templates + additionalProperties.put("interfaceNamePrefix", interfaceNamePrefix); + additionalProperties.put("interfaceNameSuffix", interfaceNameSuffix); + additionalProperties.put("abstractNamePrefix", abstractNamePrefix); + additionalProperties.put("abstractNameSuffix", abstractNameSuffix); + additionalProperties.put("traitNamePrefix", traitNamePrefix); + additionalProperties.put("traitNameSuffix", traitNameSuffix); + // apache v2 license // supportingFiles.add(new SupportingFile("LICENSE", "", "LICENSE")); @@ -408,11 +425,11 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg if ("camelCase".equals(variableNamingConvention)) { // return the name in camelCase style // phone_number => phoneNumber - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); } else { // default to snake case // return the name in underscore style // PhoneNumber => phone_number - name = underscore(name); + name = org.openapitools.codegen.utils.StringUtils.underscore(name); } // parameter name starting with number won't compile @@ -443,13 +460,13 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg // model name cannot use reserved keyword if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. return => ModelReturn (after camelize) } // model name starts with number if (name.matches("^\\d.*")) { - LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } @@ -466,7 +483,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override @@ -481,6 +498,36 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg return toModelName(name) + "Test"; } + /** + * Output the proper interface name (capitalized). + * + * @param name the name of the interface + * @return capitalized model name + */ + public String toInterfaceName(final String name) { + return org.openapitools.codegen.utils.StringUtils.camelize(interfaceNamePrefix + name + interfaceNameSuffix); + } + + /** + * Output the proper abstract class name (capitalized). + * + * @param name the name of the class + * @return capitalized abstract class name + */ + public String toAbstractName(final String name) { + return org.openapitools.codegen.utils.StringUtils.camelize(abstractNamePrefix + name + abstractNameSuffix); + } + + /** + * Output the proper trait name (capitalized). + * + * @param name the name of the trait + * @return capitalized trait name + */ + public String toTraitName(final String name) { + return org.openapitools.codegen.utils.StringUtils.camelize(traitNamePrefix + name + traitNameSuffix); + } + @Override public String toOperationId(String operationId) { // throw exception if method name is empty @@ -490,17 +537,17 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true)); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId), true)); operationId = "call_" + operationId; } // operationId starts with a number if (operationId.matches("^\\d.*")) { - LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true)); + LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId), true)); operationId = "call_" + operationId; } - return camelize(sanitizeName(operationId), true); + return org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true); } /** @@ -638,7 +685,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg } // string - String enumName = sanitizeName(underscore(name).toUpperCase(Locale.ROOT)); + String enumName = sanitizeName(org.openapitools.codegen.utils.StringUtils.underscore(name).toUpperCase(Locale.ROOT)); enumName = enumName.replaceFirst("^_", ""); enumName = enumName.replaceFirst("_$", ""); @@ -651,7 +698,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg @Override public String toEnumName(CodegenProperty property) { - String enumName = underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); + String enumName = org.openapitools.codegen.utils.StringUtils.underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); // remove [] for array or map of enum enumName = enumName.replace("[]", ""); @@ -676,7 +723,7 @@ public abstract class AbstractPhpCodegen extends DefaultCodegen implements Codeg for (CodegenOperation op : operationList) { // for API test method name // e.g. public function test{{vendorExtensions.x-testOperationId}}() - op.vendorExtensions.put("x-testOperationId", camelize(op.operationId)); + op.vendorExtensions.put("x-testOperationId", org.openapitools.codegen.utils.StringUtils.camelize(op.operationId)); } return objs; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractRubyCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractRubyCodegen.java index b26a99dd43b..42f5d8a54ba 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractRubyCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractRubyCodegen.java @@ -17,6 +17,8 @@ package org.openapitools.codegen.languages; +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; import org.openapitools.codegen.CodegenConfig; @@ -25,9 +27,11 @@ import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; import java.util.Arrays; import java.util.Locale; + abstract class AbstractRubyCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractRubyCodegen.class); @@ -76,6 +80,15 @@ abstract class AbstractRubyCodegen extends DefaultCodegen implements CodegenConf typeMapping.put("UUID", "String"); } + @Override + public void processOpts() { + super.processOpts(); + + if (StringUtils.isEmpty(System.getenv("RUBY_POST_PROCESS_FILE"))) { + LOGGER.info("Hint: Environment variable 'RUBY_POST_PROCESS_FILE' (optional) not defined. E.g. to format the source code, please try 'export RUBY_POST_PROCESS_FILE=\"/usr/local/bin/rubocop -a\"' (Linux/Mac)"); + } + } + @Override public String escapeReservedWord(String name) { if (this.reservedWordsMappings().containsKey(name)) { @@ -123,7 +136,7 @@ abstract class AbstractRubyCodegen extends DefaultCodegen implements CodegenConf // camelize (lower first character) the variable name // petId => pet_id - name = underscore(name); + name = org.openapitools.codegen.utils.StringUtils.underscore(name); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -143,12 +156,12 @@ abstract class AbstractRubyCodegen extends DefaultCodegen implements CodegenConf public String toOperationId(String operationId) { // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - String newOperationId = underscore("call_" + operationId); + String newOperationId = org.openapitools.codegen.utils.StringUtils.underscore("call_" + operationId); LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); return newOperationId; } - return underscore(operationId); + return org.openapitools.codegen.utils.StringUtils.underscore(operationId); } @Override @@ -161,4 +174,30 @@ abstract class AbstractRubyCodegen extends DefaultCodegen implements CodegenConf public String escapeUnsafeCharacters(String input) { return input.replace("=end", "=_end").replace("=begin", "=_begin"); } + + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + String rubyPostProcessFile = System.getenv("RUBY_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(rubyPostProcessFile)) { + return; // skip if RUBY_POST_PROCESS_FILE env variable is not defined + } + // only process files with rb extension + if ("rb".equals(FilenameUtils.getExtension(file.toString()))) { + String command = rubyPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java index 05b9f4dea4e..0a4bc642e29 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java @@ -21,6 +21,7 @@ import com.samskivert.mustache.Escapers; import com.samskivert.mustache.Mustache; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConstants; @@ -35,6 +36,7 @@ import java.util.Iterator; import java.util.List; import java.util.Map; + public abstract class AbstractScalaCodegen extends DefaultCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractScalaCodegen.class); @@ -112,6 +114,10 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen { public void processOpts() { super.processOpts(); + if (StringUtils.isEmpty(System.getenv("SCALA_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable SCALA_POST_PROCESS_FILE not defined so the Scala code may not be properly formatted. To define it, try 'export SCALA_POST_PROCESS_FILE=/usr/local/bin/scalafmt' (Linux/Mac)"); + } + if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); } @@ -273,7 +279,7 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen { } protected String formatIdentifier(String name, boolean capitalized) { - String identifier = camelize(sanitizeName(name), true); + String identifier = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(name), true); if (capitalized) { identifier = StringUtils.capitalize(identifier); } @@ -297,4 +303,32 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen { return input.replace("\"", ""); } + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String scalaPostProcessFile = System.getenv("SCALA_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(scalaPostProcessFile)) { + return; // skip if SCALA_POST_PROCESS_FILE env variable is not defined + } + + // only process files with scala extension + if ("scala".equals(FilenameUtils.getExtension(file.toString()))) { + String command = scalaPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } + } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java index 491fdf0b03e..3023e83afcf 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -20,6 +20,7 @@ package org.openapitools.codegen.languages; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.parameters.Parameter; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.utils.ModelUtils; @@ -28,6 +29,9 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractTypeScriptClientCodegen.class); @@ -47,7 +51,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp importMapping.clear(); supportsInheritance = true; - + // NOTE: TypeScript uses camel cased reserved words, while models are title cased. We don't want lowercase comparisons. reservedWords.addAll(Arrays.asList( // local variable names used in API methods (endpoints) @@ -97,6 +101,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp typeMapping.put("object", "any"); typeMapping.put("integer", "number"); typeMapping.put("Map", "any"); + typeMapping.put("map", "any"); typeMapping.put("date", "string"); typeMapping.put("DateTime", "Date"); typeMapping.put("binary", "any"); @@ -114,6 +119,10 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp public void processOpts() { super.processOpts(); + if (StringUtils.isEmpty(System.getenv("TS_POST_PROCESS_FILE"))) { + LOGGER.info("Hint: Environment variable 'TS_POST_PROCESS_FILE' (optional) not defined. E.g. to format the source code, please try 'export TS_POST_PROCESS_FILE=\"/usr/local/bin/prettier --write\"' (Linux/Mac)"); + } + if (additionalProperties.containsKey(CodegenConstants.MODEL_PROPERTY_NAMING)) { setModelPropertyNaming((String) additionalProperties.get(CodegenConstants.MODEL_PROPERTY_NAMING)); } @@ -149,12 +158,6 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp @Override public String toParamName(String name) { - // should be the same as variable name - return toVarName(name); - } - - @Override - public String toVarName(String name) { // sanitize name name = sanitizeName(name, "\\W-[\\$]"); @@ -177,6 +180,33 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp return name; } + @Override + public String toVarName(String name) { + name = this.toParamName(name); + + // if the proprty name has any breaking characters such as :, ;, . etc. + // then wrap the name within single quotes. + // my:interface:property: string; => 'my:interface:property': string; + if (propertyHasBreakingCharacters(name)) { + name = "\'" + name + "\'"; + } + + return name; + } + + /** + * Checks whether property names have breaking characters like ':', '-'. + * @param str string to check for breaking characters + * @return true if breaking characters are present and false if not + */ + private boolean propertyHasBreakingCharacters(String str) { + final String regex = "^.*[+*:;,.()-]+.*$"; + final Pattern pattern = Pattern.compile(regex); + final Matcher matcher = pattern.matcher(str); + boolean matches = matcher.matches(); + return matches; + } + @Override public String toModelName(String name) { name = sanitizeName(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. @@ -191,27 +221,27 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - String modelName = camelize("model_" + name); + String modelName = org.openapitools.codegen.utils.StringUtils.camelize("model_" + name); LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + modelName); return modelName; } // model name starts with number if (name.matches("^\\d.*")) { - String modelName = camelize("model_" + name); // e.g. 200Response => Model200Response (after camelize) + String modelName = org.openapitools.codegen.utils.StringUtils.camelize("model_" + name); // e.g. 200Response => Model200Response (after camelize) LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + modelName); return modelName; } if (languageSpecificPrimitives.contains(name)) { - String modelName = camelize("model_" + name); + String modelName = org.openapitools.codegen.utils.StringUtils.camelize("model_" + name); LOGGER.warn(name + " (model name matches existing language type) cannot be used as a model name. Renamed to " + modelName); return modelName; } // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override @@ -326,10 +356,10 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp } else if (ModelUtils.isDateTimeSchema(p)) { return UNDEFINED_VALUE; } else if (ModelUtils.isNumberSchema(p)) { - if (p.getDefault() != null) { - return p.getDefault().toString(); - } - return UNDEFINED_VALUE; + if (p.getDefault() != null) { + return p.getDefault().toString(); + } + return UNDEFINED_VALUE; } else if (ModelUtils.isIntegerSchema(p)) { if (p.getDefault() != null) { return p.getDefault().toString(); @@ -345,7 +375,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp } } - + @Override protected boolean isReservedWord(String word) { // NOTE: This differs from super's implementation in that TypeScript does _not_ want case insensitive matching. @@ -375,10 +405,10 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp // method name cannot use reserved keyword, e.g. return // append _ at the beginning, e.g. _return if (isReservedWord(operationId)) { - return escapeReservedWord(camelize(sanitizeName(operationId), true)); + return escapeReservedWord(org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true)); } - return camelize(sanitizeName(operationId), true); + return org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true); } public void setModelPropertyNaming(String naming) { @@ -401,11 +431,11 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp case original: return name; case camelCase: - return camelize(name, true); + return org.openapitools.codegen.utils.StringUtils.camelize(name, true); case PascalCase: - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); case snake_case: - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); default: throw new IllegalArgumentException("Invalid model property naming '" + name + "'. Must be 'original', 'camelCase', " + @@ -436,7 +466,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp // for symbol, e.g. $, # if (getSymbolName(name) != null) { - return camelize(getSymbolName(name)); + return org.openapitools.codegen.utils.StringUtils.camelize(getSymbolName(name)); } // number @@ -456,7 +486,7 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp // camelize the enum variable name // ref: https://basarat.gitbooks.io/typescript/content/docs/enums.html - enumName = camelize(enumName); + enumName = org.openapitools.codegen.utils.StringUtils.camelize(enumName); if (enumName.matches("\\d.*")) { // starts with number return "_" + enumName; @@ -559,4 +589,32 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp public String escapeUnsafeCharacters(String input) { return input.replace("*/", "*_/").replace("/*", "/_*"); } + + @Override + public void postProcessFile(File file, String fileType) { + super.postProcessFile(file, fileType); + + if (file == null) { + return; + } + String tsPostProcessFile = System.getenv("TS_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(tsPostProcessFile)) { + return; // skip if TS_POST_PROCESS_FILE env variable is not defined + } + // only process files with ts extension + if ("ts".equals(FilenameUtils.getExtension(file.toString()))) { + String command = tsPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AndroidClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AndroidClientCodegen.java index ea267ac8cb8..6c2a10ce57c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AndroidClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AndroidClientCodegen.java @@ -36,6 +36,7 @@ import java.io.File; import java.util.Arrays; import java.util.HashSet; + public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(AndroidClientCodegen.class); public static final String USE_ANDROID_MAVEN_GRADLE_PLUGIN = "useAndroidMavenGradlePlugin"; @@ -228,7 +229,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi // camelize (lower first character) the variable name // pet_id => petId - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -257,7 +258,7 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi // camelize the model name // phone_number => PhoneNumber - name = camelize(sanitizeName(name)); + name = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(name)); // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { @@ -354,11 +355,11 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi throw new RuntimeException("Empty method name (operationId) not allowed"); } - operationId = camelize(sanitizeName(operationId), true); + operationId = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true); // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - String newOperationId = camelize("call_" + operationId, true); + String newOperationId = org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId, true); LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); return newOperationId; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ApexClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ApexClientCodegen.java index 66dcb89a522..65e0299062c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ApexClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ApexClientCodegen.java @@ -29,6 +29,7 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.util.*; + public class ApexClientCodegen extends AbstractApexCodegen { private static final String CLASS_PREFIX = "classPrefix"; @@ -191,7 +192,7 @@ public class ApexClientCodegen extends AbstractApexCodegen { @Override public String toApiName(String name) { - return camelize(classPrefix + super.toApiName(name)); + return org.openapitools.codegen.utils.StringUtils.camelize(classPrefix + super.toApiName(name)); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java index 2ae16f32581..fe873112901 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AspNetCoreServerCodegen.java @@ -28,6 +28,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; +import java.lang.IllegalArgumentException; import java.net.URL; import java.util.Arrays; import java.util.Locale; @@ -38,6 +39,7 @@ import static java.util.UUID.randomUUID; public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { public static final String USE_SWASHBUCKLE = "useSwashbuckle"; + public static final String ASPNET_CORE_VERSION = "aspnetCoreVersion"; private String packageGuid = "{" + randomUUID().toString().toUpperCase(Locale.ROOT) + "}"; @@ -47,7 +49,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { private boolean useSwashbuckle = true; protected int serverPort = 8080; protected String serverHost = "0.0.0.0"; - + protected String aspnetCoreVersion= "2.1"; // default to 2.1 public AspNetCoreServerCodegen() { super(); @@ -57,6 +59,8 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { modelTemplateFiles.put("model.mustache", ".cs"); apiTemplateFiles.put("controller.mustache", ".cs"); + embeddedTemplateDir = templateDir = "aspnetcore/2.1"; + // contextually reserved words // NOTE: C# uses camel cased reserved words, while models are title cased. We don't want lowercase comparisons. reservedWords.addAll( @@ -82,6 +86,10 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { CodegenConstants.SOURCE_FOLDER_DESC, sourceFolder); + addOption(ASPNET_CORE_VERSION, + "ASP.NET Core version: 2.1 (default), 2.0 (deprecated)", + aspnetCoreVersion); + // CLI Switches addSwitch(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG_DESC, @@ -102,6 +110,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { addSwitch(USE_SWASHBUCKLE, "Uses the Swashbuckle.AspNetCore NuGet package for documentation.", useSwashbuckle); + } @Override @@ -118,6 +127,7 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { public String getHelp() { return "Generates an ASP.NET Core Web API server."; } + @Override public void preprocessOpenAPI(OpenAPI openAPI) { super.preprocessOpenAPI(openAPI); @@ -141,6 +151,11 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { additionalProperties.put(USE_SWASHBUCKLE, useSwashbuckle); } + // determine the ASP.NET core version setting + if (additionalProperties.containsKey(ASPNET_CORE_VERSION)) { + setAspnetCoreVersion((String) additionalProperties.get(ASPNET_CORE_VERSION)); + } + additionalProperties.put("dockerTag", packageName.toLowerCase(Locale.ROOT)); apiPackage = packageName + ".Controllers"; @@ -148,6 +163,17 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { String packageFolder = sourceFolder + File.separator + packageName; + if ("2.0".equals(aspnetCoreVersion)) { + embeddedTemplateDir = templateDir = "aspnetcore/2.0"; + supportingFiles.add(new SupportingFile("web.config", packageFolder, "web.config")); + LOGGER.info("ASP.NET core version: 2.0"); + } else if ("2.1".equals(aspnetCoreVersion)) { + // default, do nothing + LOGGER.info("ASP.NET core version: 2.1"); + } else { + throw new IllegalArgumentException("aspnetCoreVersion must be '2.1', '2.0' but found " + aspnetCoreVersion); + } + supportingFiles.add(new SupportingFile("build.sh.mustache", "", "build.sh")); supportingFiles.add(new SupportingFile("build.bat.mustache", "", "build.bat")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); @@ -159,28 +185,34 @@ public class AspNetCoreServerCodegen extends AbstractCSharpCodegen { supportingFiles.add(new SupportingFile("Startup.mustache", packageFolder, "Startup.cs")); supportingFiles.add(new SupportingFile("Program.mustache", packageFolder, "Program.cs")); supportingFiles.add(new SupportingFile("validateModel.mustache", packageFolder + File.separator + "Attributes", "ValidateModelStateAttribute.cs")); - supportingFiles.add(new SupportingFile("web.config", packageFolder, "web.config")); - supportingFiles.add(new SupportingFile("Project.csproj.mustache", packageFolder, packageName + ".csproj")); - supportingFiles.add(new SupportingFile("Properties" + File.separator + "launchSettings.json", packageFolder + File.separator + "Properties", "launchSettings.json")); + supportingFiles.add(new SupportingFile("Properties" + File.separator + "launchSettings.json", + packageFolder + File.separator + "Properties", "launchSettings.json")); if (useSwashbuckle) { - supportingFiles.add(new SupportingFile("Filters" + File.separator + "BasePathFilter.mustache", packageFolder + File.separator + "Filters", "BasePathFilter.cs")); - supportingFiles.add(new SupportingFile("Filters" + File.separator + "GeneratePathParamsValidationFilter.mustache", packageFolder + File.separator + "Filters", "GeneratePathParamsValidationFilter.cs")); + supportingFiles.add(new SupportingFile("Filters" + File.separator + "BasePathFilter.mustache", + packageFolder + File.separator + "Filters", "BasePathFilter.cs")); + supportingFiles.add(new SupportingFile("Filters" + File.separator + "GeneratePathParamsValidationFilter.mustache", + packageFolder + File.separator + "Filters", "GeneratePathParamsValidationFilter.cs")); } supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "README.md", packageFolder + File.separator + "wwwroot", "README.md")); supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "index.html", packageFolder + File.separator + "wwwroot", "index.html")); supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "web.config", packageFolder + File.separator + "wwwroot", "web.config")); - supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "openapi-original.mustache", packageFolder + File.separator + "wwwroot", "openapi-original.json")); + supportingFiles.add(new SupportingFile("wwwroot" + File.separator + "openapi-original.mustache", + packageFolder + File.separator + "wwwroot", "openapi-original.json")); } public void setPackageGuid(String packageGuid) { this.packageGuid = packageGuid; } + public void setAspnetCoreVersion(String aspnetCoreVersion) { + this.aspnetCoreVersion= aspnetCoreVersion; + } + @Override public String apiFileFolder() { return outputFolder + File.separator + sourceFolder + File.separator + packageName + File.separator + "Controllers"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java index 470641d928a..f17c354de74 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpClientCodegen.java @@ -17,6 +17,8 @@ package org.openapitools.codegen.languages; +import static org.apache.commons.lang3.StringUtils.isEmpty; + import com.google.common.collect.ImmutableMap; import com.samskivert.mustache.Mustache; import io.swagger.v3.oas.models.media.Schema; @@ -702,7 +704,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { // for symbol, e.g. $, # if (getSymbolName(value) != null) { - return camelize(getSymbolName(value)); + return org.openapitools.codegen.utils.StringUtils.camelize(getSymbolName(value)); } // number @@ -718,7 +720,7 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { // string String var = value.replaceAll("_", " "); //var = WordUtils.capitalizeFully(var); - var = camelize(var); + var = org.openapitools.codegen.utils.StringUtils.camelize(var); var = var.replaceAll("\\W+", ""); if (var.matches("\\d.*")) { @@ -753,11 +755,11 @@ public class CSharpClientCodegen extends AbstractCSharpCodegen { case original: return name; case camelCase: - return camelize(name, true); + return org.openapitools.codegen.utils.StringUtils.camelize(name, true); case PascalCase: - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); case snake_case: - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); default: throw new IllegalArgumentException("Invalid model property naming '" + name + "'. Must be 'original', 'camelCase', " + diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNancyFXServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNancyFXServerCodegen.java index be5147d3dac..25106c48eee 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNancyFXServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CSharpNancyFXServerCodegen.java @@ -36,6 +36,7 @@ import org.openapitools.codegen.utils.URLPathUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import java.io.File; import java.net.URL; import java.util.ArrayList; @@ -332,7 +333,7 @@ public class CSharpNancyFXServerCodegen extends AbstractCSharpCodegen { return "Empty"; } - final String enumName = camelize( + final String enumName = org.openapitools.codegen.utils.StringUtils.camelize( sanitizeName(name) .replaceFirst("^_", "") .replaceFirst("_$", "") @@ -399,7 +400,7 @@ public class CSharpNancyFXServerCodegen extends AbstractCSharpCodegen { @Override public String toEnumName(final CodegenProperty property) { - return sanitizeName(camelize(property.name)) + "Enum"; + return sanitizeName(org.openapitools.codegen.utils.StringUtils.camelize(property.name)) + "Enum"; } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java index b97d62d7ca1..9c64b235a62 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ClojureClientCodegen.java @@ -28,6 +28,7 @@ import org.openapitools.codegen.utils.ModelUtils; import java.io.File; import java.util.*; + public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfig { private static final String PROJECT_NAME = "projectName"; private static final String PROJECT_DESCRIPTION = "projectDescription"; @@ -167,12 +168,6 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi return dashize(name); } - @Override - public String toVarName(String name) { - name = name.replaceAll("[^a-zA-Z0-9_-]+", ""); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. - return name; - } - @Override public CodegenModel fromModel(String name, Schema mod, Map allDefinitions) { CodegenModel model = super.fromModel(name, mod, allDefinitions); @@ -220,7 +215,7 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi Info info = openAPI.getInfo(); if (projectName == null && info.getTitle() != null) { // when projectName is not specified, generate it from info.title - projectName = dashize(info.getTitle()); + projectName = org.openapitools.codegen.utils.StringUtils.dashize(info.getTitle()); } if (projectVersion == null) { // when projectVersion is not specified, use info.version @@ -259,7 +254,7 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi projectDescription = "Client library of " + projectName; } if (baseNamespace == null) { - baseNamespace = dashize(projectName); + baseNamespace = org.openapitools.codegen.utils.StringUtils.dashize(projectName); } apiPackage = baseNamespace + ".api"; modelPackage = baseNamespace + ".specs"; @@ -300,12 +295,12 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi throw new RuntimeException("Empty method/operation name (operationId) not allowed"); } - return dashize(sanitizeName(operationId)); + return org.openapitools.codegen.utils.StringUtils.dashize(sanitizeName(operationId)); } @Override public String toApiFilename(String name) { - return underscore(toApiName(name)); + return org.openapitools.codegen.utils.StringUtils.underscore(toApiName(name)); } @Override @@ -315,7 +310,7 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi @Override public String toApiName(String name) { - return dashize(name); + return org.openapitools.codegen.utils.StringUtils.dashize(name); } @Override @@ -323,6 +318,13 @@ public class ClojureClientCodegen extends DefaultCodegen implements CodegenConfi return toVarName(name); } + @Override + public String toVarName(String name) { + name = name.replaceAll("[^a-zA-Z0-9_-]+", ""); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + name = org.openapitools.codegen.utils.StringUtils.dashize(name); + return name; + } + @Override public String escapeText(String input) { if (input == null) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java index 70ba645a4e6..ec069d483af 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppPistacheServerCodegen.java @@ -41,13 +41,16 @@ import java.util.Locale; import java.util.Map; import java.util.Set; + public class CppPistacheServerCodegen extends AbstractCppCodegen { protected String implFolder = "impl"; protected boolean isAddExternalLibs = true; public static final String OPTIONAL_EXTERNAL_LIB = "addExternalLibs"; public static final String OPTIONAL_EXTERNAL_LIB_DESC = "Add the Possibility to fetch and compile external Libraries needed by this Framework."; + public static final String HELPERS_PACKAGE_NAME = "helpersPackage"; + public static final String HELPERS_PACKAGE_NAME_DESC = "Specify the package name to be used for the helpers (e.g. org.openapitools.server.helpers)."; protected final String PREFIX = ""; - + protected String helpersPackage = ""; @Override public CodegenType getTag() { return CodegenType.SERVER; @@ -69,6 +72,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen { modelNamePrefix = PREFIX; } + helpersPackage = "org.openapitools.server.helpers"; apiPackage = "org.openapitools.server.api"; modelPackage = "org.openapitools.server.model"; @@ -85,11 +89,14 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen { cliOptions.clear(); addSwitch(OPTIONAL_EXTERNAL_LIB, OPTIONAL_EXTERNAL_LIB_DESC, this.isAddExternalLibs); + addOption(HELPERS_PACKAGE_NAME, HELPERS_PACKAGE_NAME_DESC, this.helpersPackage); reservedWords = new HashSet<>(); supportingFiles.add(new SupportingFile("modelbase-header.mustache", "model", modelNamePrefix + "ModelBase.h")); supportingFiles.add(new SupportingFile("modelbase-source.mustache", "model", modelNamePrefix + "ModelBase.cpp")); + supportingFiles.add(new SupportingFile("helpers-header.mustache", "model", modelNamePrefix + "Helpers.h")); + supportingFiles.add(new SupportingFile("helpers-source.mustache", "model", modelNamePrefix + "Helpers.cpp")); supportingFiles.add(new SupportingFile("cmake.mustache", "", "CMakeLists.txt")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); @@ -122,18 +129,26 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen { @Override public void processOpts() { super.processOpts(); + if (additionalProperties.containsKey(HELPERS_PACKAGE_NAME)) { + helpersPackage = (String) additionalProperties.get(HELPERS_PACKAGE_NAME); + } if (additionalProperties.containsKey("modelNamePrefix")) { additionalProperties().put("prefix", modelNamePrefix); supportingFiles.clear(); supportingFiles.add(new SupportingFile("modelbase-header.mustache", "model", modelNamePrefix + "ModelBase.h")); supportingFiles.add(new SupportingFile("modelbase-source.mustache", "model", modelNamePrefix + "ModelBase.cpp")); + supportingFiles.add(new SupportingFile("helpers-header.mustache", "model", modelNamePrefix + "Helpers.h")); + supportingFiles.add(new SupportingFile("helpers-source.mustache", "model", modelNamePrefix + "Helpers.cpp")); supportingFiles.add(new SupportingFile("cmake.mustache", "", "CMakeLists.txt")); supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); } additionalProperties.put("modelNamespaceDeclarations", modelPackage.split("\\.")); additionalProperties.put("modelNamespace", modelPackage.replaceAll("\\.", "::")); additionalProperties.put("apiNamespaceDeclarations", apiPackage.split("\\.")); - additionalProperties.put("apiNamespace", apiPackage.replaceAll("\\.", "::")); + additionalProperties.put("apiNamespace", apiPackage.replaceAll("\\.", "::")); + additionalProperties.put("helpersNamespaceDeclarations", helpersPackage.split("\\.")); + additionalProperties.put("helpersNamespace", helpersPackage.replaceAll("\\.", "::")); + if (additionalProperties.containsKey(OPTIONAL_EXTERNAL_LIB)) { setAddExternalLibs(convertPropertyToBooleanAndWriteBack(OPTIONAL_EXTERNAL_LIB)); } else { @@ -198,8 +213,8 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen { public Map postProcessOperationsWithModels(Map objs, List allModels) { Map operations = (Map) objs.get("operations"); String classname = (String) operations.get("classname"); - operations.put("classnameSnakeUpperCase", DefaultCodegen.underscore(classname).toUpperCase(Locale.ROOT)); - operations.put("classnameSnakeLowerCase", DefaultCodegen.underscore(classname).toLowerCase(Locale.ROOT)); + operations.put("classnameSnakeUpperCase", org.openapitools.codegen.utils.StringUtils.underscore(classname).toUpperCase(Locale.ROOT)); + operations.put("classnameSnakeLowerCase", org.openapitools.codegen.utils.StringUtils.underscore(classname).toLowerCase(Locale.ROOT)); List operationList = (List) operations.get("operation"); for (CodegenOperation op : operationList) { @@ -235,7 +250,7 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen { if (param.isPrimitiveType) { param.dataType = "Pistache::Optional<" + param.dataType + ">"; } else { - param.dataType = "Pistache::Optional<" + param.baseType + ">"; + param.dataType = "Pistache::Optional<" + param.dataType + ">"; param.baseType = "Pistache::Optional<" + param.baseType + ">"; } } @@ -246,11 +261,13 @@ public class CppPistacheServerCodegen extends AbstractCppCodegen { } op.vendorExtensions.put("x-codegen-pistache-consumesJson", consumeJson); op.vendorExtensions.put("x-codegen-pistache-isParsingSupported", isParsingSupported); + + // Check if any one of the operations needs a model, then at API file level, at least one model has to be included. for(String hdr : op.imports) { if(importMapping.containsKey(hdr)) { continue; } - additionalProperties.put("hasModelImport", true); + operations.put("hasModelImport", true); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java index 0d3d963f0f4..e033b7c44b8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5ClientCodegen.java @@ -37,6 +37,7 @@ import java.util.Locale; import java.util.Map; import java.util.Set; + public class CppQt5ClientCodegen extends AbstractCppCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(CppQt5ClientCodegen.class); @@ -380,7 +381,7 @@ public class CppQt5ClientCodegen extends AbstractCppCodegen implements CodegenCo // camelize (lower first character) the variable name // petId => pet_id - varName = underscore(varName); + varName = org.openapitools.codegen.utils.StringUtils.underscore(varName); // for reserved word or word starting with number, append _ if (isReservedWord(varName) || varName.matches("^\\d.*")) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5QHttpEngineServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5QHttpEngineServerCodegen.java index 37f14e75c81..f8e2f760999 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5QHttpEngineServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQt5QHttpEngineServerCodegen.java @@ -23,19 +23,24 @@ import io.swagger.v3.parser.util.SchemaTypeUtil; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenType; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.CodegenParameter; import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Locale; import java.util.Map; import java.util.Set; + public class CppQt5QHttpEngineServerCodegen extends AbstractCppCodegen implements CodegenConfig { @SuppressWarnings("unused") private static final Logger LOGGER = LoggerFactory.getLogger(CppQt5QHttpEngineServerCodegen.class); @@ -55,7 +60,7 @@ public class CppQt5QHttpEngineServerCodegen extends AbstractCppCodegen implement protected Map namespaces = new HashMap(); protected Set systemIncludes = new HashSet(); protected String cppNamespace = "OpenAPI"; - + protected Set nonFrameworkPrimitives = new HashSet(); public CppQt5QHttpEngineServerCodegen() { super(); @@ -120,7 +125,7 @@ public class CppQt5QHttpEngineServerCodegen extends AbstractCppCodegen implement // Write defaults namespace in properties so that it can be accessible in templates. // At this point command line has not been parsed so if value is given - // in command line it will superseed this content + // in command line it will supersede this content additionalProperties.put("cppNamespace", cppNamespace); /* @@ -135,7 +140,17 @@ public class CppQt5QHttpEngineServerCodegen extends AbstractCppCodegen implement "float", "double") ); - + nonFrameworkPrimitives.addAll(languageSpecificPrimitives); + + foundationClasses.addAll( + Arrays.asList( + "QString", + "QDate", + "QDateTime", + "QByteArray") + ); + languageSpecificPrimitives.addAll(foundationClasses); + supportingFiles.add(new SupportingFile("helpers-header.mustache", sourceFolder + MODEL_DIR, PREFIX + "Helpers.h")); supportingFiles.add(new SupportingFile("helpers-body.mustache", sourceFolder + MODEL_DIR, PREFIX + "Helpers.cpp")); supportingFiles.add(new SupportingFile("object.mustache", sourceFolder + MODEL_DIR, PREFIX + "Object.h")); @@ -165,7 +180,7 @@ public class CppQt5QHttpEngineServerCodegen extends AbstractCppCodegen implement // mapped as "file" type for OAS 3.0 typeMapping.put("ByteArray", "QByteArray"); // UUID support - possible enhancement : use QUuid instead of QString. - // beware though that Serialisation/deserialisation of QUuid does not + // beware though that Serialization/deserialization of QUuid does not // come out of the box and will need to be sorted out (at least imply // modifications on multiple templates) typeMapping.put("UUID", "QString"); @@ -174,7 +189,7 @@ public class CppQt5QHttpEngineServerCodegen extends AbstractCppCodegen implement importMapping = new HashMap(); namespaces = new HashMap(); - foundationClasses.add("QString"); + systemIncludes.add("QString"); systemIncludes.add("QList"); @@ -245,7 +260,7 @@ public class CppQt5QHttpEngineServerCodegen extends AbstractCppCodegen implement */ @Override public String getHelp() { - return "Generates a Qt5 C++ Server (beta) using the QHTTPEngine HTTP Library."; + return "Generates a Qt5 C++ Server using the QHTTPEngine HTTP Library."; } @Override @@ -415,7 +430,7 @@ public class CppQt5QHttpEngineServerCodegen extends AbstractCppCodegen implement // camelize (lower first character) the variable name // petId => pet_id - varName = underscore(varName); + varName = org.openapitools.codegen.utils.StringUtils.underscore(varName); // for reserved word or word starting with number, append _ if (isReservedWord(varName) || varName.matches("^\\d.*")) { @@ -434,4 +449,71 @@ public class CppQt5QHttpEngineServerCodegen extends AbstractCppCodegen implement public String getTypeDeclaration(String str) { return str; } + + @Override + protected boolean needToImport(String type) { + return StringUtils.isNotBlank(type) && !defaultIncludes.contains(type) + && !nonFrameworkPrimitives.contains(type); + } + + @Override + @SuppressWarnings("unchecked") + public Map postProcessOperations(Map objs) { + Map objectMap = (Map) objs.get("operations"); + List operations = (List) objectMap.get("operation"); + + List> imports = (List>) objs.get("imports"); + for (CodegenOperation operation : operations) { + // Check all return parameter baseType if there is a necessity to include, include it if not + // already done + if (operation.returnBaseType != null && needToImport(operation.returnBaseType)) { + if(!isIncluded(operation.returnBaseType, imports)) { + imports.add(createMapping("import", operation.returnBaseType)); + } + } + List params = new ArrayList(); + if (operation.allParams != null)params.addAll(operation.allParams); + + // Check all parameter baseType if there is a necessity to include, include it if not + // already done + for(CodegenParameter param : params) { + if(param.isPrimitiveType && needToImport(param.baseType)) { + if(!isIncluded(param.baseType, imports)) { + imports.add(createMapping("import", param.baseType)); + } + } + } + if (operation.pathParams != null) { + // We use QString to pass path params, add it to include + if(!isIncluded("QString", imports)) { + imports.add(createMapping("import", "QString")); + } + } + } + if(isIncluded("QMap", imports)) { + // Maps uses QString as key + if(!isIncluded("QString", imports)) { + imports.add(createMapping("import", "QString")); + } + } + return objs; + } + + public Map createMapping(String key, String value) { + Map customImport = new HashMap(); + customImport.put(key, toModelImport(value)); + return customImport; + } + + private boolean isIncluded(String type, List> imports) { + boolean included = false; + String inclStr = toModelImport(type); + for (Map importItem : imports) { + if(importItem.containsValue(inclStr)) { + included = true; + break; + } + } + return included; + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java index 028eee1467f..d56f614512e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestbedServerCodegen.java @@ -25,15 +25,19 @@ import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.logging.Logger; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.utils.ModelUtils; +import org.slf4j.LoggerFactory; import io.swagger.v3.oas.models.media.*; public class CppRestbedServerCodegen extends AbstractCppCodegen { + private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(CppRestbedServerCodegen.class); + public static final String DECLSPEC = "declspec"; public static final String DEFAULT_INCLUDE = "defaultInclude"; @@ -287,25 +291,63 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen { @Override public String toDefaultValue(Schema p) { if (ModelUtils.isStringSchema(p)) { - return "\"\""; + if (p.getDefault() != null) { + return "\"" + p.getDefault().toString() + "\""; + } else { + return "\"\""; + } } else if (ModelUtils.isBooleanSchema(p)) { - return "false"; + if (p.getDefault() != null) { + return p.getDefault().toString(); + } else { + return "false"; + } } else if (ModelUtils.isDateSchema(p)) { - return "\"\""; + if (p.getDefault() != null) { + return "\"" + p.getDefault().toString() + "\""; + } else { + return "\"\""; + } } else if (ModelUtils.isDateTimeSchema(p)) { - return "\"\""; + if (p.getDefault() != null) { + return "\"" + p.getDefault().toString() + "\""; + } else { + return "\"\""; + } } else if (ModelUtils.isNumberSchema(p)) { - if (ModelUtils.isFloatSchema(p)) { - return "0.0f"; + if (ModelUtils.isFloatSchema(p)) { // float + if (p.getDefault() != null) { + return p.getDefault().toString() + "f"; + } else { + return "0.0f"; + } + } else { // double + if (p.getDefault() != null) { + return p.getDefault().toString(); + } else { + return "0.0"; + } } - return "0.0"; } else if (ModelUtils.isIntegerSchema(p)) { - if (ModelUtils.isLongSchema(p)) { - return "0L"; + if (ModelUtils.isLongSchema(p)) { // long + if (p.getDefault() != null) { + return p.getDefault().toString() + "L"; + } else { + return "0L"; + } + } else { // integer + if (p.getDefault() != null) { + return p.getDefault().toString(); + } else { + return "0"; + } } - return "0"; } else if (ModelUtils.isByteArraySchema(p)) { - return "\"\""; + if (p.getDefault() != null) { + return "\"" + p.getDefault().toString() + "\""; + } else { + return "\"\""; + } } else if (ModelUtils.isMapSchema(p)) { String inner = getSchemaType(ModelUtils.getAdditionalProperties(p)); return "std::map()"; @@ -319,6 +361,7 @@ public class CppRestbedServerCodegen extends AbstractCppCodegen { } else if (!StringUtils.isEmpty(p.get$ref())) { return "new " + toModelName(ModelUtils.getSimpleRef(p.get$ref())) + "()"; } + return "nullptr"; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppTizenClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppTizenClientCodegen.java index 049a906182f..7033661bdd4 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppTizenClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppTizenClientCodegen.java @@ -32,6 +32,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; + public class CppTizenClientCodegen extends AbstractCppCodegen implements CodegenConfig { protected static String PREFIX = "ArtikCloud"; protected String sourceFolder = "src"; @@ -283,7 +284,7 @@ public class CppTizenClientCodegen extends AbstractCppCodegen implements Codegen } // add_pet_by_id => addPetById - return camelize(operationId, true); + return org.openapitools.codegen.utils.StringUtils.camelize(operationId, true); } /** * Output the Getter name for boolean property, e.g. getActive diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java index d2d83170d94..55221e3a226 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartClientCodegen.java @@ -28,6 +28,8 @@ import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.utils.ModelUtils; import io.swagger.v3.oas.models.media.*; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.io.FilenameUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -38,6 +40,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(DartClientCodegen.class); @@ -47,6 +50,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { public static final String PUB_VERSION = "pubVersion"; public static final String PUB_DESCRIPTION = "pubDescription"; public static final String USE_ENUM_EXTENSION = "useEnumExtension"; + public static final String SUPPORT_DART2 = "supportDart2"; protected boolean browserClient = true; protected String pubName = "openapi"; protected String pubVersion = "1.0.0"; @@ -124,6 +128,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { cliOptions.add(new CliOption(PUB_DESCRIPTION, "Description in generated pubspec")); cliOptions.add(new CliOption(USE_ENUM_EXTENSION, "Allow the 'x-enum-values' extension for enums")); cliOptions.add(new CliOption(CodegenConstants.SOURCE_FOLDER, "source folder for generated code")); + cliOptions.add(CliOption.newBoolean(SUPPORT_DART2, "support dart2").defaultValue(Boolean.TRUE.toString())); } @Override @@ -138,13 +143,17 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String getHelp() { - return "Generates a Dart client library."; + return "Generates a Dart (1.x or 2.x) client library."; } @Override public void processOpts() { super.processOpts(); + if (StringUtils.isEmpty(System.getenv("DART_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable DART_POST_PROCESS_FILE not defined so the Dart code may not be properly formatted. To define it, try `export DART_POST_PROCESS_FILE=\"/usr/local/bin/dartfmt -w\"` (Linux/Mac)"); + } + if (additionalProperties.containsKey(BROWSER_CLIENT)) { this.setBrowserClient(convertPropertyToBooleanAndWriteBack(BROWSER_CLIENT)); } else { @@ -188,9 +197,19 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { additionalProperties.put("apiDocPath", apiDocPath); additionalProperties.put("modelDocPath", modelDocPath); + final Object isSupportDart2 = additionalProperties.get(SUPPORT_DART2); + if (Boolean.FALSE.equals(isSupportDart2) || (isSupportDart2 instanceof String && !Boolean.parseBoolean((String) isSupportDart2))) { + // dart 1.x + LOGGER.info("Dart version: 1.x"); + supportingFiles.add(new SupportingFile("analysis_options.mustache", "", ".analysis_options")); + } else { + // dart 2.x + LOGGER.info("Dart version: 2.x"); + embeddedTemplateDir = templateDir = "dart2"; + } + final String libFolder = sourceFolder + File.separator + "lib"; supportingFiles.add(new SupportingFile("pubspec.mustache", "", "pubspec.yaml")); - supportingFiles.add(new SupportingFile("analysis_options.mustache", "", ".analysis_options")); supportingFiles.add(new SupportingFile("api_client.mustache", libFolder, "api_client.dart")); supportingFiles.add(new SupportingFile("api_exception.mustache", libFolder, "api_exception.dart")); supportingFiles.add(new SupportingFile("api_helper.mustache", libFolder, "api_helper.dart")); @@ -243,7 +262,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { // camelize (lower first character) the variable name // pet_id => petId - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); if (name.matches("^\\d.*")) { name = "n" + name; @@ -266,23 +285,23 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { public String toModelName(String name) { // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. return => ModelReturn (after camelize) } // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override public String toModelFilename(String name) { - return underscore(toModelName(name)); + return org.openapitools.codegen.utils.StringUtils.underscore(toModelName(name)); } @Override public String toApiFilename(String name) { - return underscore(toApiName(name)); + return org.openapitools.codegen.utils.StringUtils.underscore(toApiName(name)); } @Override @@ -401,7 +420,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { new ArrayList>(); for (Map value : values) { Map enumVar = new HashMap(); - String name = camelize((String) value.get("identifier"), true); + String name = org.openapitools.codegen.utils.StringUtils.camelize((String) value.get("identifier"), true); if (isReservedWord(name)) { name = escapeReservedWord(name); } @@ -427,7 +446,7 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { "int".equalsIgnoreCase(datatype)) { var = "Number" + var; } - return escapeReservedWord(camelize(var, true)); + return escapeReservedWord(org.openapitools.codegen.utils.StringUtils.camelize(var, true)); } @Override @@ -444,12 +463,12 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { public String toOperationId(String operationId) { // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - String newOperationId = camelize("call_" + operationId, true); + String newOperationId = org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId, true); LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); return newOperationId; } - return camelize(operationId, true); + return org.openapitools.codegen.utils.StringUtils.camelize(operationId, true); } public void setBrowserClient(boolean browserClient) { @@ -487,4 +506,44 @@ public class DartClientCodegen extends DefaultCodegen implements CodegenConfig { return input.replace("*/", "*_/").replace("/*", "/_*"); } + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String dartPostProcessFile = System.getenv("DART_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(dartPostProcessFile)) { + return; // skip if DART_POST_PROCESS_FILE env variable is not defined + } + + // only procees the following type (or we can simply rely on the file extension to check if it's a Dart file) + Set supportedFileType = new HashSet( + Arrays.asList( + "supporting-mustache", + "model-test", + "model", + "api-test", + "api")); + if (!supportedFileType.contains(fileType)) { + return; + } + + // only process files with dart extension + if ("dart".equals(FilenameUtils.getExtension(file.toString()))) { + // currently only support "dartfmt -w yourcode.dart" + String command = dartPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java new file mode 100644 index 00000000000..9ca833b5f31 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/DartJaguarClientCodegen.java @@ -0,0 +1,206 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.languages; + +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.utils.ModelUtils; + +import io.swagger.v3.oas.models.media.*; + +import org.apache.commons.lang3.StringUtils; + +import java.io.File; +import java.util.HashSet; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Set; + +public class DartJaguarClientCodegen extends DartClientCodegen { + private static Set modelToIgnore = new HashSet<>(); + + static { + modelToIgnore.add("datetime"); + modelToIgnore.add("map"); + modelToIgnore.add("list"); + modelToIgnore.add("file"); + } + + public DartJaguarClientCodegen() { + super(); + browserClient = false; + outputFolder = "generated-code/dart-jaguar"; + embeddedTemplateDir = templateDir = "dart-jaguar"; + } + + @Override + public String getName() { + return "dart-jaguar"; + } + + @Override + public String getHelp() { + return "Generates a Dart Jaguar client library."; + } + + @Override + public String toDefaultValue(Schema p) { + if (ModelUtils.isMapSchema(p)) { + return "const {}"; + } else if (ModelUtils.isArraySchema(p)) { + return "const []"; + } + return super.toDefaultValue(p); + } + + @Override + public void processOpts() { + if (additionalProperties.containsKey(PUB_NAME)) { + this.setPubName((String) additionalProperties.get(PUB_NAME)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_NAME, pubName); + } + + if (additionalProperties.containsKey(PUB_VERSION)) { + this.setPubVersion((String) additionalProperties.get(PUB_VERSION)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_VERSION, pubVersion); + } + + if (additionalProperties.containsKey(PUB_DESCRIPTION)) { + this.setPubDescription((String) additionalProperties.get(PUB_DESCRIPTION)); + } else { + //not set, use to be passed to template + additionalProperties.put(PUB_DESCRIPTION, pubDescription); + } + + if (additionalProperties.containsKey(USE_ENUM_EXTENSION)) { + this.setUseEnumExtension(convertPropertyToBooleanAndWriteBack(USE_ENUM_EXTENSION)); + } else { + // Not set, use to be passed to template. + additionalProperties.put(USE_ENUM_EXTENSION, useEnumExtension); + } + + if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) { + this.setSourceFolder((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER)); + } + + // make api and model doc path available in mustache template + additionalProperties.put("apiDocPath", apiDocPath); + additionalProperties.put("modelDocPath", modelDocPath); + + final String libFolder = sourceFolder + File.separator + "lib"; + supportingFiles.add(new SupportingFile("pubspec.mustache", "", "pubspec.yaml")); + supportingFiles.add(new SupportingFile("analysis_options.mustache", "", "analysis_options.yaml")); + supportingFiles.add(new SupportingFile("apilib.mustache", libFolder, "api.dart")); + + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + + final String authFolder = sourceFolder + File.separator + "lib" + File.separator + "auth"; + supportingFiles.add(new SupportingFile("auth/api_key_auth.mustache", authFolder, "api_key_auth.dart")); + supportingFiles.add(new SupportingFile("auth/basic_auth.mustache", authFolder, "basic_auth.dart")); + supportingFiles.add(new SupportingFile("auth/oauth.mustache", authFolder, "oauth.dart")); + supportingFiles.add(new SupportingFile("auth/auth.mustache", authFolder, "auth.dart")); + } + + @Override + public Map postProcessModels(Map objs) { + objs = super.postProcessModels(objs); + List models = (List) objs.get("models"); + for (Object _mo : models) { + Map mo = (Map) _mo; + Set modelImports = new HashSet<>(); + CodegenModel cm = (CodegenModel) mo.get("model"); + for (String modelImport : cm.imports) { + if (!modelToIgnore.contains(modelImport.toLowerCase(Locale.ROOT))) { + modelImports.add(underscore(modelImport)); + } + } + cm.imports = modelImports; + cm.vendorExtensions.put("hasVars", cm.vars.size() > 0); + } + return objs; + } + + @Override + public Map postProcessOperations(Map objs) { + objs = super.postProcessOperations(objs); + Map operations = (Map) objs.get("operations"); + List operationList = (List) operations.get("operation"); + + Set modelImports = new HashSet<>(); + + for (CodegenOperation op : operationList) { + op.httpMethod = StringUtils.capitalize(op.httpMethod.toLowerCase(Locale.ROOT)); + boolean isJson = true; //default to JSON + boolean isForm = false; + boolean isMultipart = false; + if (op.consumes != null) { + for (Map consume : op.consumes) { + if (consume.containsKey("mediaType")) { + String type = consume.get("mediaType"); + isJson = type.equalsIgnoreCase("application/json"); + isForm = type.equalsIgnoreCase("application/x-www-form-urlencoded"); + isMultipart = type.equalsIgnoreCase("multipart/form-data"); + break; + } + } + } + + op.vendorExtensions.put("isJson", isJson); + op.vendorExtensions.put("isForm", isForm); + op.vendorExtensions.put("isMultipart", isMultipart); + + Set imports = new HashSet<>(); + for (String item : op.imports) { + if (!modelToIgnore.contains(item.toLowerCase(Locale.ROOT))) { + imports.add(underscore(item)); + } + } + modelImports.addAll(imports); + op.imports = imports; + + String[] items = op.path.split("/", -1); + String jaguarPath = ""; + + for (int i = 0; i < items.length; ++i) { + if (items[i].matches("^\\{(.*)\\}$")) { // wrap in {} + jaguarPath = jaguarPath + ":" + items[i].replace("{", "").replace("}", ""); + } else { + jaguarPath = jaguarPath + items[i]; + } + + if (i != items.length - 1) { + jaguarPath = jaguarPath + "/"; + } + } + + op.path = jaguarPath; + } + + objs.put("modelImports", modelImports); + + return objs; + } +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java index 48da0380353..94cd4bb5c19 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ElixirClientCodegen.java @@ -38,6 +38,7 @@ import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; + public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(ElixirClientCodegen.class); @@ -276,7 +277,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig StringBuffer buffer = new StringBuffer(); while (matcher.find()) { String pathTemplateName = matcher.group(1); - matcher.appendReplacement(buffer, "#{" + underscore(pathTemplateName) + "}" + "$2"); + matcher.appendReplacement(buffer, "#{" + org.openapitools.codegen.utils.StringUtils.underscore(pathTemplateName) + "}" + "$2"); pathTemplateNames.add(pathTemplateName); } ExtendedCodegenOperation eco = new ExtendedCodegenOperation(o); @@ -324,7 +325,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig String underscored(String words) { ArrayList underscoredWords = new ArrayList(); for (String word : words.split(" ")) { - underscoredWords.add(underscore(word)); + underscoredWords.add(org.openapitools.codegen.utils.StringUtils.underscore(word)); } return join("_", underscoredWords); } @@ -332,7 +333,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig String modulized(String words) { ArrayList modulizedWords = new ArrayList(); for (String word : words.split(" ")) { - modulizedWords.add(camelize(word)); + modulizedWords.add(org.openapitools.codegen.utils.StringUtils.camelize(word)); } return join("", modulizedWords); } @@ -351,7 +352,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig private String sourceFolder() { ArrayList underscoredWords = new ArrayList(); for (String word : moduleName.split("\\.")) { - underscoredWords.add(underscore(word)); + underscoredWords.add(org.openapitools.codegen.utils.StringUtils.underscore(word)); } return ("lib/" + join("/", underscoredWords)).replace('/', File.separatorChar); } @@ -378,7 +379,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig if (name.length() == 0) { return "Default"; } - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override @@ -387,14 +388,14 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig name = name.replaceAll("-", "_"); // e.g. PetApi.go => pet_api.go - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); } @Override public String toModelName(String name) { // camelize the model name // phone_number => PhoneNumber - return camelize(toModelFilename(name)); + return org.openapitools.codegen.utils.StringUtils.camelize(toModelFilename(name)); } @Override @@ -421,7 +422,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); } @Override @@ -431,7 +432,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig throw new RuntimeException("Empty method name (operationId) not allowed"); } - return camelize(sanitizeName(operationId)); + return org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId)); } /** @@ -584,7 +585,7 @@ public class ElixirClientCodegen extends DefaultCodegen implements CodegenConfig public String typespec() { StringBuilder sb = new StringBuilder("@spec "); - sb.append(underscore(operationId)); + sb.append(org.openapitools.codegen.utils.StringUtils.underscore(operationId)); sb.append("(Tesla.Env.client, "); for (CodegenParameter param : allParams) { 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 4f041c6843e..f710d426c2d 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 @@ -22,6 +22,7 @@ import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.NumberSchema; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.responses.ApiResponse; +import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenModel; import org.openapitools.codegen.CodegenOperation; @@ -33,6 +34,12 @@ import org.openapitools.codegen.DefaultCodegen; import org.openapitools.codegen.SupportingFile; import org.openapitools.codegen.utils.ModelUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.io.FilenameUtils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.File; import java.text.Collator; import java.util.ArrayList; @@ -46,14 +53,18 @@ import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.TreeSet; +import java.util.stream.Collectors; public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { - private static final String X_ENCODER = "x-encoder"; - private static final String X_DECODER = "x-decoder"; - private static final String X_DISCRIMINATOR_TYPE = "x-discriminator-value"; - private static final String X_UNION_TYPE = "x-union-type"; - + private static final Logger LOGGER = LoggerFactory.getLogger(ElmClientCodegen.class); private Set customPrimitives = new HashSet(); + private ElmVersion elmVersion = ElmVersion.ELM_019; + + private static final String ELM_VERSION = "elmVersion"; + private static final String ENCODER = "elmEncoder"; + private static final String DECODER = "elmDecoder"; + private static final String DISCRIMINATOR_NAME = "discriminatorName"; + private static final String UNION_TYPE = "elmUnionType"; protected String packageName = "openapi"; protected String packageVersion = "1.0.0"; @@ -122,6 +133,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { instantiationTypes.clear(); instantiationTypes.put("array", "List"); + instantiationTypes.put("map", "Dict"); typeMapping.clear(); typeMapping.put("integer", "Int"); @@ -132,24 +144,72 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { typeMapping.put("boolean", "Bool"); typeMapping.put("string", "String"); typeMapping.put("array", "List"); + typeMapping.put("map", "Dict"); typeMapping.put("date", "DateOnly"); typeMapping.put("DateTime", "DateTime"); typeMapping.put("password", "String"); - typeMapping.put("file", "String"); typeMapping.put("ByteArray", "Byte"); + typeMapping.put("file", "String"); typeMapping.put("binary", "String"); importMapping.clear(); cliOptions.clear(); + final CliOption elmVersion = new CliOption(ELM_VERSION, "Elm version: 0.18, 0.19").defaultValue("0.19"); + final Map supportedVersions = new HashMap<>(); + supportedVersions.put("0.18", "Elm 0.18"); + supportedVersions.put("0.19", "Elm 0.19"); + elmVersion.setEnum(supportedVersions); + cliOptions.add(elmVersion); + } + + @Override + public void processOpts() { + super.processOpts(); + + + if (additionalProperties.containsKey(ELM_VERSION)) { + final String version = (String) additionalProperties.get(ELM_VERSION); + if ("0.18".equals(version)) { + elmVersion = ElmVersion.ELM_018; + } else { + elmVersion = ElmVersion.ELM_019; + } + } + + if (StringUtils.isEmpty(System.getenv("ELM_POST_PROCESS_FILE"))) { + if (elmVersion.equals(ElmVersion.ELM_018)) { // 0.18 + LOGGER.info("Environment variable ELM_POST_PROCESS_FILE not defined so the Elm code may not be properly formatted. To define it, try `export ELM_POST_PROCESS_FILE=\"/usr/local/bin/elm-format --elm-version={} --yes\"` (Linux/Mac)", "0.18"); + } else { // 0.19 + LOGGER.info("Environment variable ELM_POST_PROCESS_FILE not defined so the Elm code may not be properly formatted. To define it, try `export ELM_POST_PROCESS_FILE=\"/usr/local/bin/elm-format --elm-version={} --yes\"` (Linux/Mac)", "0.19"); + } + } + + switch (elmVersion) { + case ELM_018: + LOGGER.info("Elm version = 0.18"); + additionalProperties.put("isElm018", true); + supportingFiles.add(new SupportingFile("DateOnly018.mustache", "src", "DateOnly.elm")); + supportingFiles.add(new SupportingFile("DateTime018.mustache", "src", "DateTime.elm")); + supportingFiles.add(new SupportingFile("elm-package018.mustache", "", "elm-package.json")); + supportingFiles.add(new SupportingFile("Main018.mustache", "src", "Main.elm")); + break; + case ELM_019: + LOGGER.info("Elm version = 0.19"); + additionalProperties.put("isElm019", true); + supportingFiles.add(new SupportingFile("DateOnly.mustache", "src", "DateOnly.elm")); + supportingFiles.add(new SupportingFile("DateTime.mustache", "src", "DateTime.elm")); + supportingFiles.add(new SupportingFile("elm.mustache", "", "elm.json")); + supportingFiles.add(new SupportingFile("Main.mustache", "src", "Main.elm")); + break; + default: + throw new RuntimeException("Undefined Elm version"); + } + supportingFiles.add(new SupportingFile("Byte.mustache", "src", "Byte.elm")); - supportingFiles.add(new SupportingFile("DateOnly.mustache", "src", "DateOnly.elm")); - supportingFiles.add(new SupportingFile("DateTime.mustache", "src", "DateTime.elm")); - supportingFiles.add(new SupportingFile("Main.mustache", "src", "Main.elm")); - supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); - supportingFiles.add(new SupportingFile("elm-package.mustache", "", "elm-package.json")); supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); } @Override @@ -172,7 +232,7 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toModelName(String name) { - final String modelName = camelize(name); + final String modelName = org.openapitools.codegen.utils.StringUtils.camelize(name); return defaultIncludes.contains(modelName) ? modelName + "_" : modelName; } @@ -188,13 +248,13 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toVarName(String name) { - final String varName = camelize(name, true); + final String varName = org.openapitools.codegen.utils.StringUtils.camelize(name, true); return isReservedWord(varName) ? escapeReservedWord(name) : varName; } @Override public String toEnumVarName(String value, String datatype) { - final String camelized = camelize(value.replace(" ", "_").replace("(", "_").replace(")", "")); // TODO FIXME escape properly + final String camelized = org.openapitools.codegen.utils.StringUtils.camelize(value.replace(" ", "_").replace("(", "_").replace(")", "")); // TODO FIXME escape properly if (!Character.isUpperCase(camelized.charAt(0))) { return "N" + camelized; } @@ -277,55 +337,40 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { for (Map mo : models) { CodegenModel cm = (CodegenModel) mo.get("model"); if (cm.isEnum) { - this.addEncoderAndDecoder(cm.vendorExtensions, cm.classname, false, false); - cm.vendorExtensions.put(X_UNION_TYPE, cm.classname); + addEncoderAndDecoder(cm.vendorExtensions, cm.classname, DataTypeExposure.EXPOSED); + cm.vendorExtensions.put(UNION_TYPE, cm.classname); } else if (cm.isAlias) { - this.addEncoderAndDecoder(cm.vendorExtensions, cm.dataType, false, true); + addEncoderAndDecoder(cm.vendorExtensions, cm.dataType, DataTypeExposure.EXPOSED); } List elmImports = new ArrayList<>(); for (CodegenProperty property : cm.allVars) { if (property.complexType != null) { - elmImports.add(createPropertyImport(property)); + final ElmImport elmImport = createImport(property.complexType); + elmImports.add(elmImport); } } if (cm.isArrayModel) { if (cm.arrayModelType != null) { // add type imports - final ElmImport elmImport = new ElmImport(); - final String modulePrefix = customPrimitives.contains(cm.arrayModelType) ? "" : "Data."; - elmImport.moduleName = modulePrefix + cm.arrayModelType; - elmImport.exposures = new TreeSet<>(); - elmImport.exposures.add(cm.arrayModelType); - elmImport.exposures.add(camelize(cm.arrayModelType, true) + "Decoder"); - elmImport.exposures.add(camelize(cm.arrayModelType, true) + "Encoder"); - elmImport.hasExposures = true; + final ElmImport elmImport = createImport(cm.arrayModelType); elmImports.add(elmImport); } } if (cm.discriminator != null) { for (CodegenModel child : cm.children) { // add child imports - final ElmImport elmImport = new ElmImport(); - final String modulePrefix = customPrimitives.contains(child.classname) ? "" : "Data."; - elmImport.moduleName = modulePrefix + child.classname; - elmImport.exposures = new TreeSet<>(); - elmImport.exposures.add(child.classname); - elmImport.exposures.add(child.classVarName + "Decoder"); - elmImport.exposures.add(child.classVarName + "Encoder"); - elmImport.hasExposures = true; + final ElmImport elmImport = createImport(child.classname); elmImports.add(elmImport); - // set discriminator value to all children (recursively) - this.setDiscriminatorValue(child, cm.getDiscriminatorName(), this.getDiscriminatorValue(child)); + final String propertyName = cm.discriminator.getPropertyName(); + final List allVars = child.allVars.stream() + .filter(var -> !var.baseName.equals(propertyName)) + .collect(Collectors.toList()); + child.allVars.clear(); + child.allVars.addAll(allVars); - // add all non-discriminator vars - int index = 0; - for (CodegenProperty property : cm.vars) { - if (!cm.discriminator.equals(property.baseName)) { - child.vars.add(index++, property); - } - } + child.vendorExtensions.put(DISCRIMINATOR_NAME, propertyName); } } inner.put("elmImports", elmImports); @@ -334,42 +379,16 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { return objs; } - private void setDiscriminatorValue(CodegenModel model, String baseName, String value) { - for (CodegenProperty prop : model.vars) { - if (prop.baseName.equals(baseName)) { - prop.discriminatorValue = value; - } - } - for (CodegenProperty prop : model.allVars) { - if (prop.baseName.equals(baseName)) { - prop.discriminatorValue = value; - } - } - if (model.children != null) { - final boolean newDiscriminator = model.discriminator != null; - for (CodegenModel child : model.children) { - this.setDiscriminatorValue(child, baseName, newDiscriminator ? value : this.getDiscriminatorValue(child)); - } - } - } - - private String getDiscriminatorValue(CodegenModel model) { - return model.vendorExtensions.containsKey(X_DISCRIMINATOR_TYPE) ? - (String) model.vendorExtensions.get(X_DISCRIMINATOR_TYPE) : model.classname; - } - - private ElmImport createPropertyImport(final CodegenProperty property) { + private ElmImport createImport(final String name) { final ElmImport elmImport = new ElmImport(); - final String modulePrefix = customPrimitives.contains(property.complexType) ? "" : "Data."; - elmImport.moduleName = modulePrefix + property.complexType; + final boolean isData = !customPrimitives.contains(name); + final String modulePrefix = isData ? "Data." : ""; + elmImport.moduleName = modulePrefix + name; + if (isData) { + elmImport.as = name; + } elmImport.exposures = new TreeSet<>(); - elmImport.exposures.add(property.complexType); - if (property.vendorExtensions.containsKey(X_DECODER)) { - elmImport.exposures.add((String) property.vendorExtensions.get(X_DECODER)); - } - if (property.vendorExtensions.containsKey(X_ENCODER)) { - elmImport.exposures.add((String) property.vendorExtensions.get(X_ENCODER)); - } + elmImport.exposures.add(name); elmImport.hasExposures = true; return elmImport; } @@ -385,49 +404,68 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { Map objs = (Map) operations.get("operations"); List ops = (List) objs.get("operation"); - Map> dependencies = new HashMap<>(); + boolean hasDateTime = false; + boolean hasDate = false; + final Map> dependencies = new HashMap<>(); for (CodegenOperation op : ops) { String path = op.path; for (CodegenParameter param : op.pathParams) { - final String var = param.isString ? param.paramName : "toString " + param.paramName; + final String var = paramToString(param); path = path.replace("{" + param.paramName + "}", "\" ++ " + var + " ++ \""); + hasDateTime = hasDateTime || param.isDateTime; + hasDate = hasDate || param.isDate; } op.path = ("\"" + path + "\"").replaceAll(" \\+\\+ \"\"", ""); if (op.bodyParam != null && !op.bodyParam.isPrimitiveType && !op.bodyParam.isMapContainer) { - final String encoder = (String) op.bodyParam.vendorExtensions.get(X_ENCODER); + final String encoder = (String) op.bodyParam.vendorExtensions.get(ENCODER); if (encoder != null) { if (!dependencies.containsKey(op.bodyParam.dataType)) { dependencies.put(op.bodyParam.dataType, new TreeSet()); } - dependencies.get(op.bodyParam.dataType).add(encoder); } } for (CodegenResponse resp : op.responses) { if (resp.primitiveType || resp.isMapContainer) { continue; } - final String decoder = (String) resp.vendorExtensions.get(X_DECODER); + final String decoder = (String) resp.vendorExtensions.get(DECODER); if (decoder != null) { if (!dependencies.containsKey(resp.dataType)) { dependencies.put(resp.dataType, new TreeSet()); } - dependencies.get(resp.dataType).add(decoder); } } } - List elmImports = new ArrayList<>(); + final List elmImports = new ArrayList<>(); for (Map.Entry> entry : dependencies.entrySet()) { final ElmImport elmImport = new ElmImport(); final String key = entry.getKey(); elmImport.moduleName = "Data." + key; + elmImport.as = key; elmImport.exposures = entry.getValue(); elmImport.exposures.add(key); elmImport.hasExposures = true; elmImports.add(elmImport); } + if (hasDate) { + final ElmImport elmImport = new ElmImport(); + elmImport.moduleName = "DateOnly"; + elmImport.exposures = new TreeSet<>(); + elmImport.exposures.add("DateOnly"); + elmImport.hasExposures = true; + elmImports.add(elmImport); + } + if (hasDateTime) { + final ElmImport elmImport = new ElmImport(); + elmImport.moduleName = "DateTime"; + elmImport.exposures = new TreeSet<>(); + elmImport.exposures.add("DateTime"); + elmImport.hasExposures = true; + elmImports.add(elmImport); + } operations.put("elmImports", elmImports); return operations; @@ -472,6 +510,28 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { return "(Just " + value + ")"; } + private String paramToString(final CodegenParameter param) { + final String paramName = param.paramName; + + if (param.isString || param.isUuid || param.isBinary || param.isByteArray) { + return paramName; + } else if (param.isBoolean) { + return "if " + paramName + " then \"true\" else \"false\""; + } else if (param.isDateTime) { + return "DateTime.toString " + paramName; + } else if (param.isDate) { + return "DateOnly.toString " + paramName; + } else if (ElmVersion.ELM_018.equals(elmVersion)) { + return "toString " + paramName; + } else if (param.isInteger || param.isLong) { + return "String.fromInt " + paramName; + } else if (param.isFloat || param.isDouble) { + return "String.fromFloat " + paramName; + } + + throw new RuntimeException("Parameter '" + paramName + "' cannot be converted to a string. Please report the issue."); + } + @Override public String getSchemaType(Schema p) { String openAPIType = super.getSchemaType(p); @@ -503,10 +563,12 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { public CodegenProperty fromProperty(String name, Schema p) { final CodegenProperty property = super.fromProperty(name, p); - final String dataType = property.isEnum ? property.baseName : property.dataType; - addEncoderAndDecoder(property.vendorExtensions, dataType, property.isMapContainer, property.isPrimitiveType && !property.isEnum); if (property.isEnum) { - property.vendorExtensions.put(X_UNION_TYPE, property.datatypeWithEnum); + addEncoderAndDecoder(property.vendorExtensions, property.baseName, DataTypeExposure.INTERNAL); + property.vendorExtensions.put(UNION_TYPE, property.datatypeWithEnum); + } else { + final boolean isPrimitiveType = property.isMapContainer ? isPrimitiveDataType(property.dataType) : property.isPrimitiveType; + addEncoderAndDecoder(property.vendorExtensions, property.dataType, isPrimitiveType ? DataTypeExposure.PRIMITIVE : DataTypeExposure.EXTERNAL); } return property; @@ -516,46 +578,101 @@ public class ElmClientCodegen extends DefaultCodegen implements CodegenConfig { public CodegenResponse fromResponse(OpenAPI openAPI, String responseCode, ApiResponse resp) { final CodegenResponse response = super.fromResponse(openAPI, responseCode, resp); if (response.dataType != null) { - addEncoderAndDecoder(response.vendorExtensions, response.dataType, response.isMapContainer, response.primitiveType); + final boolean isPrimitiveType = response.isMapContainer ? isPrimitiveDataType(response.dataType) : response.primitiveType; + addEncoderAndDecoder(response.vendorExtensions, response.dataType, isPrimitiveType ? DataTypeExposure.PRIMITIVE : DataTypeExposure.EXTERNAL); } return response; } @Override public void postProcessParameter(CodegenParameter parameter) { - addEncoderAndDecoder(parameter.vendorExtensions, parameter.dataType, parameter.isMapContainer, parameter.isPrimitiveType); + final boolean isPrimitiveType = parameter.isMapContainer ? isPrimitiveDataType(parameter.dataType) : parameter.isPrimitiveType; + addEncoderAndDecoder(parameter.vendorExtensions, parameter.dataType, isPrimitiveType ? DataTypeExposure.PRIMITIVE : DataTypeExposure.EXTERNAL); } private boolean isPrimitiveDataType(String dataType) { return languageSpecificPrimitives.contains(dataType); } - private void addEncoderAndDecoder(Map vendorExtensions, String dataType, Boolean isMapContainer, Boolean isPrimitiveType) { - if (isMapContainer) { - isPrimitiveType = isPrimitiveDataType(dataType); - } - final String baseName = camelize(dataType, true); + private void addEncoderAndDecoder(final Map vendorExtensions, final String dataType, final DataTypeExposure dataTypeExposure) { + final String baseName = org.openapitools.codegen.utils.StringUtils.camelize(dataType, true); String encoderName; String decoderName; - if (isPrimitiveType) { - encoderName = "Encode." + baseName; - decoderName = "Decode." + baseName; - } else { - encoderName = baseName + "Encoder"; - decoderName = baseName + "Decoder"; + switch (dataTypeExposure) { + case EXPOSED: + decoderName = "decoder"; + encoderName = "encoder"; + break; + case INTERNAL: + encoderName = baseName + "Encoder"; + decoderName = baseName + "Decoder"; + break; + case EXTERNAL: + encoderName = dataType + ".encoder"; + decoderName = dataType + ".decoder"; + break; + case PRIMITIVE: + encoderName = "Encode." + baseName; + decoderName = "Decode." + baseName; + break; + default: + encoderName = ""; + decoderName = ""; } - if (!vendorExtensions.containsKey(X_ENCODER)) { - vendorExtensions.put(X_ENCODER, encoderName); + if (!vendorExtensions.containsKey(ENCODER)) { + vendorExtensions.put(ENCODER, encoderName); } - if (!vendorExtensions.containsKey(X_DECODER)) { - vendorExtensions.put(X_DECODER, decoderName); + if (!vendorExtensions.containsKey(DECODER)) { + vendorExtensions.put(DECODER, decoderName); } } + private enum DataTypeExposure { + EXPOSED, + INTERNAL, + EXTERNAL, + PRIMITIVE + } + private static class ElmImport { public String moduleName; public String as; public Set exposures; public Boolean hasExposures; } + + private enum ElmVersion { + ELM_018, + ELM_019 + } + + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String elmPostProcessFile = System.getenv("ELM_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(elmPostProcessFile)) { + return; // skip if ELM_POST_PROCESS_FILE env variable is not defined + } + + // only process files with elm extension + if ("elm".equals(FilenameUtils.getExtension(file.toString()))) { + // e.g. elm-format -w yourcode.elm + String command = elmPostProcessFile + " " + file.toString(); + + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java index ed5889a92fd..d202e755268 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangClientCodegen.java @@ -34,6 +34,7 @@ import java.util.regex.Pattern; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(ErlangClientCodegen.class); @@ -203,7 +204,7 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig if (this.reservedWordsMappings().containsKey(name)) { return this.reservedWordsMappings().get(name); } - return camelize(name) + '_'; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + '_'; } @Override @@ -229,7 +230,7 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig @Override public String toParamName(String name) { - return camelize(toVarName(name)); + return org.openapitools.codegen.utils.StringUtils.camelize(toVarName(name)); } @Override @@ -248,17 +249,17 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig @Override public String toModelName(String name) { - return this.packageName + "_" + underscore(name.replaceAll("-", "_").replaceAll("\\.", "_")); + return this.packageName + "_" + org.openapitools.codegen.utils.StringUtils.underscore(name.replaceAll("-", "_").replaceAll("\\.", "_")); } @Override public String toApiName(String name) { - return this.packageName + "_" + underscore(name.replaceAll("-", "_").replaceAll("\\.", "_")); + return this.packageName + "_" + org.openapitools.codegen.utils.StringUtils.underscore(name.replaceAll("-", "_").replaceAll("\\.", "_")); } @Override public String toModelFilename(String name) { - return this.packageName + "_" + underscore(name.replaceAll("\\.", "_")); + return this.packageName + "_" + org.openapitools.codegen.utils.StringUtils.underscore(name.replaceAll("\\.", "_")); } @Override @@ -268,18 +269,18 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig name = name.replaceAll("-", "_").replaceAll("\\.", "_"); // e.g. PetApi.erl => pet_api.erl - return this.packageName + "_" + underscore(name) + "_api"; + return this.packageName + "_" + org.openapitools.codegen.utils.StringUtils.underscore(name) + "_api"; } @Override public String toOperationId(String operationId) { // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId)).replaceAll("\\.", "_")); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName("call_" + operationId)).replaceAll("\\.", "_")); operationId = "call_" + operationId; } - return underscore(operationId.replaceAll("\\.", "_")); + return org.openapitools.codegen.utils.StringUtils.underscore(operationId.replaceAll("\\.", "_")); } @Override @@ -301,7 +302,7 @@ public class ErlangClientCodegen extends DefaultCodegen implements CodegenConfig StringBuffer buffer = new StringBuffer(); while (matcher.find()) { String pathTemplateName = matcher.group(1); - matcher.appendReplacement(buffer, "\", " + camelize(pathTemplateName) + ", \""); + matcher.appendReplacement(buffer, "\", " + org.openapitools.codegen.utils.StringUtils.camelize(pathTemplateName) + ", \""); pathTemplateNames.add(pathTemplateName); } matcher.appendTail(buffer); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java index 80349e2d6f8..3abb6e13436 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ErlangServerCodegen.java @@ -32,6 +32,7 @@ import java.util.Arrays; import java.util.List; import java.util.Map; + public class ErlangServerCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(ErlangServerCodegen.class); @@ -184,7 +185,7 @@ public class ErlangServerCodegen extends DefaultCodegen implements CodegenConfig if (name.length() == 0) { return this.packageName + "_default_handler"; } - return this.packageName + "_" + underscore(name) + "_handler"; + return this.packageName + "_" + org.openapitools.codegen.utils.StringUtils.underscore(name) + "_handler"; } /** @@ -212,18 +213,18 @@ public class ErlangServerCodegen extends DefaultCodegen implements CodegenConfig @Override public String toModelName(String name) { - return camelize(toModelFilename(name)); + return org.openapitools.codegen.utils.StringUtils.camelize(toModelFilename(name)); } @Override public String toOperationId(String operationId) { // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId))); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId))); operationId = "call_" + operationId; } - return camelize(operationId); + return org.openapitools.codegen.utils.StringUtils.camelize(operationId); } @Override @@ -258,7 +259,7 @@ public class ErlangServerCodegen extends DefaultCodegen implements CodegenConfig } protected String toModuleName(String name) { - return this.packageName + "_" + underscore(name.replaceAll("-", "_")); + return this.packageName + "_" + org.openapitools.codegen.utils.StringUtils.underscore(name.replaceAll("-", "_")); } protected String toSourceFilePath(String name, String extension) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/FlashClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/FlashClientCodegen.java index 73ca27fa180..2925a1f893f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/FlashClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/FlashClientCodegen.java @@ -29,6 +29,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.Locale; + public class FlashClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(FlashClientCodegen.class); @@ -264,7 +265,7 @@ public class FlashClientCodegen extends DefaultCodegen implements CodegenConfig // underscore the variable name // petId => pet_id - name = camelize(dropDots(name), true); + name = org.openapitools.codegen.utils.StringUtils.camelize(dropDots(name), true); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -294,13 +295,13 @@ public class FlashClientCodegen extends DefaultCodegen implements CodegenConfig // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. return => ModelReturn (after camelize) } // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override @@ -315,7 +316,7 @@ public class FlashClientCodegen extends DefaultCodegen implements CodegenConfig name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // e.g. PhoneNumberApi.rb => phone_number_api.rb - return camelize(name) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override @@ -324,7 +325,7 @@ public class FlashClientCodegen extends DefaultCodegen implements CodegenConfig return "DefaultApi"; } // e.g. phone_number_api => PhoneNumberApi - return camelize(name) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override @@ -332,7 +333,7 @@ public class FlashClientCodegen extends DefaultCodegen implements CodegenConfig if (name.length() == 0) { return "DefaultApi"; } - return camelize(name) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override @@ -344,11 +345,11 @@ public class FlashClientCodegen extends DefaultCodegen implements CodegenConfig // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId))); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName("call_" + operationId))); operationId = "call_" + operationId; } - return underscore(operationId); + return org.openapitools.codegen.utils.StringUtils.underscore(operationId); } public void setPackageName(String packageName) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java index dd173e43ccb..a96e7ce53e0 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoClientCodegen.java @@ -17,16 +17,21 @@ package org.openapitools.codegen.languages; +import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenType; import org.openapitools.codegen.SupportingFile; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.util.Arrays; public class GoClientCodegen extends AbstractGoCodegen { + private static final Logger LOGGER = LoggerFactory.getLogger(GoClientCodegen.class); + protected String packageVersion = "1.0.0"; protected String apiDocPath = "docs/"; protected String modelDocPath = "docs/"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoGinServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoGinServerCodegen.java new file mode 100644 index 00000000000..879b92a775c --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GoGinServerCodegen.java @@ -0,0 +1,192 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.languages; + +import org.apache.commons.lang3.StringUtils; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.CodegenType; +import org.openapitools.codegen.SupportingFile; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +public class GoGinServerCodegen extends AbstractGoCodegen { + + private static final Logger LOGGER = LoggerFactory.getLogger(GoGinServerCodegen.class); + + protected String apiVersion = "1.0.0"; + protected int serverPort = 8080; + protected String projectName = "openapi-server"; + protected String apiPath = "go"; + + public GoGinServerCodegen() { + super(); + + // set the output folder here + outputFolder = "generated-code/go"; + + /* + * Models. You can write model files using the modelTemplateFiles map. + * if you want to create one template for file, you can do so here. + * for multiple files for model, just put another entry in the `modelTemplateFiles` with + * a different extension + */ + modelTemplateFiles.put( + "model.mustache", + ".go"); + + /* + * Api classes. You can write classes for each Api file with the apiTemplateFiles map. + * as with models, add multiple entries with different extensions for multiple files per + * class + */ + apiTemplateFiles.put( + "controller-api.mustache", // the template to use + ".go"); // the extension for each file to write + + /* + * Template Location. This is the location which templates will be read from. The generator + * will use the resource stream to attempt to read the templates. + */ + embeddedTemplateDir = templateDir = "go-gin-server"; + + /* + * Reserved words. Override this with reserved words specific to your language + */ + setReservedWordsLowerCase( + Arrays.asList( + // data type + "string", "bool", "uint", "uint8", "uint16", "uint32", "uint64", + "int", "int8", "int16", "int32", "int64", "float32", "float64", + "complex64", "complex128", "rune", "byte", "uintptr", + + "break", "default", "func", "interface", "select", + "case", "defer", "go", "map", "struct", + "chan", "else", "goto", "package", "switch", + "const", "fallthrough", "if", "range", "type", + "continue", "for", "import", "return", "var", "error", "nil") + // Added "error" as it's used so frequently that it may as well be a keyword + ); + } + + @Override + public Map postProcessOperationsWithModels(Map objs, List allModels) { + objs = super.postProcessOperationsWithModels(objs, allModels); + + Map operations = (Map) objs.get("operations"); + List operationList = (List) operations.get("operation"); + for (CodegenOperation op : operationList) { + if (op.path != null) { + op.path = op.path.replaceAll("\\{(.*?)\\}", ":$1"); + } + } + return objs; + } + + @Override + public void processOpts() { + super.processOpts(); + + if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { + setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); + } else { + setPackageName("openapi"); + } + + /* + * Additional Properties. These values can be passed to the templates and + * are available in models, apis, and supporting files + */ + additionalProperties.put("apiVersion", apiVersion); + additionalProperties.put("serverPort", serverPort); + additionalProperties.put("apiPath", apiPath); + additionalProperties.put(CodegenConstants.PACKAGE_NAME, packageName); + + modelPackage = packageName; + apiPackage = packageName; + + /* + * Supporting Files. You can write single files for the generator with the + * entire object tree available. If the input file has a suffix of `.mustache + * it will be processed by the template engine. Otherwise, it will be copied + */ + 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("routers.mustache", apiPath, "routers.go")); + writeOptional(outputFolder, new SupportingFile("README.mustache", apiPath, "README.md")); + } + + @Override + public String apiPackage() { + return apiPath; + } + + /** + * Configures the type of generator. + * + * @return the CodegenType for this generator + * @see org.openapitools.codegen.CodegenType + */ + @Override + public CodegenType getTag() { + return CodegenType.SERVER; + } + + /** + * Configures a friendly name for the generator. This will be used by the generator + * to select the library with the -g flag. + * + * @return the friendly name for the generator + */ + @Override + public String getName() { + return "go-gin-server"; + } + + /** + * Returns human-friendly help for the generator. Provide the consumer with help + * tips, parameters here + * + * @return A string value for the help message + */ + @Override + public String getHelp() { + return "Generates a Go server library with the gin framework using OpenAPI-Generator." + + "By default, it will also generate service classes."; + } + + /** + * Location to write api files. You can use the apiPackage() as defined when the class is + * instantiated + */ + @Override + public String apiFileFolder() { + return outputFolder + File.separator + apiPackage().replace('.', File.separatorChar); + } + + @Override + public String modelFileFolder() { + return outputFolder + File.separator + apiPackage().replace('.', File.separatorChar); + } + +} 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 6e650b9ad56..b7d72e3243b 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 @@ -17,15 +17,20 @@ package org.openapitools.codegen.languages; +import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.CodegenType; import org.openapitools.codegen.SupportingFile; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.File; import java.util.Arrays; public class GoServerCodegen extends AbstractGoCodegen { + private static final Logger LOGGER = LoggerFactory.getLogger(GoServerCodegen.class); + protected String apiVersion = "1.0.0"; protected int serverPort = 8080; protected String projectName = "openapi-server"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GroovyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GroovyClientCodegen.java index fdbc171813b..94c89e0843f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GroovyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/GroovyClientCodegen.java @@ -21,6 +21,7 @@ import org.openapitools.codegen.*; import java.io.File; + public class GroovyClientCodegen extends AbstractJavaCodegen { public static final String CONFIG_PACKAGE = "configPackage"; protected String title = "Petstore Server"; @@ -98,7 +99,7 @@ public class GroovyClientCodegen extends AbstractJavaCodegen { return "DefaultApi"; } name = sanitizeName(name); - return camelize(name) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } public void setConfigPackage(String configPackage) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java index 418ecd35769..07fc3c52e00 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellHttpClientCodegen.java @@ -24,6 +24,7 @@ import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.security.SecurityScheme; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.tuple.Pair; import org.openapitools.codegen.*; import org.openapitools.codegen.utils.ModelUtils; @@ -35,6 +36,7 @@ import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; + public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(HaskellHttpClientCodegen.class); @@ -360,6 +362,10 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC public void processOpts() { super.processOpts(); + if (StringUtils.isEmpty(System.getenv("HASKELL_POST_PROCESS_FILE"))) { + LOGGER.info("Hint: Environment variable HASKELL_POST_PROCESS_FILE not defined so the Haskell code may not be properly formatted. To define it, try 'export HASKELL_POST_PROCESS_FILE=\"$HOME/.local/bin/hfmt -w\"' (Linux/Mac)"); + } + if (additionalProperties.containsKey(PROP_ALLOW_FROMJSON_NULLS)) { setAllowFromJsonNulls(convertPropertyToBoolean(PROP_ALLOW_FROMJSON_NULLS)); } else { @@ -616,8 +622,8 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC } op.operationId = uniqueName; op.operationIdLowerCase = uniqueName.toLowerCase(Locale.ROOT); - op.operationIdCamelCase = DefaultCodegen.camelize(uniqueName); - op.operationIdSnakeCase = DefaultCodegen.underscore(uniqueName); + op.operationIdCamelCase = org.openapitools.codegen.utils.StringUtils.camelize(uniqueName); + op.operationIdSnakeCase = org.openapitools.codegen.utils.StringUtils.underscore(uniqueName); opList.add(op); op.baseName = tag; @@ -1077,8 +1083,8 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC public String toVarName(String prefix, String name) { Boolean hasPrefix = !StringUtils.isBlank(prefix); - name = underscore(sanitizeName(name.replaceAll("-", "_"))); - name = camelize(name, !hasPrefix); + name = org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName(name.replaceAll("-", "_"))); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, !hasPrefix); if (hasPrefix) { return prefix + name; } else { @@ -1123,7 +1129,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC } public String toTypeName(String prefix, String name) { - name = escapeIdentifier(prefix, camelize(sanitizeName(name))); + name = escapeIdentifier(prefix, org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(name))); return name; } @@ -1132,7 +1138,7 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC if (StringUtils.isEmpty(operationId)) { throw new RuntimeException("Empty method/operation name (operationId) not allowed"); } - operationId = escapeIdentifier("op", camelize(sanitizeName(operationId), true)); + operationId = escapeIdentifier("op", org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true)); return operationId; } @@ -1344,4 +1350,31 @@ public class HaskellHttpClientCodegen extends DefaultCodegen implements CodegenC .replace("\\", "\\\\") .replace("\"", "\\\"")); } + + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + String haskellPostProcessFile = System.getenv("HASKELL_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(haskellPostProcessFile)) { + return; // skip if HASKELL_POST_PROCESS_FILE env variable is not defined + } + + // only process files with hs extension + if ("hs".equals(FilenameUtils.getExtension(file.toString()))) { + String command = haskellPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java index 9408d6b8f51..2cb95164694 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/HaskellServantCodegen.java @@ -21,6 +21,7 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConfig; @@ -36,6 +37,7 @@ import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; @@ -45,6 +47,7 @@ import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; + public class HaskellServantCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(HaskellServantCodegen.class); @@ -99,20 +102,20 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf // set the output folder here outputFolder = "generated-code/haskell-servant"; - /* - * Template Location. This is the location which templates will be read from. The generator - * will use the resource stream to attempt to read the templates. - */ + /* + * Template Location. This is the location which templates will be read from. The generator + * will use the resource stream to attempt to read the templates. + */ embeddedTemplateDir = templateDir = "haskell-servant"; - /* - * Api Package. Optional, if needed, this can be used in templates - */ + /* + * Api Package. Optional, if needed, this can be used in templates + */ apiPackage = "API"; - /* - * Model Package. Optional, if needed, this can be used in templates - */ + /* + * Model Package. Optional, if needed, this can be used in templates + */ modelPackage = "Types"; // Haskell keywords and reserved function names, taken mostly from https://wiki.haskell.org/Keywords @@ -132,25 +135,25 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf ) ); - /* - * Additional Properties. These values can be passed to the templates and - * are available in models, apis, and supporting files - */ + /* + * Additional Properties. These values can be passed to the templates and + * are available in models, apis, and supporting files + */ additionalProperties.put("apiVersion", apiVersion); - /* - * Supporting Files. You can write single files for the generator with the - * entire object tree available. If the input file has a suffix of `.mustache - * it will be processed by the template engine. Otherwise, it will be copied - */ + /* + * Supporting Files. You can write single files for the generator with the + * entire object tree available. If the input file has a suffix of `.mustache + * it will be processed by the template engine. Otherwise, it will be copied + */ supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("stack.mustache", "", "stack.yaml")); supportingFiles.add(new SupportingFile("Setup.mustache", "", "Setup.hs")); - /* - * Language Specific Primitives. These types will not trigger imports by - * the client generator - */ + /* + * Language Specific Primitives. These types will not trigger imports by + * the client generator + */ languageSpecificPrimitives = new HashSet( Arrays.asList( "Bool", @@ -178,6 +181,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf typeMapping.put("double", "Double"); typeMapping.put("DateTime", "Integer"); typeMapping.put("file", "FilePath"); + typeMapping.put("binary", "FilePath"); typeMapping.put("number", "Double"); typeMapping.put("any", "Value"); typeMapping.put("UUID", "Text"); @@ -191,6 +195,15 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf cliOptions.add(new CliOption(CodegenConstants.API_PACKAGE, CodegenConstants.API_PACKAGE_DESC)); } + @Override + public void processOpts() { + super.processOpts(); + + if (StringUtils.isEmpty(System.getenv("HASKELL_POST_PROCESS_FILE"))) { + LOGGER.info("Hint: Environment variable HASKELL_POST_PROCESS_FILE not defined so the Haskell code may not be properly formatted. To define it, try 'export HASKELL_POST_PROCESS_FILE=\"$HOME/.local/bin/hfmt -w\"' (Linux/Mac)"); + } + } + /** * Escapes a reserved word as defined in the `reservedWords` array. Handle escaping * those terms here. This logic is only called if a variable matches the reserved words @@ -199,7 +212,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf */ @Override public String escapeReservedWord(String name) { - if(this.reservedWordsMappings().containsKey(name)) { + if (this.reservedWordsMappings().containsKey(name)) { return this.reservedWordsMappings().get(name); } return "_" + name; @@ -231,7 +244,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf String title = openAPI.getInfo().getTitle(); // Drop any API suffix - if(title == null) { + if (title == null) { title = "OpenAPI"; } else { title = title.trim(); @@ -271,7 +284,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf List> replacements = new ArrayList<>(); Object[] replacementChars = specialCharReplacements.keySet().toArray(); - for(int i = 0; i < replacementChars.length; i++) { + for (int i = 0; i < replacementChars.length; i++) { String c = (String) replacementChars[i]; Map o = new HashMap<>(); o.put("char", c); @@ -320,7 +333,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf return type; //if (languageSpecificPrimitives.contains(type)) // return toModelName(type); - } else if(typeMapping.containsValue(schemaType)) { + } else if (typeMapping.containsValue(schemaType)) { // TODO what's this case for? type = schemaType + "_"; } else { @@ -451,9 +464,9 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf path.add("ReqBody '[JSON] " + param.dataType); bodyType = param.dataType; } - } else if(op.getHasFormParams()) { + } else if (op.getHasFormParams()) { // Use the FormX data type, where X is the conglomerate of all things being passed - String formName = "Form" + camelize(op.operationId); + String formName = "Form" + org.openapitools.codegen.utils.StringUtils.camelize(op.operationId); bodyType = formName; path.add("ReqBody '[FormUrlEncoded] " + formName); } @@ -478,7 +491,7 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf // store form parameter name in the vendor extensions for (CodegenParameter param : op.formParams) { - param.vendorExtensions.put("x-formParamName", camelize(param.baseName)); + param.vendorExtensions.put("x-formParamName", org.openapitools.codegen.utils.StringUtils.camelize(param.baseName)); } // Add the HTTP method and return type @@ -494,21 +507,26 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf op.vendorExtensions.put("x-routeType", joinStrings(" :> ", path)); op.vendorExtensions.put("x-clientType", joinStrings(" -> ", type)); - op.vendorExtensions.put("x-formName", "Form" + camelize(op.operationId)); - for(CodegenParameter param : op.formParams) { - param.vendorExtensions.put("x-formPrefix", camelize(op.operationId, true)); + op.vendorExtensions.put("x-formName", "Form" + org.openapitools.codegen.utils.StringUtils.camelize(op.operationId)); + for (CodegenParameter param : op.formParams) { + param.vendorExtensions.put("x-formPrefix", org.openapitools.codegen.utils.StringUtils.camelize(op.operationId, true)); } return op; } private String makeQueryListType(String type, String collectionFormat) { type = type.substring(1, type.length() - 1); - switch(collectionFormat) { - case "csv": return "(QueryList 'CommaSeparated (" + type + "))"; - case "tsv": return "(QueryList 'TabSeparated (" + type + "))"; - case "ssv": return "(QueryList 'SpaceSeparated (" + type + "))"; - case "pipes": return "(QueryList 'PipeSeparated (" + type + "))"; - case "multi": return "(QueryList 'MultiParamArray (" + type + "))"; + switch (collectionFormat) { + case "csv": + return "(QueryList 'CommaSeparated (" + type + "))"; + case "tsv": + return "(QueryList 'TabSeparated (" + type + "))"; + case "ssv": + return "(QueryList 'SpaceSeparated (" + type + "))"; + case "pipes": + return "(QueryList 'PipeSeparated (" + type + "))"; + case "multi": + return "(QueryList 'MultiParamArray (" + type + "))"; default: throw new UnsupportedOperationException(); } @@ -549,19 +567,19 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf // Clean up the class name to remove invalid characters model.classname = fixModelChars(model.classname); - if(typeMapping.containsValue(model.classname)) { + if (typeMapping.containsValue(model.classname)) { model.classname += "_"; } // From the model name, compute the prefix for the fields. - String prefix = camelize(model.classname, true); - for(CodegenProperty prop : model.vars) { - prop.name = toVarName(prefix + camelize(fixOperatorChars(prop.name))); + String prefix = org.openapitools.codegen.utils.StringUtils.camelize(model.classname, true); + for (CodegenProperty prop : model.vars) { + prop.name = toVarName(prefix + org.openapitools.codegen.utils.StringUtils.camelize(fixOperatorChars(prop.name))); } // Create newtypes for things with non-object types String dataOrNewtype = "data"; - if(model.dataType != "object" && typeMapping.containsKey(model.dataType)) { + if (!"object".equals(model.dataType) && typeMapping.containsKey(model.dataType)) { String newtype = typeMapping.get(model.dataType); model.vendorExtensions.put("x-customNewtype", newtype); } @@ -584,4 +602,30 @@ public class HaskellServantCodegen extends DefaultCodegen implements CodegenConf return input.replace("{-", "{_-").replace("-}", "-_}"); } + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + String haskellPostProcessFile = System.getenv("HASKELL_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(haskellPostProcessFile)) { + return; // skip if HASKELL_POST_PROCESS_FILE env variable is not defined + } + + // only process files with hs extension + if ("hs".equals(FilenameUtils.getExtension(file.toString()))) { + String command = haskellPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } } 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 a7a5046ea3d..8bbaec641c7 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 @@ -17,10 +17,6 @@ package org.openapitools.codegen.languages; -import static com.google.common.base.CaseFormat.LOWER_CAMEL; -import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE; -import static java.util.Collections.sort; - import org.apache.commons.lang3.BooleanUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CliOption; @@ -43,12 +39,14 @@ import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.regex.Pattern; +import static com.google.common.base.CaseFormat.LOWER_CAMEL; +import static com.google.common.base.CaseFormat.UPPER_UNDERSCORE; +import static java.util.Collections.sort; + public class JavaClientCodegen extends AbstractJavaCodegen implements BeanValidationFeatures, PerformBeanValidationFeatures, GzipFeatures { @@ -62,11 +60,16 @@ public class JavaClientCodegen extends AbstractJavaCodegen public static final String DO_NOT_USE_RX = "doNotUseRx"; public static final String USE_PLAY_WS = "usePlayWS"; public static final String PLAY_VERSION = "playVersion"; + public static final String FEIGN_VERSION = "feignVersion"; public static final String PARCELABLE_MODEL = "parcelableModel"; public static final String USE_RUNTIME_EXCEPTION = "useRuntimeException"; public static final String PLAY_24 = "play24"; public static final String PLAY_25 = "play25"; + public static final String PLAY_26 = "play26"; + + public static final String FEIGN_9 = "9.x"; + public static final String FEIGN_10 = "10.x"; public static final String FEIGN = "feign"; public static final String GOOGLE_API_CLIENT = "google-api-client"; @@ -87,6 +90,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen protected boolean doNotUseRx = true; // backwards compatibility for swagger configs that specify neither rx1 nor rx2 (mustache does not allow for boolean operators so we need this extra field) protected boolean usePlayWS = false; protected String playVersion = PLAY_25; + protected String feignVersion = FEIGN_9; protected boolean parcelableModel = false; protected boolean useBeanValidation = false; protected boolean performBeanValidation = false; @@ -107,15 +111,16 @@ public class JavaClientCodegen extends AbstractJavaCodegen cliOptions.add(CliOption.newBoolean(USE_RX_JAVA2, "Whether to use the RxJava2 adapter with the retrofit2 library.")); cliOptions.add(CliOption.newBoolean(PARCELABLE_MODEL, "Whether to generate models for Android that implement Parcelable with the okhttp-gson library.")); cliOptions.add(CliOption.newBoolean(USE_PLAY_WS, "Use Play! Async HTTP client (Play WS API)")); - cliOptions.add(CliOption.newString(PLAY_VERSION, "Version of Play! Framework (possible values \"play24\", \"play25\")")); + cliOptions.add(CliOption.newString(PLAY_VERSION, "Version of Play! Framework (possible values \"play24\", \"play25\" (default), \"play26\")")); cliOptions.add(CliOption.newBoolean(SUPPORT_JAVA6, "Whether to support Java6 with the Jersey1 library.")); cliOptions.add(CliOption.newBoolean(USE_BEANVALIDATION, "Use BeanValidation API annotations")); cliOptions.add(CliOption.newBoolean(PERFORM_BEANVALIDATION, "Perform BeanValidation")); cliOptions.add(CliOption.newBoolean(USE_GZIP_FEATURE, "Send gzip-encoded requests")); cliOptions.add(CliOption.newBoolean(USE_RUNTIME_EXCEPTION, "Use RuntimeException instead of Exception")); + cliOptions.add(CliOption.newBoolean(FEIGN_VERSION, "Version of OpenFeign: '10.x', '9.x' (default)")); supportedLibraries.put(JERSEY1, "HTTP client: Jersey client 1.19.4. JSON processing: Jackson 2.8.9. Enable Java6 support using '-DsupportJava6=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); - supportedLibraries.put(FEIGN, "HTTP client: OpenFeign 9.4.0. JSON processing: Jackson 2.8.9"); + supportedLibraries.put(FEIGN, "HTTP client: OpenFeign 9.4.0. JSON processing: Jackson 2.8.9. To enable OpenFeign 10.x, set the 'feignVersion' option to '10.x'"); supportedLibraries.put(JERSEY2, "HTTP client: Jersey client 2.25.1. JSON processing: Jackson 2.8.9"); supportedLibraries.put(OKHTTP_GSON, "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.8.1. Enable Parcelable models on Android using '-DparcelableModel=true'. Enable gzip request encoding using '-DuseGzipFeature=true'."); supportedLibraries.put(RETROFIT_1, "HTTP client: OkHttp 2.7.5. JSON processing: Gson 2.3.1 (Retrofit 1.9.0). IMPORTANT NOTE: retrofit1.x is no longer actively maintained so please upgrade to 'retrofit2' instead."); @@ -148,7 +153,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen @Override public String getHelp() { - return "Generates a Java client library."; + 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 @@ -159,6 +164,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen super.processOpts(); + // RxJava if (additionalProperties.containsKey(USE_RX_JAVA) && additionalProperties.containsKey(USE_RX_JAVA2)) { LOGGER.warn("You specified both RxJava versions 1 and 2 but they are mutually exclusive. Defaulting to v2."); } else if (additionalProperties.containsKey(USE_RX_JAVA)) { @@ -170,6 +176,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen if (!useRxJava && !useRxJava2) { additionalProperties.put(DO_NOT_USE_RX, true); } + + // Java Play if (additionalProperties.containsKey(USE_PLAY_WS)) { this.setUsePlayWS(Boolean.valueOf(additionalProperties.get(USE_PLAY_WS).toString())); } @@ -180,6 +188,20 @@ public class JavaClientCodegen extends AbstractJavaCodegen } additionalProperties.put(PLAY_VERSION, playVersion); + // OpenFeign + if (additionalProperties.containsKey(FEIGN_VERSION)) { + this.setFeignVersion(additionalProperties.get(FEIGN_VERSION).toString()); + + if ("10.x".equals(feignVersion)) { + additionalProperties.put("useFeign10", true); + } else if ("9.x".equals(feignVersion)) { + // do nothing as 9.x is the default + } else { + throw new RuntimeException("Ivalid feignOoption '{}'. Must be '10.x' or '9.x'."); + } + } + additionalProperties.put(FEIGN_VERSION, feignVersion); + if (additionalProperties.containsKey(PARCELABLE_MODEL)) { this.setParcelableModel(Boolean.valueOf(additionalProperties.get(PARCELABLE_MODEL).toString())); } @@ -266,6 +288,8 @@ public class JavaClientCodegen extends AbstractJavaCodegen supportingFiles.add(new SupportingFile("ProgressRequestBody.mustache", invokerFolder, "ProgressRequestBody.java")); supportingFiles.add(new SupportingFile("ProgressResponseBody.mustache", invokerFolder, "ProgressResponseBody.java")); supportingFiles.add(new SupportingFile("GzipRequestInterceptor.mustache", invokerFolder, "GzipRequestInterceptor.java")); + supportingFiles.add(new SupportingFile("auth/OAuthOkHttpClient.mustache", authFolder, "OAuthOkHttpClient.java")); + supportingFiles.add(new SupportingFile("auth/RetryingOAuth.mustache", authFolder, "RetryingOAuth.java")); additionalProperties.put("gson", "true"); } else if (usesAnyRetrofitLibrary()) { supportingFiles.add(new SupportingFile("auth/OAuthOkHttpClient.mustache", authFolder, "OAuthOkHttpClient.java")); @@ -333,7 +357,9 @@ public class JavaClientCodegen extends AbstractJavaCodegen supportingFiles.add(new SupportingFile("play24/Play24CallFactory.mustache", invokerFolder, "Play24CallFactory.java")); supportingFiles.add(new SupportingFile("play24/Play24CallAdapterFactory.mustache", invokerFolder, "Play24CallAdapterFactory.java")); - } else { + } + + if (PLAY_25.equals(playVersion)) { additionalProperties.put(PLAY_25, true); apiTemplateFiles.put("play25/api.mustache", ".java"); @@ -344,6 +370,17 @@ public class JavaClientCodegen extends AbstractJavaCodegen additionalProperties.put("java8", "true"); } + if (PLAY_26.equals(playVersion)) { + additionalProperties.put(PLAY_26, true); + apiTemplateFiles.put("play26/api.mustache", ".java"); + + supportingFiles.add(new SupportingFile("play26/ApiClient.mustache", invokerFolder, "ApiClient.java")); + supportingFiles.add(new SupportingFile("play26/Play26CallFactory.mustache", invokerFolder, "Play26CallFactory.java")); + supportingFiles.add(new SupportingFile("play26/Play26CallAdapterFactory.mustache", invokerFolder, + "Play26CallAdapterFactory.java")); + additionalProperties.put("java8", "true"); + } + supportingFiles.add(new SupportingFile("play-common/auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java")); supportingFiles.add(new SupportingFile("auth/Authentication.mustache", authFolder, "Authentication.java")); supportingFiles.add(new SupportingFile("Pair.mustache", invokerFolder, "Pair.java")); @@ -426,7 +463,7 @@ public class JavaClientCodegen extends AbstractJavaCodegen for (int i = 0; i < items.length; ++i) { if (items[i].matches("^\\{(.*)\\}$")) { // wrap in {} // camelize path variable - items[i] = "{" + camelize(items[i].substring(1, items[i].length() - 1), true) + "}"; + items[i] = "{" + org.openapitools.codegen.utils.StringUtils.camelize(items[i].substring(1, items[i].length() - 1), true) + "}"; } } op.path = StringUtils.join(items, "/"); @@ -567,6 +604,10 @@ public class JavaClientCodegen extends AbstractJavaCodegen this.playVersion = playVersion; } + public void setFeignVersion(String feignVersion) { + this.feignVersion = feignVersion; + } + public void setParcelableModel(boolean parcelableModel) { this.parcelableModel = parcelableModel; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java index 6cd8ad9815a..30b04743158 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaInflectorServerCodegen.java @@ -34,6 +34,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; + public class JavaInflectorServerCodegen extends AbstractJavaCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(JavaInflectorServerCodegen.class); @@ -226,6 +227,6 @@ public class JavaInflectorServerCodegen extends AbstractJavaCodegen { return "DefaultController"; } name = name.replaceAll("[^a-zA-Z0-9]+", "_"); - return camelize(name) + "Controller"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Controller"; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java index 3a7cb617d13..e3459031019 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaJAXRSSpecServerCodegen.java @@ -19,6 +19,7 @@ package org.openapitools.codegen.languages; import io.swagger.v3.oas.models.Operation; import io.swagger.v3.oas.models.media.Schema; + import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConstants; @@ -32,6 +33,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; + public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { public static final String INTERFACE_ONLY = "interfaceOnly"; @@ -130,6 +132,7 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { super.processOpts(); supportingFiles.clear(); // Don't need extra files provided by AbstractJAX-RS & Java Codegen + writeOptional(outputFolder, new SupportingFile("README.mustache", "", "README.md")); if (generatePom) { writeOptional(outputFolder, new SupportingFile("pom.mustache", "", "pom.xml")); } @@ -219,6 +222,6 @@ public class JavaJAXRSSpecServerCodegen extends AbstractJavaJAXRSServerCodegen { return primaryResourceName + "Api"; } computed = sanitizeName(computed); - return camelize(computed) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(computed) + "Api"; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPKMSTServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPKMSTServerCodegen.java index 40932e20231..aa638d5d25e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPKMSTServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPKMSTServerCodegen.java @@ -41,6 +41,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; + /** * Created by prokarma on 04/09/17. */ @@ -545,7 +546,7 @@ public class JavaPKMSTServerCodegen extends AbstractJavaCodegen { title = title.substring(0, title.length() - 3); } - this.title = camelize(sanitizeName(title), true); + this.title = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(title), true); } additionalProperties.put(TITLE, this.title); } @@ -594,7 +595,7 @@ public class JavaPKMSTServerCodegen extends AbstractJavaCodegen { return "DefaultApi"; } name = sanitizeName(name); - return camelize(name) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java index 64b14186654..4fb3905280c 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaPlayFrameworkCodegen.java @@ -35,6 +35,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; + public class JavaPlayFrameworkCodegen extends AbstractJavaCodegen implements BeanValidationFeatures { public static final String TITLE = "title"; @@ -301,7 +302,7 @@ public class JavaPlayFrameworkCodegen extends AbstractJavaCodegen implements Bea Matcher match = pathVariableMatcher.matcher(operation.path); while (match.find()) { String completeMatch = match.group(); - String replacement = ":" + camelize(match.group(1), true); + String replacement = ":" + org.openapitools.codegen.utils.StringUtils.camelize(match.group(1), true); operation.path = operation.path.replace(completeMatch, replacement); } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java index 2be6e497707..5c602bf2ca2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavaUndertowServerCodegen.java @@ -30,6 +30,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; + public class JavaUndertowServerCodegen extends AbstractJavaCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(JavaUndertowServerCodegen.class); @@ -201,6 +202,6 @@ public class JavaUndertowServerCodegen extends AbstractJavaCodegen { return "DefaultHandler"; } name = name.replaceAll("[^a-zA-Z0-9]+", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. - return camelize(name) + "Handler"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Handler"; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java index 2991842b88d..ab94690dd86 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClientCodegen.java @@ -24,6 +24,7 @@ import io.swagger.v3.oas.models.info.License; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.io.FilenameUtils; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConfig; import org.openapitools.codegen.CodegenConstants; @@ -231,6 +232,10 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo } super.processOpts(); + if (StringUtils.isEmpty(System.getenv("JS_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable JS_POST_PROCESS_FILE not defined so the JS code may not be properly formatted. To define it, try 'export JS_POST_PROCESS_FILE=\"/usr/local/bin/js-beautify -r -f\"' (Linux/Mac)"); + } + if (additionalProperties.containsKey(PROJECT_NAME)) { setProjectName(((String) additionalProperties.get(PROJECT_NAME))); } @@ -283,7 +288,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo Info info = openAPI.getInfo(); if (StringUtils.isBlank(projectName) && info.getTitle() != null) { // when projectName is not specified, generate it from info.title - projectName = sanitizeName(dashize(info.getTitle())); + projectName = sanitizeName(org.openapitools.codegen.utils.StringUtils.dashize(info.getTitle())); } if (StringUtils.isBlank(projectVersion)) { // when projectVersion is not specified, use info.version @@ -306,7 +311,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo projectName = "openapi-js-client"; } if (StringUtils.isBlank(moduleName)) { - moduleName = camelize(underscore(projectName)); + moduleName = org.openapitools.codegen.utils.StringUtils.camelize(org.openapitools.codegen.utils.StringUtils.underscore(projectName)); } if (StringUtils.isBlank(projectVersion)) { projectVersion = "1.0.0"; @@ -501,9 +506,9 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo private String getNameUsingModelPropertyNaming(String name) { switch (CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.valueOf(getModelPropertyNaming())) { case original: return name; - case camelCase: return camelize(name, true); - case PascalCase: return camelize(name); - case snake_case: return underscore(name); + case camelCase: return org.openapitools.codegen.utils.StringUtils.camelize(name, true); + case PascalCase: return org.openapitools.codegen.utils.StringUtils.camelize(name); + case snake_case: return org.openapitools.codegen.utils.StringUtils.underscore(name); default: throw new IllegalArgumentException("Invalid model property naming '" + name + "'. Must be 'original', 'camelCase', " + "'PascalCase' or 'snake_case'"); @@ -556,7 +561,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo // camelize the model name // phone_number => PhoneNumber - name = camelize(name); + name = org.openapitools.codegen.utils.StringUtils.camelize(name); // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { @@ -825,18 +830,18 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo throw new RuntimeException("Empty method/operation name (operationId) not allowed"); } - operationId = camelize(sanitizeName(operationId), true); + operationId = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true); // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - String newOperationId = camelize("call_" + operationId, true); + String newOperationId = org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId, true); LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); return newOperationId; } // operationId starts with a number if (operationId.matches("^\\d.*")) { - String newOperationId = camelize("call_" + operationId, true); + String newOperationId = org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId, true); LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + newOperationId); return newOperationId; } @@ -1118,7 +1123,7 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo @Override public String toEnumName(CodegenProperty property) { - return sanitizeName(camelize(property.name)) + "Enum"; + return sanitizeName(org.openapitools.codegen.utils.StringUtils.camelize(property.name)) + "Enum"; } @Override @@ -1156,4 +1161,31 @@ public class JavascriptClientCodegen extends DefaultCodegen implements CodegenCo return input.replace("*/", "*_/").replace("/*", "/_*"); } + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String jsPostProcessFile = System.getenv("JS_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(jsPostProcessFile)) { + return; // skip if JS_POST_PROCESS_FILE env variable is not defined + } + + // only process files with js extension + if ("js".equals(FilenameUtils.getExtension(file.toString()))) { + String command = jsPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + p.waitFor(); + int exitValue = p.exitValue(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); + } + LOGGER.info("Successfully executed: " + command); + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClosureAngularClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClosureAngularClientCodegen.java index c756bf8ac9b..6e8182c5077 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClosureAngularClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClosureAngularClientCodegen.java @@ -42,6 +42,7 @@ import java.io.File; import org.apache.commons.lang3.StringUtils; + public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(JavascriptClosureAngularClientCodegen.class); @@ -187,7 +188,7 @@ public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implem // camelize the variable name // pet_id => PetId - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) @@ -214,13 +215,13 @@ public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implem // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. return => ModelReturn (after camelize) } // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override @@ -304,11 +305,11 @@ public class JavascriptClosureAngularClientCodegen extends DefaultCodegen implem throw new RuntimeException("Empty method/operation name (operationId) not allowed"); } - operationId = camelize(sanitizeName(operationId), true); + operationId = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true); // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - String newOperationId = camelize("call_" + operationId, true); + String newOperationId = org.openapitools.codegen.utils.StringUtils.camelize("call_" + operationId, true); LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); return newOperationId; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptFlowtypedClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptFlowtypedClientCodegen.java index cc0c78c387f..003b2f305ca 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptFlowtypedClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptFlowtypedClientCodegen.java @@ -29,6 +29,7 @@ import org.openapitools.codegen.utils.ModelUtils; import java.text.SimpleDateFormat; import java.util.*; + public class JavascriptFlowtypedClientCodegen extends AbstractTypeScriptClientCodegen { private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm", Locale.ROOT); @@ -185,7 +186,7 @@ public class JavascriptFlowtypedClientCodegen extends AbstractTypeScriptClientCo Info info = openAPI.getInfo(); if (StringUtils.isBlank(npmName) && info.getTitle() != null) { // when projectName is not specified, generate it from info.title - npmName = sanitizeName(dashize(info.getTitle())); + npmName = sanitizeName(org.openapitools.codegen.utils.StringUtils.dashize(info.getTitle())); } if (StringUtils.isBlank(npmVersion)) { // when projectVersion is not specified, use info.version diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java new file mode 100644 index 00000000000..fb79272c9f5 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/KotlinSpringServerCodegen.java @@ -0,0 +1,564 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.languages; + +import com.google.common.collect.ImmutableMap; +import com.samskivert.mustache.Mustache; +import com.samskivert.mustache.Template; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.media.Schema; +import org.openapitools.codegen.*; +import org.openapitools.codegen.languages.features.BeanValidationFeatures; +import org.openapitools.codegen.utils.URLPathUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.File; +import java.io.IOException; +import java.io.Writer; +import java.net.URL; +import java.util.*; +import java.util.regex.Matcher; +import java.util.stream.Collectors; + + +public class KotlinSpringServerCodegen extends AbstractKotlinCodegen + implements BeanValidationFeatures { + + private static Logger LOGGER = + LoggerFactory.getLogger(KotlinSpringServerCodegen.class); + + private static final HashSet VARIABLE_RESERVED_WORDS = + new HashSet(Arrays.asList( + "ApiClient", + "ApiException", + "ApiResponse" + )); + + public static final String TITLE = "title"; + public static final String LAMBDA = "lambda"; + public static final String SERVER_PORT = "serverPort"; + public static final String BASE_PACKAGE = "basePackage"; + public static final String SPRING_BOOT = "spring-boot"; + public static final String EXCEPTION_HANDLER = "exceptionHandler"; + public static final String GRADLE_BUILD_FILE = "gradleBuildFile"; + public static final String SWAGGER_ANNOTATIONS = "swaggerAnnotations"; + public static final String SERVICE_INTERFACE = "serviceInterface"; + public static final String SERVICE_IMPLEMENTATION = "serviceImplementation"; + + private String basePackage; + private String invokerPackage; + private String serverPort = "8080"; + private String title = "OpenAPI Kotlin Spring"; + private String resourceFolder = "src/main/resources"; + private boolean useBeanValidation = true; + private boolean exceptionHandler = true; + private boolean gradleBuildFile = true; + private boolean swaggerAnnotations = false; + private boolean serviceInterface = false; + private boolean serviceImplementation = false; + + public KotlinSpringServerCodegen() { + super(); + + reservedWords.addAll(VARIABLE_RESERVED_WORDS); + + outputFolder = "generated-code/kotlin-spring"; + apiTestTemplateFiles.clear(); // TODO: add test template + embeddedTemplateDir = templateDir = "kotlin-spring"; + + artifactId = "openapi-spring"; + basePackage = invokerPackage = "org.openapitools"; + apiPackage = "org.openapitools.api"; + modelPackage = "org.openapitools.model"; + + // Use lists instead of arrays + typeMapping.put("array", "List"); + typeMapping.put("string", "String"); + typeMapping.put("boolean", "Boolean"); + typeMapping.put("integer", "Int"); + typeMapping.put("float", "Float"); + typeMapping.put("long", "Long"); + typeMapping.put("double", "Double"); + typeMapping.put("ByteArray", "ByteArray"); + typeMapping.put("list", "List"); + typeMapping.put("map", "Map"); + typeMapping.put("object", "Any"); + typeMapping.put("binary", "Array"); + + languageSpecificPrimitives.addAll(Arrays.asList( + "Any", + "Byte", + "ByteArray", + "Short", + "Int", + "Long", + "Float", + "Double", + "Boolean", + "Char", + "String", + "Array", + "List", + "Map", + "Set" + )); + + addOption(TITLE, "server title name or client service name", title); + addOption(BASE_PACKAGE, "base package (invokerPackage) for generated code", basePackage); + addOption(SERVER_PORT, "configuration the port in which the sever is to run on", serverPort); + addOption(CodegenConstants.MODEL_PACKAGE, "model package for generated code", modelPackage); + addOption(CodegenConstants.API_PACKAGE, "api package for generated code", apiPackage); + addSwitch(EXCEPTION_HANDLER, "generate default global exception handlers", exceptionHandler); + addSwitch(GRADLE_BUILD_FILE, "generate a gradle build file using the Kotlin DSL", gradleBuildFile); + addSwitch(SWAGGER_ANNOTATIONS, "generate swagger annotations to go alongside controllers and models", swaggerAnnotations); + addSwitch(SERVICE_INTERFACE, "generate service interfaces to go alongside controllers. In most " + + "cases this option would be used to update an existing project, so not to override implementations. " + + "Useful to help facilitate the generation gap pattern", serviceInterface); + addSwitch(SERVICE_IMPLEMENTATION, "generate stub service implementations that extends service " + + "interfaces. If this is set to true service interfaces will also be generated", serviceImplementation); + addSwitch(USE_BEANVALIDATION, "Use BeanValidation API annotations to validate data types", useBeanValidation); + + supportedLibraries.put(SPRING_BOOT, "Spring-boot Server application."); + setLibrary(SPRING_BOOT); + + CliOption cliOpt = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use"); + cliOpt.setDefault(SPRING_BOOT); + cliOpt.setEnum(supportedLibraries); + cliOptions.add(cliOpt); + } + + public String getResourceFolder() { + return this.resourceFolder; + } + + public void setResourceFolder(String resourceFolder) { + this.resourceFolder = resourceFolder; + } + + public String getBasePackage() { + return this.basePackage; + } + + public void setBasePackage(String basePackage) { + this.basePackage = basePackage; + } + + public String getInvokerPackage() { + return this.invokerPackage; + } + + public void setInvokerPackage(String invokerPackage) { + this.invokerPackage = invokerPackage; + } + + public String getServerPort() { + return this.serverPort; + } + + public void setServerPort(String serverPort) { + this.serverPort = serverPort; + } + + public boolean getExceptionHandler() { + return this.exceptionHandler; + } + + public void setExceptionHandler(boolean exceptionHandler) { + this.exceptionHandler = exceptionHandler; + } + + public boolean getGradleBuildFile() { + return this.gradleBuildFile; + } + + public void setGradleBuildFile(boolean gradleBuildFile) { + this.gradleBuildFile = gradleBuildFile; + } + + public boolean getSwaggerAnnotations() { + return this.swaggerAnnotations; + } + + public void setSwaggerAnnotations(boolean swaggerAnnotations) { + this.swaggerAnnotations = swaggerAnnotations; + } + + public boolean getServiceInterface() { + return this.serviceInterface; + } + + public void setServiceInterface(boolean serviceInterface) { + this.serviceInterface = serviceInterface; + } + + public boolean getServiceImplementation() { + return this.serviceImplementation; + } + + public void setServiceImplementation(boolean serviceImplementation) { + this.serviceImplementation = serviceImplementation; + } + + public boolean getUseBeanValidation() { + return this.useBeanValidation; + } + + @Override + public void setUseBeanValidation(boolean useBeanValidation) { + this.useBeanValidation = useBeanValidation; + } + + @Override + public CodegenType getTag() { + return CodegenType.SERVER; + } + + @Override + public String getName() { + return "kotlin-spring"; + } + + @Override + public String getHelp() { + return "Generates a Kotlin Spring application."; + } + + @Override + public void processOpts() { + super.processOpts(); + + typeMapping.put("date", "java.time.LocalDate"); + typeMapping.put("date-time", "java.time.OffsetDateTime"); + typeMapping.put("Date", "java.time.LocalDate"); + typeMapping.put("DateTime", "java.time.OffsetDateTime"); + + importMapping.put("Date", "java.time.LocalDate"); + importMapping.put("DateTime", "java.time.OffsetDateTime"); + + // optional jackson mappings for BigDecimal support + importMapping.put("ToStringSerializer", "com.fasterxml.jackson.databind.ser.std.ToStringSerializer"); + importMapping.put("JsonSerialize", "com.fasterxml.jackson.databind.annotation.JsonSerialize"); + + // Swagger import mappings + importMapping.put("ApiModel", "io.swagger.annotations.ApiModel"); + importMapping.put("ApiModelProperty", "io.swagger.annotations.ApiModelProperty"); + + // Jackson import mappings + importMapping.put("JsonValue", "com.fasterxml.jackson.annotation.JsonValue"); + importMapping.put("JsonCreator", "com.fasterxml.jackson.annotation.JsonCreator"); + importMapping.put("JsonProperty", "com.fasterxml.jackson.annotation.JsonProperty"); + importMapping.put("JsonSubTypes", "com.fasterxml.jackson.annotation.JsonSubTypes"); + importMapping.put("JsonTypeInfo", "com.fasterxml.jackson.annotation.JsonTypeInfo"); + // import JsonCreator if JsonProperty is imported + // used later in recursive import in postProcessingModels + importMapping.put("com.fasterxml.jackson.annotation.JsonProperty", "com.fasterxml.jackson.annotation.JsonCreator"); + + if (!additionalProperties.containsKey(CodegenConstants.LIBRARY)) { + additionalProperties.put(CodegenConstants.LIBRARY, library); + } + + // Set basePackage from invokerPackage + if (!additionalProperties.containsKey(BASE_PACKAGE) + && additionalProperties.containsKey(CodegenConstants.INVOKER_PACKAGE)) { + this.setBasePackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); + this.setInvokerPackage((String) additionalProperties.get(CodegenConstants.INVOKER_PACKAGE)); + additionalProperties.put(BASE_PACKAGE, basePackage); + LOGGER.info("Set base package to invoker package (" + basePackage + ")"); + } + + if (additionalProperties.containsKey(BASE_PACKAGE)) { + this.setBasePackage((String) additionalProperties.get(BASE_PACKAGE)); + } else { + additionalProperties.put(BASE_PACKAGE, basePackage); + } + + if (additionalProperties.containsKey(SERVER_PORT)) { + this.setServerPort((String) additionalProperties.get(SERVER_PORT)); + } else { + additionalProperties.put(SERVER_PORT, serverPort); + } + + if (additionalProperties.containsKey(EXCEPTION_HANDLER)) { + this.setExceptionHandler(Boolean.valueOf(additionalProperties.get(EXCEPTION_HANDLER).toString())); + } + writePropertyBack(EXCEPTION_HANDLER, exceptionHandler); + + if (additionalProperties.containsKey(GRADLE_BUILD_FILE)) { + this.setGradleBuildFile(Boolean.valueOf(additionalProperties.get(GRADLE_BUILD_FILE).toString())); + } + writePropertyBack(GRADLE_BUILD_FILE, gradleBuildFile); + + if (additionalProperties.containsKey(SWAGGER_ANNOTATIONS)) { + this.setSwaggerAnnotations(Boolean.valueOf(additionalProperties.get(SWAGGER_ANNOTATIONS).toString())); + } + writePropertyBack(SWAGGER_ANNOTATIONS, swaggerAnnotations); + + if (additionalProperties.containsKey(SERVICE_INTERFACE)) { + this.setServiceInterface(Boolean.valueOf(additionalProperties.get(SERVICE_INTERFACE).toString())); + } + writePropertyBack(SERVICE_INTERFACE, serviceInterface); + + if (additionalProperties.containsKey(SERVICE_IMPLEMENTATION)) { + this.setServiceImplementation(Boolean.valueOf(additionalProperties.get(SERVICE_IMPLEMENTATION).toString())); + } + writePropertyBack(SERVICE_IMPLEMENTATION, serviceImplementation); + + if (additionalProperties.containsKey(USE_BEANVALIDATION)) { + this.setUseBeanValidation(convertPropertyToBoolean(USE_BEANVALIDATION)); + } + writePropertyBack(USE_BEANVALIDATION, useBeanValidation); + + modelTemplateFiles.put("model.mustache", ".kt"); + apiTemplateFiles.put("api.mustache", ".kt"); + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + + if (this.serviceInterface) { + apiTemplateFiles.put("service.mustache", "Service.kt"); + } else if (this.serviceImplementation) { + LOGGER.warn("If you set `serviceImplementation` to true, `serviceInterface` will also be set to true"); + additionalProperties.put(SERVICE_INTERFACE, true); + apiTemplateFiles.put("service.mustache", "Service.kt"); + apiTemplateFiles.put("serviceImpl.mustache", "ServiceImpl.kt"); + } + + if (this.exceptionHandler) { + supportingFiles.add(new SupportingFile("exceptions.mustache", + sanitizeDirectory(sourceFolder + File.separator + apiPackage), "Exceptions.kt")); + } + + if (library.equals(SPRING_BOOT)) { + LOGGER.info("Setup code generator for Kotlin Spring Boot"); + supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml")); + + if (this.gradleBuildFile) { + supportingFiles.add(new SupportingFile("buildGradleKts.mustache", "", "build.gradle.kts")); + supportingFiles.add(new SupportingFile("settingsGradle.mustache", "", "settings.gradle")); + } + + supportingFiles.add(new SupportingFile("application.mustache", resourceFolder, "application.yaml")); + supportingFiles.add(new SupportingFile("springBootApplication.mustache", + sanitizeDirectory(sourceFolder + File.separator + basePackage), "Application.kt")); + } + + addMustacheLambdas(additionalProperties); + + // spring uses the jackson lib, and we disallow configuration. + additionalProperties.put("jackson", "true"); + } + + private void addMustacheLambdas(final Map objs) { + Map lambdas = + new ImmutableMap.Builder() + .put("escapeDoubleQuote", new EscapeLambda("\"", "\\\"")) + .build(); + + if (objs.containsKey(LAMBDA)) { + LOGGER.warn("The lambda property is a reserved word, and will be overwritten!"); + } + objs.put(LAMBDA, lambdas); + } + + @Override + public void preprocessOpenAPI(OpenAPI openAPI) { + super.preprocessOpenAPI(openAPI); + + if (!additionalProperties.containsKey(TITLE)) { + // The purpose of the title is for: + // - README documentation + // - The spring.application.name + // - And linking the @RequestMapping + // This is an additional step we add when pre-processing the API spec, if + // there is no user configuration set for the `title` of the project, + // we try build and normalise a title from the API spec itself. + String title = openAPI.getInfo().getTitle(); + + // Drop any API suffix + if (title != null) { + title = title.trim().replace(" ", "-"); + if (title.toUpperCase(Locale.ROOT).endsWith("API")) + title = title.substring(0, title.length() - 3); + + this.title = camelize(sanitizeName(title), true); + } + additionalProperties.put(TITLE, this.title); + } + + if (!additionalProperties.containsKey(SERVER_PORT)) { + URL url = URLPathUtils.getServerURL(openAPI); + this.additionalProperties.put(SERVER_PORT, URLPathUtils.getPort(url, 8080)); + } + + // TODO: Handle tags + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + super.postProcessModelProperty(model, property); + + if ("null".equals(property.example)) { + property.example = null; + } + + //Add imports for Jackson + if (!Boolean.TRUE.equals(model.isEnum)) { + model.imports.add("JsonProperty"); + if (Boolean.TRUE.equals(model.hasEnums)) { + model.imports.add("JsonValue"); + } + } else { + //Needed imports for Jackson's JsonCreator + if (additionalProperties.containsKey("jackson")) { + model.imports.add("JsonCreator"); + } + } + + if (model.discriminator != null && additionalProperties.containsKey("jackson")) { + model.imports.addAll(Arrays.asList("JsonSubTypes", "JsonTypeInfo")); + } + } + + @Override + public Map postProcessModelsEnum(Map objs) { + objs = super.postProcessModelsEnum(objs); + + //Add imports for Jackson + List> imports = (List>) objs.get("imports"); + List models = (List) objs.get("models"); + + models.stream() + .map(mo -> (Map) mo) + .map(mo -> (CodegenModel) mo.get("model")) + .filter(cm -> Boolean.TRUE.equals(cm.isEnum) && cm.allowableValues != null) + .forEach(cm -> { + cm.imports.add(importMapping.get("JsonValue")); + Map item = new HashMap<>(); + item.put("import", importMapping.get("JsonValue")); + imports.add(item); + }); + + return objs; + } + + @Override + public Map postProcessOperationsWithModels(Map objs, List allModels) { + Map operations = (Map) objs.get("operations"); + if (operations != null) { + List ops = (List) operations.get("operation"); + ops.forEach(operation -> { + List responses = operation.responses; + if (responses != null) { + responses.forEach(resp -> { + + if ("0".equals(resp.code)) { + resp.code = "200"; + } + + doDataTypeAssignment(resp.dataType, new DataTypeAssigner() { + @Override + public void setReturnType(final String returnType) { + resp.dataType = returnType; + } + + @Override + public void setReturnContainer(final String returnContainer) { + resp.containerType = returnContainer; + } + }); + }); + } + doDataTypeAssignment(operation.returnType, new DataTypeAssigner() { + + @Override + public void setReturnType(final String returnType) { + operation.returnType = returnType; + } + + @Override + public void setReturnContainer(final String returnContainer) { + operation.returnContainer = returnContainer; + } + }); +// if(implicitHeaders){ +// removeHeadersFromAllParams(operation.allParams); +// } + }); + } + + return objs; + } + + private interface DataTypeAssigner { + void setReturnType(String returnType); + + void setReturnContainer(String returnContainer); + } + + /** + * @param returnType The return type that needs to be converted + * @param dataTypeAssigner An object that will assign the data to the respective fields in the model. + */ + private void doDataTypeAssignment(final String returnType, DataTypeAssigner dataTypeAssigner) { + if (returnType == null) { + dataTypeAssigner.setReturnType("Unit"); + } else if (returnType.startsWith("List")) { + int end = returnType.lastIndexOf(">"); + if (end > 0) { + dataTypeAssigner.setReturnType(returnType.substring("List<".length(), end).trim()); + dataTypeAssigner.setReturnContainer("List"); + } + } else if (returnType.startsWith("Map")) { + int end = returnType.lastIndexOf(">"); + if (end > 0) { + dataTypeAssigner.setReturnType(returnType.substring("Map<".length(), end).split(",")[1].trim()); + dataTypeAssigner.setReturnContainer("Map"); + } + } + } + + private static String sanitizeDirectory(String in) { + return in.replace(".", File.separator); + } + + // TODO could probably be made more generic, and moved to the `mustache` package if required by other components. + private static class EscapeLambda implements Mustache.Lambda { + private String from; + private String to; + + EscapeLambda(final String from, final String to) { + this.from = from; + this.to = Matcher.quoteReplacement(to); + } + + @Override + public void execute(Template.Fragment fragment, Writer writer) throws IOException { + writer.write(fragment.execute().replaceAll(from, to)); + } + } + + // Can't figure out the logic in DefaultCodegen but optional vars are getting duplicated when there's + // inheritance involved. Also, isInherited doesn't seem to be getting set properly ¯\_(ツ)_/¯ + @Override + public CodegenModel fromModel(String name, Schema schema, Map allDefinitions) { + CodegenModel m = super.fromModel(name, schema, allDefinitions); + + m.optionalVars = m.optionalVars.stream().distinct().collect(Collectors.toList()); + m.allVars.stream().filter(p -> !m.vars.contains(p)).forEach(p -> p.isInherited = true); + + return m; + } +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/LuaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/LuaClientCodegen.java index c41deb8be3d..9a345379021 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/LuaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/LuaClientCodegen.java @@ -43,6 +43,7 @@ import java.util.ListIterator; import java.util.Locale; import java.util.Map; + public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(LuaClientCodegen.class); @@ -202,7 +203,7 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig { if (this.reservedWordsMappings().containsKey(name)) { return this.reservedWordsMappings().get(name); } - return camelize(name) + '_'; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + '_'; } @Override @@ -225,7 +226,7 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig { // convert variable name to snake case // PetId => pet_id - name = underscore(name); + name = org.openapitools.codegen.utils.StringUtils.underscore(name); // for reserved word or word starting with number, append _ if (isReservedWord(name)) @@ -272,7 +273,7 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig { name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); } @Override @@ -281,7 +282,7 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig { name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // e.g. PetApi.lua => pet_api.lua - return underscore(name) + "_api"; + return org.openapitools.codegen.utils.StringUtils.underscore(name) + "_api"; } @Override @@ -338,7 +339,7 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toApiName(String name) { - return underscore(super.toApiName(name)); + return org.openapitools.codegen.utils.StringUtils.underscore(super.toApiName(name)); } @Override @@ -390,11 +391,11 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig { // method name cannot use reserved keyword, e.g. return if (isReservedWord(sanitizedOperationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore("call_" + operationId)); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore("call_" + operationId)); sanitizedOperationId = "call_" + sanitizedOperationId; } - return underscore(sanitizedOperationId); + return org.openapitools.codegen.utils.StringUtils.underscore(sanitizedOperationId); } @Override @@ -529,7 +530,7 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig { } // string - String enumName = sanitizeName(underscore(name).toUpperCase(Locale.ROOT)); + String enumName = sanitizeName(org.openapitools.codegen.utils.StringUtils.underscore(name).toUpperCase(Locale.ROOT)); enumName = enumName.replaceFirst("^_", ""); enumName = enumName.replaceFirst("_$", ""); @@ -542,7 +543,7 @@ public class LuaClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toEnumName(CodegenProperty property) { - String enumName = underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); + String enumName = org.openapitools.codegen.utils.StringUtils.underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); // remove [] for array or map of enum enumName = enumName.replace("[]", ""); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/MysqlSchemaCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/MysqlSchemaCodegen.java new file mode 100644 index 00000000000..6e83965cc0d --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/MysqlSchemaCodegen.java @@ -0,0 +1,1071 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.languages; + +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.CodegenType; +import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.DefaultCodegen; +import org.openapitools.codegen.CodegenConfig; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenProperty; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Vector; +import java.util.Map; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.Locale; + +public class MysqlSchemaCodegen extends DefaultCodegen implements CodegenConfig { + private static final Logger LOGGER = LoggerFactory.getLogger(MysqlSchemaCodegen.class); + + public static final String CODEGEN_VENDOR_EXTENSION_KEY = "x-mysqlSchema"; + public static final String DEFAULT_DATABASE_NAME = "defaultDatabaseName"; + public static final String JSON_DATA_TYPE_ENABLED = "jsonDataTypeEnabled"; + public static final Integer ENUM_MAX_ELEMENTS = 65535; + public static final Integer IDENTIFIER_MAX_LENGTH = 64; + + protected Vector mysqlNumericTypes = new Vector(Arrays.asList( + "BIGINT", "BIT", "BOOL", "BOOLEAN", "DEC", "DECIMAL", "DOUBLE", "DOUBLE PRECISION", "FIXED", "FLOAT", "INT", "INTEGER", "MEDIUMINT", "NUMERIC", "REAL", "SMALLINT", "TINYINT" + )); + + protected Vector mysqlDateAndTimeTypes = new Vector(Arrays.asList( + "DATE", "DATETIME", "TIME", "TIMESTAMP", "YEAR" + )); + + protected Vector mysqlStringTypes = new Vector(Arrays.asList( + "BINARY", "BLOB", "CHAR", "CHAR BYTE", "CHARACTER", "ENUM", "LONGBLOB", "LONGTEXT", "MEDIUMBLOB", "MEDIUMTEXT", "SET", "TEXT", "TINYBLOB", "TINYTEXT", "VARBINARY", "VARCHAR" + )); + + protected Vector mysqlSpatialTypes = new Vector(Arrays.asList( + "GEOMETRY", "GEOMETRYCOLLECTION", "LINESTRING", "MULTILINESTRING", "MULTIPOINT", "MULTIPOLYGON", "POINT", "POLYGON" + )); + + protected String defaultDatabaseName = "", databaseNamePrefix = "", databaseNameSuffix = "_db"; + protected String tableNamePrefix = "tbl_", tableNameSuffix = ""; + protected String columnNamePrefix = "col_", columnNameSuffix = ""; + protected Boolean jsonDataTypeEnabled = true; + + public MysqlSchemaCodegen() { + super(); + + // clear import mapping (from default generator) as mysql does not use import directives + importMapping.clear(); + + //modelTestTemplateFiles.put("model_test.mustache", ".php"); + // no doc files + // modelDocTemplateFiles.clear(); + // apiDocTemplateFiles.clear(); + + // https://dev.mysql.com/doc/refman/8.0/en/keywords.html + setReservedWordsLowerCase( + Arrays.asList( + // SQL reserved words + "ACCESSIBLE", "ADD", "ALL", "ALTER", "ANALYZE", "AND", "AS", "ASC", "ASENSITIVE", + "BEFORE", "BETWEEN", "BIGINT", "BINARY", "BLOB", "BOTH", "BY", + "CALL", "CASCADE", "CASE", "CHANGE", "CHAR", "CHARACTER", "CHECK", "COLLATE", "COLUMN", "CONDITION", "CONSTRAINT", "CONTINUE", "CONVERT", "CREATE", "CROSS", "CUBE", "CUME_DIST", "CURRENT_DATE", "CURRENT_TIME", "CURRENT_TIMESTAMP", "CURRENT_USER", "CURSOR", + "DATABASE", "DATABASES", "DAY_HOUR", "DAY_MICROSECOND", "DAY_MINUTE", "DAY_SECOND", "DEC", "DECIMAL", "DECLARE", "DEFAULT", "DELAYED", "DELETE", "DENSE_RANK", "DESC", "DESCRIBE", "DETERMINISTIC", "DISTINCT", "DISTINCTROW", "DIV", "DOUBLE", "DROP", "DUAL", + "EACH", "ELSE", "ELSEIF", "EMPTY", "ENCLOSED", "ESCAPED", "EXCEPT", "EXISTS", "EXIT", "EXPLAIN", + "FALSE", "FETCH", "FIRST_VALUE", "FLOAT", "FLOAT4", "FLOAT8", "FOR", "FORCE", "FOREIGN", "FROM", "FULLTEXT", "FUNCTION", + "GENERATED", "GET", "GRANT", "GROUP", "GROUPING", "GROUPS", + "HAVING", "HIGH_PRIORITY", "HOUR_MICROSECOND", "HOUR_MINUTE", "HOUR_SECOND", + "IF", "IGNORE", "IN", "INDEX", "INFILE", "INNER", "INOUT", "INSENSITIVE", "INSERT", "INT", "INT1", "INT2", "INT3", "INT4", "INT8", "INTEGER", "INTERVAL", "INTO", "IO_AFTER_GTIDS", "IO_BEFORE_GTIDS", "IS", "ITERATE", + "JOIN", "JSON_TABLE", + "KEY", "KEYS", "KILL", + "LAG", "LAST_VALUE", "LEAD", "LEADING", "LEAVE", "LEFT", "LIKE", "LIMIT", "LINEAR", "LINES", "LOAD", "LOCALTIME", "LOCALTIMESTAMP", "LOCK", "LONG", "LONGBLOB", "LONGTEXT", "LOOP", "LOW_PRIORITY", + "MASTER_BIND", "MASTER_SSL_VERIFY_SERVER_CERT", "MATCH", "MAXVALUE", "MEDIUMBLOB", "MEDIUMINT", "MEDIUMTEXT", "MIDDLEINT", "MINUTE_MICROSECOND", "MINUTE_SECOND", "MOD", "MODIFIES", + "NATURAL", "NOT", "NO_WRITE_TO_BINLOG", "NTH_VALUE", "NTILE", "NULL", "NUMERIC", + "OF", "ON", "OPTIMIZE", "OPTIMIZER_COSTS", "OPTION", "OPTIONALLY", "OR", "ORDER", "OUT", "OUTER", "OUTFILE", "OVER", + "PARTITION", "PERCENT_RANK", "PERSIST", "PERSIST_ONLY", "PRECISION", "PRIMARY", "PROCEDURE", "PURGE", + "RANGE", "RANK", "READ", "READS", "READ_WRITE", "REAL", "RECURSIVE", "REFERENCES", "REGEXP", "RELEASE", "RENAME", "REPEAT", "REPLACE", "REQUIRE", "RESIGNAL", "RESTRICT", "RETURN", "REVOKE", "RIGHT", "RLIKE", "ROLE", "ROW", "ROWS", "ROW_NUMBER", + "SCHEMA", "SCHEMAS", "SECOND_MICROSECOND", "SELECT", "SENSITIVE", "SEPARATOR", "SET", "SHOW", "SIGNAL", "SMALLINT", "SPATIAL", "SPECIFIC", "SQL", "SQLEXCEPTION", "SQLSTATE", "SQLWARNING", "SQL_BIG_RESULT", "SQL_CALC_FOUND_ROWS", "SQL_SMALL_RESULT", "SSL", "STARTING", "STORED", "STRAIGHT_JOIN", "SYSTEM", + "TABLE", "TERMINATED", "THEN", "TINYBLOB", "TINYINT", "TINYTEXT", "TO", "TRAILING", "TRIGGER", "TRUE", + "UNDO", "UNION", "UNIQUE", "UNLOCK", "UNSIGNED", "UPDATE", "USAGE", "USE", "USING", "UTC_DATE", "UTC_TIME", "UTC_TIMESTAMP", + "VALUES", "VARBINARY", "VARCHAR", "VARCHARACTER", "VARYING", "VIRTUAL", + "WHEN", "WHERE", "WHILE", "WINDOW", "WITH", "WRITE", + "XOR", + "YEAR_MONTH", + "ZEROFILL" + ) + ); + + // all types can be threaded as primitives except array, object and refs + languageSpecificPrimitives = new HashSet( + Arrays.asList( + "bool", + "boolean", + "int", + "integer", + "double", + "float", + "string", + "date", + "Date", + "DateTime", + "long", + "short", + "char", + "ByteArray", + "binary", + "file", + "UUID", + "BigDecimal", + "mixed", + "number", + "void", + "byte" + ) + ); + + // https://dev.mysql.com/doc/refman/8.0/en/data-types.html + typeMapping.put("array", "JSON"); + typeMapping.put("map", "JSON"); + typeMapping.put("List", "JSON"); + typeMapping.put("boolean", "BOOL"); + typeMapping.put("string", "TEXT"); + typeMapping.put("int", "INT"); + typeMapping.put("byte", "TEXT"); + typeMapping.put("float", "DECIMAL"); + typeMapping.put("number", "DECIMAL"); + typeMapping.put("date", "DATE"); + typeMapping.put("Date", "DATETIME"); + typeMapping.put("DateTime", "DATETIME"); + typeMapping.put("long", "BIGINT"); + typeMapping.put("short", "SMALLINT"); + typeMapping.put("char", "TEXT"); + typeMapping.put("double", "DECIMAL"); + typeMapping.put("object", "JSON"); + typeMapping.put("integer", "INT"); + typeMapping.put("ByteArray", "MEDIUMBLOB"); + typeMapping.put("binary", "MEDIUMBLOB"); + typeMapping.put("file", "MEDIUMBLOB"); + typeMapping.put("UUID", "TEXT"); + typeMapping.put("BigDecimal", "DECIMAL"); + + embeddedTemplateDir = templateDir = "mysql-schema"; + + // it seems that cli options from DefaultCodegen are useless here + cliOptions.clear(); + addOption(DEFAULT_DATABASE_NAME, "Default database name for all MySQL queries", defaultDatabaseName); + addSwitch(JSON_DATA_TYPE_ENABLED, "Use special JSON MySQL data type for complex model properties. Requires MySQL version 5.7.8. Generates TEXT data type when disabled", jsonDataTypeEnabled); + } + + @Override + public CodegenType getTag() { + return CodegenType.SCHEMA; + } + + @Override + public String getName() { + return "mysql-schema"; + } + + @Override + public String getHelp() { + return "Generates a MySQL schema based on the model or schema defined in the OpenAPI specification (v2, v3)."; + } + + @Override + public void processOpts() { + super.processOpts(); + + if (additionalProperties.containsKey(DEFAULT_DATABASE_NAME)) { + if (additionalProperties.get(DEFAULT_DATABASE_NAME).equals("")) { + additionalProperties.remove(DEFAULT_DATABASE_NAME); + } else { + this.setDefaultDatabaseName((String) additionalProperties.get(DEFAULT_DATABASE_NAME)); + // default database name may be escaped, need to overwrite additional prop + additionalProperties.put(DEFAULT_DATABASE_NAME, getDefaultDatabaseName()); + } + } + + if (additionalProperties.containsKey(JSON_DATA_TYPE_ENABLED)) { + this.setJsonDataTypeEnabled(Boolean.valueOf(additionalProperties.get(JSON_DATA_TYPE_ENABLED).toString())); + } else { + additionalProperties.put(JSON_DATA_TYPE_ENABLED, getJsonDataTypeEnabled()); + } + + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("mysql_schema.mustache", "", "mysql_schema.sql")); + } + + @Override + public Map postProcessModels(Map objs) { + objs = super.postProcessModels(objs); + + List models = (List) objs.get("models"); + for (Object _mo : models) { + Map mo = (Map) _mo; + CodegenModel model = (CodegenModel) mo.get("model"); + String modelName = model.getName(); + String modelDescription = model.getDescription(); + Map modelVendorExtensions = model.getVendorExtensions(); + Map mysqlSchema = new HashMap(); + Map tableDefinition = new HashMap(); + + if (modelVendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + // user already specified schema values + LOGGER.info("Found vendor extension in '" + modelName + "' model, autogeneration skipped"); + continue; + } else { + modelVendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); + mysqlSchema.put("tableDefinition", tableDefinition); + tableDefinition.put("tblName", toTableName(modelName)); + tableDefinition.put("tblComment", modelDescription); + } + } + + return objs; + } + + @Override + public void postProcessModelProperty(CodegenModel model, CodegenProperty property) { + switch (property.getDataType().toUpperCase(Locale.ROOT)) { + case "BOOL": + processBooleanTypeProperty(model, property); + break; + case "TINYINT": + case "SMALLINT": + case "INT": + case "BIGINT": + processIntegerTypeProperty(model, property); + break; + case "DECIMAL": + processDecimalTypeProperty(model, property); + break; + case "MEDIUMBLOB": + case "TEXT": + processStringTypeProperty(model, property); + break; + case "DATE": + case "DATETIME": + processDateTypeProperty(model, property); + break; + case "JSON": + processJsonTypeProperty(model, property); + break; + default: + processUnknownTypeProperty(model, property); + } + } + + /** + * Processes each model's property mapped to integer type and adds related vendor extensions + * + * @param model model + * @param property model's property + */ + public void processIntegerTypeProperty(CodegenModel model, CodegenProperty property) { + Map vendorExtensions = property.getVendorExtensions(); + Map mysqlSchema = new HashMap(); + Map columnDefinition = new HashMap(); + ArrayList columnDataTypeArguments = new ArrayList(); + String baseName = property.getBaseName(); + String dataType = property.getDataType(); + String dataFormat = property.getDataFormat(); + String description = property.getDescription(); + String minimum = property.getMinimum(); + String maximum = property.getMaximum(); + Boolean exclusiveMinimum = property.getExclusiveMinimum(); + Boolean exclusiveMaximum = property.getIExclusiveMaximum(); + String defaultValue = property.getDefaultValue(); + Boolean required = property.getRequired(); + Boolean unsigned = false; + Boolean isUuid = property.isUuid; + Boolean isEnum = property.isEnum; + + if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + // user already specified schema values + LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); + return; + } + + vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); + mysqlSchema.put("columnDefinition", columnDefinition); + columnDefinition.put("colName", toColumnName(baseName)); + + if (Boolean.TRUE.equals(isEnum)) { + Map allowableValues = property.getAllowableValues(); + List enumValues = (List) allowableValues.get("values"); + for (Integer i = 0; i < enumValues.size(); i++) { + if (i > ENUM_MAX_ELEMENTS - 1) { + LOGGER.warn("ENUM column can have maximum of " + ENUM_MAX_ELEMENTS.toString() + " distinct elements, following value will be skipped: " + (String) enumValues.get(i)); + break; + } + String value = String.valueOf(enumValues.get(i)); + columnDataTypeArguments.add(toCodegenMysqlDataTypeArgument(value, (Boolean) (i + 1 < enumValues.size()))); + } + columnDefinition.put("colDataType", "ENUM"); + columnDefinition.put("colDataTypeArguments", columnDataTypeArguments); + } else { + if ("int64".equals(dataFormat)) { + columnDefinition.put("colDataType", "BIGINT"); + } else { + Long min = (minimum != null) ? Long.parseLong(minimum) : null; + Long max = (maximum != null) ? Long.parseLong(maximum) : null; + if (exclusiveMinimum == true && min != null) min += 1; + if (exclusiveMaximum == true && max != null) max -= 1; + if (min != null && min >= 0) { + unsigned = true; + } + columnDefinition.put("colUnsigned", unsigned); + columnDefinition.put("colDataType", getMysqlMatchedIntegerDataType(min, max, unsigned)); + } + } + + if (Boolean.TRUE.equals(required)) { + columnDefinition.put("colNotNull", true); + } else { + columnDefinition.put("colNotNull", false); + try { + columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType"))); + } catch (RuntimeException exception) { + LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value"); + columnDefinition.put("colDefault", null); + } + } + + if (description != null) { + columnDefinition.put("colComment", description); + } + } + + /** + * Processes each model's property mapped to decimal type and adds related vendor extensions + * + * @param model model + * @param property model's property + */ + public void processDecimalTypeProperty(CodegenModel model, CodegenProperty property) { + Map vendorExtensions = property.getVendorExtensions(); + Map mysqlSchema = new HashMap(); + Map columnDefinition = new HashMap(); + ArrayList columnDataTypeArguments = new ArrayList(); + String baseName = property.getBaseName(); + String dataType = property.getDataType(); + String dataFormat = property.getDataFormat(); + String description = property.getDescription(); + String minimum = property.getMinimum(); + String maximum = property.getMaximum(); + Boolean exclusiveMinimum = property.getExclusiveMinimum(); + Boolean exclusiveMaximum = property.getIExclusiveMaximum(); + String defaultValue = property.getDefaultValue(); + Boolean required = property.getRequired(); + Boolean unsigned = false; + Boolean isEnum = property.isEnum; + + if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + // user already specified schema values + LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); + return; + } + + vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); + mysqlSchema.put("columnDefinition", columnDefinition); + columnDefinition.put("colName", toColumnName(baseName)); + + if (Boolean.TRUE.equals(isEnum)) { + Map allowableValues = property.getAllowableValues(); + List enumValues = (List) allowableValues.get("values"); + for (Integer i = 0; i < enumValues.size(); i++) { + if (i > ENUM_MAX_ELEMENTS - 1) { + LOGGER.warn("ENUM column can have maximum of " + ENUM_MAX_ELEMENTS.toString() + " distinct elements, following value will be skipped: " + (String) enumValues.get(i)); + break; + } + String value = String.valueOf(enumValues.get(i)); + columnDataTypeArguments.add(toCodegenMysqlDataTypeArgument(value, (Boolean) (i + 1 < enumValues.size()))); + } + columnDefinition.put("colDataType", "ENUM"); + columnDefinition.put("colDataTypeArguments", columnDataTypeArguments); + } else { + Float min = (minimum != null) ? Float.valueOf(minimum) : null; + Float max = (maximum != null) ? Float.valueOf(maximum) : null; + if (exclusiveMinimum == true && min != null) min += 1; + if (exclusiveMaximum == true && max != null) max -= 1; + if (min != null && min >= 0) { + unsigned = true; + } + columnDefinition.put("colDataType", "DECIMAL"); + columnDefinition.put("colUnsigned", unsigned); + columnDefinition.put("colDataTypeArguments", columnDataTypeArguments); + columnDataTypeArguments.add(toCodegenMysqlDataTypeArgument(20, true)); + columnDataTypeArguments.add(toCodegenMysqlDataTypeArgument(9, false)); + } + + if (Boolean.TRUE.equals(required)) { + columnDefinition.put("colNotNull", true); + } else { + columnDefinition.put("colNotNull", false); + try { + columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType"))); + } catch (RuntimeException exception) { + LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value"); + columnDefinition.put("colDefault", null); + } + } + + if (description != null) { + columnDefinition.put("colComment", description); + } + } + + /** + * Processes each model's property mapped to boolean type and adds related vendor extensions + * + * @param model model + * @param property model's property + */ + public void processBooleanTypeProperty(CodegenModel model, CodegenProperty property) { + Map vendorExtensions = property.getVendorExtensions(); + Map mysqlSchema = new HashMap(); + Map columnDefinition = new HashMap(); + ArrayList columnDataTypeArguments = new ArrayList(); + String baseName = property.getBaseName(); + String description = property.getDescription(); + String defaultValue = property.getDefaultValue(); + Boolean required = property.getRequired(); + + if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + // user already specified schema values + LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); + return; + } + + vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); + mysqlSchema.put("columnDefinition", columnDefinition); + columnDefinition.put("colName", toColumnName(baseName)); + columnDefinition.put("colDataType", "TINYINT"); + columnDefinition.put("colDataTypeArguments", columnDataTypeArguments); + columnDataTypeArguments.add(toCodegenMysqlDataTypeArgument(1, false)); + + if (Boolean.TRUE.equals(required)) { + columnDefinition.put("colNotNull", true); + } else { + columnDefinition.put("colNotNull", false); + try { + columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType"))); + } catch (RuntimeException exception) { + LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value"); + columnDefinition.put("colDefault", null); + } + } + + if (description != null) { + columnDefinition.put("colComment", description); + } + } + + /** + * Processes each model's property mapped to string type and adds related vendor extensions + * + * @param model model + * @param property model's property + */ + public void processStringTypeProperty(CodegenModel model, CodegenProperty property) { + Map vendorExtensions = property.getVendorExtensions(); + Map mysqlSchema = new HashMap(); + Map columnDefinition = new HashMap(); + ArrayList columnDataTypeArguments = new ArrayList(); + String baseName = property.getBaseName(); + String dataType = property.getDataType(); + String dataFormat = property.getDataFormat(); + String description = property.getDescription(); + Integer minLength = property.getMinLength(); + Integer maxLength = property.getMaxLength(); + String defaultValue = property.getDefaultValue(); + Boolean required = property.getRequired(); + Boolean isEnum = property.isEnum; + + if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + // user already specified schema values + LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); + return; + } + + vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); + mysqlSchema.put("columnDefinition", columnDefinition); + columnDefinition.put("colName", toColumnName(baseName)); + + if (Boolean.TRUE.equals(isEnum)) { + Map allowableValues = property.getAllowableValues(); + List enumValues = (List) allowableValues.get("values"); + columnDefinition.put("colDataType", "ENUM"); + columnDefinition.put("colDataTypeArguments", columnDataTypeArguments); + for (Integer i = 0; i < enumValues.size(); i++) { + if (i > ENUM_MAX_ELEMENTS - 1) { + LOGGER.warn("ENUM column can have maximum of " + ENUM_MAX_ELEMENTS.toString() + " distinct elements, following value will be skipped: " + (String) enumValues.get(i)); + break; + } + String value = String.valueOf(enumValues.get(i)); + columnDataTypeArguments.add(toCodegenMysqlDataTypeArgument(value, (Boolean) (i + 1 < enumValues.size()))); + } + } else if (dataType.equals("MEDIUMBLOB")) { + columnDefinition.put("colDataType", "MEDIUMBLOB"); + } else { + String matchedStringType = getMysqlMatchedStringDataType(minLength, maxLength); + columnDefinition.put("colDataType", matchedStringType); + if (matchedStringType.equals("CHAR") || matchedStringType.equals("VARCHAR")) { + columnDefinition.put("colDataTypeArguments", columnDataTypeArguments); + columnDataTypeArguments.add(toCodegenMysqlDataTypeArgument((maxLength != null) ? maxLength : 255, false)); + } + } + + if (Boolean.TRUE.equals(required)) { + columnDefinition.put("colNotNull", true); + } else { + columnDefinition.put("colNotNull", false); + try { + columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType"))); + } catch (RuntimeException exception) { + LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value"); + columnDefinition.put("colDefault", null); + } + } + + if (description != null) { + columnDefinition.put("colComment", description); + } + } + + /** + * Processes each model's property mapped to date type and adds related vendor extensions + * + * @param model model + * @param property model's property + */ + public void processDateTypeProperty(CodegenModel model, CodegenProperty property) { + Map vendorExtensions = property.getVendorExtensions(); + Map mysqlSchema = new HashMap(); + Map columnDefinition = new HashMap(); + String baseName = property.getBaseName(); + String dataType = property.getDataType(); + Boolean required = property.getRequired(); + String description = property.getDescription(); + String defaultValue = property.getDefaultValue(); + + if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + // user already specified schema values + LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); + return; + } + + vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); + mysqlSchema.put("columnDefinition", columnDefinition); + columnDefinition.put("colName", toColumnName(baseName)); + columnDefinition.put("colDataType", dataType); + + if (Boolean.TRUE.equals(required)) { + columnDefinition.put("colNotNull", true); + } else { + columnDefinition.put("colNotNull", false); + try { + columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType"))); + } catch (RuntimeException exception) { + LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value"); + columnDefinition.put("colDefault", null); + } + } + + if (description != null) { + columnDefinition.put("colComment", description); + } + } + + /** + * Processes each model's property mapped to JSON type and adds related vendor extensions + * + * @param model model + * @param property model's property + */ + public void processJsonTypeProperty(CodegenModel model, CodegenProperty property) { + Map vendorExtensions = property.getVendorExtensions(); + Map mysqlSchema = new HashMap(); + Map columnDefinition = new HashMap(); + String baseName = property.getBaseName(); + String dataType = property.getDataType(); + Boolean required = property.getRequired(); + String description = property.getDescription(); + String defaultValue = property.getDefaultValue(); + + if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + // user already specified schema values + LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); + return; + } + + vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); + mysqlSchema.put("columnDefinition", columnDefinition); + columnDefinition.put("colName", toColumnName(baseName)); + columnDefinition.put("colDataType", dataType); + if (Boolean.FALSE.equals(getJsonDataTypeEnabled())) { + columnDefinition.put("colDataType", "TEXT"); + } + + if (Boolean.TRUE.equals(required)) { + columnDefinition.put("colNotNull", true); + } else { + columnDefinition.put("colNotNull", false); + try { + columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType"))); + } catch (RuntimeException exception) { + LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value"); + columnDefinition.put("colDefault", null); + } + } + + if (description != null) { + columnDefinition.put("colComment", description); + } + } + + /** + * Processes each model's property not mapped to any type and adds related vendor extensions + * Most of time it's related to referenced properties eg. \Model\User + * + * @param model model + * @param property model's property + */ + public void processUnknownTypeProperty(CodegenModel model, CodegenProperty property) { + Map vendorExtensions = property.getVendorExtensions(); + Map mysqlSchema = new HashMap(); + Map columnDefinition = new HashMap(); + String baseName = property.getBaseName(); + Boolean required = property.getRequired(); + String description = property.getDescription(); + String defaultValue = property.getDefaultValue(); + + if (vendorExtensions.containsKey(CODEGEN_VENDOR_EXTENSION_KEY)) { + // user already specified schema values + LOGGER.info("Found vendor extension in '" + baseName + "' property, autogeneration skipped"); + return; + } + + vendorExtensions.put(CODEGEN_VENDOR_EXTENSION_KEY, mysqlSchema); + mysqlSchema.put("columnDefinition", columnDefinition); + columnDefinition.put("colName", toColumnName(baseName)); + columnDefinition.put("colDataType", "TEXT"); + + if (Boolean.TRUE.equals(required)) { + columnDefinition.put("colNotNull", true); + } else { + columnDefinition.put("colNotNull", false); + try { + columnDefinition.put("colDefault", toCodegenMysqlDataTypeDefault(defaultValue, (String) columnDefinition.get("colDataType"))); + } catch (RuntimeException exception) { + LOGGER.warn("Property '" + baseName + "' of model '" + model.getName() + "' mapped to MySQL data type which doesn't support default value"); + columnDefinition.put("colDefault", null); + } + } + + if (description != null) { + columnDefinition.put("colComment", description); + } + } + + /** + * Generates codegen property for MySQL data type argument + * + * @param value argument value + * @param hasMore shows whether codegen has more arguments or not + * @return generated codegen property + */ + public HashMap toCodegenMysqlDataTypeArgument(Object value, Boolean hasMore) { + HashMap arg = new HashMap(); + if (value instanceof String) { + arg.put("isString", true); + arg.put("isFloat", false); + arg.put("isInteger", false); + arg.put("isNumeric", false); + } else if (value instanceof Integer || value instanceof Long) { + arg.put("isString", false); + arg.put("isFloat", false); + arg.put("isInteger", true); + arg.put("isNumeric", true); + } else if (value instanceof Number) { + arg.put("isString", false); + arg.put("isFloat", true); + arg.put("isInteger", false); + arg.put("isNumeric", true); + } else { + LOGGER.warn("MySQL data type argument can be primitive type only. Class '" + value.getClass() + "' is provided"); + } + arg.put("argumentValue", value); + arg.put("hasMore", hasMore); + return arg; + } + + /** + * Generates default codegen property for MySQL column definition + * Ref: https://dev.mysql.com/doc/refman/5.7/en/data-type-defaults.html + * + * @param defaultValue value + * @param mysqlDataType MySQL data type + * @return generated codegen property + */ + public HashMap toCodegenMysqlDataTypeDefault(String defaultValue, String mysqlDataType) { + HashMap defaultMap = new HashMap(); + if (defaultValue == null || defaultValue.toUpperCase(Locale.ROOT).equals("NULL")) { + defaultMap.put("defaultValue", "NULL"); + defaultMap.put("isString", false); + defaultMap.put("isNumeric", false); + defaultMap.put("isKeyword", true); + return defaultMap; + } + + switch (mysqlDataType.toUpperCase(Locale.ROOT)) { + case "TINYINT": + case "SMALLINT": + case "MEDIUMINT": + case "INT": + case "BIGINT": + // SERIAL DEFAULT VALUE is a special case. In the definition of an integer column, it is an alias for NOT NULL AUTO_INCREMENT UNIQUE + if (defaultValue.equals("SERIAL DEFAULT VALUE")) { + defaultMap.put("defaultValue", defaultValue); + defaultMap.put("isString", false); + defaultMap.put("isNumeric", false); + defaultMap.put("isKeyword", true); + } else { + defaultMap.put("defaultValue", defaultValue); + defaultMap.put("isString", false); + defaultMap.put("isNumeric", true); + defaultMap.put("isKeyword", false); + } + return defaultMap; + case "TIMESTAMP": + case "DATETIME": + // The exception is that, for TIMESTAMP and DATETIME columns, you can specify CURRENT_TIMESTAMP as the default + if (defaultValue.equals("CURRENT_TIMESTAMP")) { + defaultMap.put("defaultValue", defaultValue); + defaultMap.put("isString", false); + defaultMap.put("isNumeric", false); + defaultMap.put("isKeyword", true); + } else { + defaultMap.put("defaultValue", defaultValue); + defaultMap.put("isString", true); + defaultMap.put("isNumeric", false); + defaultMap.put("isKeyword", false); + } + return defaultMap; + case "TINYBLOB": + case "BLOB": + case "MEDIUMBLOB": + case "LONGBLOB": + case "TINYTEXT": + case "TEXT": + case "MEDIUMTEXT": + case "LONGTEXT": + case "GEOMETRY": + case "JSON": + // The BLOB, TEXT, GEOMETRY, and JSON data types cannot be assigned a default value. + throw new RuntimeException("The BLOB, TEXT, GEOMETRY, and JSON data types cannot be assigned a default value"); + default: + defaultMap.put("defaultValue", defaultValue); + defaultMap.put("isString", true); + defaultMap.put("isNumeric", false); + defaultMap.put("isKeyword", false); + return defaultMap; + } + } + + /** + * Finds best fitted MySQL data type for integer variable based on minimum and maximum properties + * + * @param minimum (optional) codegen property + * @param maximum (optional) codegen property + * @param unsigned (optional) whether variable is unsigned or not + * @return MySQL integer data type + */ + public String getMysqlMatchedIntegerDataType(Long minimum, Long maximum, Boolean unsigned) { + // we can choose fit mysql data type + // ref: https://dev.mysql.com/doc/refman/8.0/en/integer-types.html + Long min = (minimum != null) ? minimum : -2147483648L; + Long max = (maximum != null) ? maximum : 2147483647L; + Long actualMin = Math.min(min, max); // sometimes min and max values can be mixed up + Long actualMax = Math.max(min, max); // sometimes only minimum specified and it can be pretty high + if (minimum != null && maximum != null && minimum > maximum) { + LOGGER.warn("Codegen property 'minimum' cannot be greater than 'maximum'"); + } + if (Boolean.TRUE.equals(unsigned) && actualMin >= 0) { + if (actualMax <= 255) { + return "TINYINT"; + } else if (actualMax <= 65535) { + return "SMALLINT"; + } else if (actualMax <= 16777215) { + return "MEDIUMINT"; + } else if (actualMax <= 4294967295L) { + return "INT"; + } else if (actualMax > 4294967295L) { + return "BIGINT"; + } + } else { + if (actualMin >= -128 && actualMax <= 127) { + return "TINYINT"; + } else if (actualMin >= -32768 && actualMax <= 32767) { + return "SMALLINT"; + } else if (actualMin >= -8388608 && actualMax <= 8388607) { + return "MEDIUMINT"; + } else if (actualMin >= -2147483648 && actualMax <= 2147483647) { + return "INT"; + } else if (actualMin < -2147483648 || actualMax > 2147483647) { + return "BIGINT"; + } + } + + return "INT"; + } + + /** + * Finds best fitted MySQL data type for string variable based on minLength and maxLength properties + * + * @param minLength (optional) codegen property + * @param maxLength (optional) codegen property + * @return MySQL string data type + */ + public String getMysqlMatchedStringDataType(Integer minLength, Integer maxLength) { + // we can choose fit mysql data type + // ref: https://dev.mysql.com/doc/refman/8.0/en/string-type-overview.html + Integer min = (minLength != null && minLength >= 0) ? minLength : 0; + Integer max = (maxLength != null && maxLength >= 0) ? maxLength : 65535; + Integer actualMin = Math.min(min, max); // sometimes minLength and maxLength values can be mixed up + Integer actualMax = Math.max(min, max); // sometimes only minLength specified and it can be pretty high + if (minLength != null && maxLength != null && minLength > maxLength) { + LOGGER.warn("Codegen property 'minLength' cannot be greater than 'maxLength'"); + } + if (actualMax.equals(actualMin) && actualMax <= 255) { + return "CHAR"; + } else if (actualMax <= 255) { + return "VARCHAR"; + } else if (actualMax > 255 && actualMax <= 65535) { + return "TEXT"; + } else if (actualMax > 65535 && actualMax <= 16777215) { + return "MEDIUMTEXT"; + } else if (actualMax > 16777215) { + return "LONGTEXT"; + } + return "TEXT"; + } + + /** + * Checks whether string is one of MySQL Data Types + * Ref: https://dev.mysql.com/doc/refman/8.0/en/data-type-overview.html + * + * @param dataType which needs to check + * @return true if value is correct MySQL data type, otherwise false + */ + public Boolean isMysqlDataType(String dataType) { + return ( + mysqlNumericTypes.contains(dataType.toUpperCase(Locale.ROOT)) || + mysqlDateAndTimeTypes.contains(dataType.toUpperCase(Locale.ROOT)) || + mysqlStringTypes.contains(dataType.toUpperCase(Locale.ROOT)) || + mysqlSpatialTypes.contains(dataType.toUpperCase(Locale.ROOT)) || + dataType.toUpperCase(Locale.ROOT).equals("JSON") + ); + } + + /** + * Converts name to valid MySQL database name + * Produced name must be used with backticks only, eg. `database_name` + * + * @param name source name + * @return database name + */ + public String toDatabaseName(String name) { + String identifier = toMysqlIdentifier(name, databaseNamePrefix, databaseNameSuffix); + if (identifier.length() > IDENTIFIER_MAX_LENGTH) { + LOGGER.warn("Database name cannot exceed 64 chars. Name '" + name + "' will be truncated"); + identifier = identifier.substring(0, IDENTIFIER_MAX_LENGTH); + } + return identifier; + } + + /** + * Converts name to valid MySQL column name + * Produced name must be used with backticks only, eg. `table_name` + * + * @param name source name + * @return table name + */ + public String toTableName(String name) { + String identifier = toMysqlIdentifier(name, tableNamePrefix, tableNameSuffix); + if (identifier.length() > IDENTIFIER_MAX_LENGTH) { + LOGGER.warn("Table name cannot exceed 64 chars. Name '" + name + "' will be truncated"); + identifier = identifier.substring(0, IDENTIFIER_MAX_LENGTH); + } + return identifier; + } + + /** + * Converts name to valid MySQL column name + * Produced name must be used with backticks only, eg. `column_name` + * + * @param name source name + * @return column name + */ + public String toColumnName(String name) { + String identifier = toMysqlIdentifier(name, columnNamePrefix, columnNameSuffix); + if (identifier.length() > IDENTIFIER_MAX_LENGTH) { + LOGGER.warn("Column name cannot exceed 64 chars. Name '" + name + "' will be truncated"); + identifier = identifier.substring(0, IDENTIFIER_MAX_LENGTH); + } + return identifier; + } + + /** + * Converts name to valid MySQL identifier which can be used as database, table, column name + * Produced name must be used with backticks only, eg. `column_name` + * + * @param name source name + * @param prefix when escaped name is digits only, prefix will be prepended + * @param suffix when escaped name is digits only, suffix will be appended + * @return identifier name + */ + public String toMysqlIdentifier(String name, String prefix, String suffix) { + String escapedName = escapeMysqlQuotedIdentifier(name); + // Database, table, and column names cannot end with space characters. + if (escapedName.matches(".*\\s$")) { + LOGGER.warn("Database, table, and column names cannot end with space characters. Check '" + name + "' name"); + escapedName = escapedName.replaceAll("\\s+$", ""); + } + + // Identifiers may begin with a digit but unless quoted may not consist solely of digits. + if (escapedName.matches("^\\d+$")) { + LOGGER.warn("Database, table, and column names cannot consist solely of digits. Check '" + name + "' name"); + escapedName = prefix + escapedName + suffix; + } + + // identifier name cannot be empty + if (escapedName.isEmpty()) { + throw new RuntimeException("Empty database/table/column name for property '" + name.toString() + "' not allowed"); + } + return escapedName; + } + + /** + * Escapes MySQL identifier to use it in SQL statements without backticks, eg. SELECT identifier FROM + * Ref: https://dev.mysql.com/doc/refman/8.0/en/identifiers.html + * + * @param identifier source identifier + * @return escaped identifier + */ + public String escapeMysqlUnquotedIdentifier(String identifier) { + // ASCII: [0-9,a-z,A-Z$_] (basic Latin letters, digits 0-9, dollar, underscore) Extended: U+0080 .. U+FFFF + Pattern regexp = Pattern.compile("[^0-9a-zA-z$_\\u0080-\\uFFFF]"); + Matcher matcher = regexp.matcher(identifier); + if (matcher.find()) { + LOGGER.warn("Identifier '" + identifier + "' contains unsafe characters out of [0-9,a-z,A-Z$_] and U+0080..U+FFFF range"); + identifier = identifier.replaceAll("[^0-9a-zA-z$_\\u0080-\\uFFFF]", ""); + } + + // ASCII NUL (U+0000) and supplementary characters (U+10000 and higher) are not permitted in quoted or unquoted identifiers. + // Don't know how to match these characters, hope that first regexp already strip them + // Pattern regexp2 = Pattern.compile("[\0\uD800\uDC00-\uDBFF\uDFFF]"); + return identifier; + } + + /** + * Escapes MySQL identifier to use it in SQL statements with backticks, eg. SELECT `identifier` FROM + * Ref: https://dev.mysql.com/doc/refman/8.0/en/identifiers.html + * + * @param identifier source identifier + * @return escaped identifier + */ + public String escapeMysqlQuotedIdentifier(String identifier) { + // ASCII: U+0001 .. U+007F Extended: U+0080 .. U+FFFF + Pattern regexp = Pattern.compile("[^\\u0001-\\u007F\\u0080-\\uFFFF]"); + Matcher matcher = regexp.matcher(identifier); + if (matcher.find()) { + LOGGER.warn("Identifier '" + identifier + "' contains unsafe characters out of U+0001..U+007F and U+0080..U+FFFF range"); + identifier = identifier.replaceAll("[^\\u0001-\\u007F\\u0080-\\uFFFF]", ""); + } + + // ASCII NUL (U+0000) and supplementary characters (U+10000 and higher) are not permitted in quoted or unquoted identifiers. + // Don't know how to match these characters, hope that first regexp already strip them + // Pattern regexp2 = Pattern.compile("[\0\uD800\uDC00-\uDBFF\uDFFF]"); + return identifier; + } + + @Override + public String escapeReservedWord(String name) { + LOGGER.warn("'" + name + "' is MySQL reserved word. Do not use that word or properly escape it with backticks in mustache template"); + return name; + } + + @Override + public String escapeQuotationMark(String input) { + // remove ' to avoid code injection + return input.replace("'", ""); + } + + @Override + public String escapeUnsafeCharacters(String input) { + return input.replace("*/", "*_/").replace("/*", "/_*"); + } + + /** + * Sets default database name for all MySQL queries + * Provided value will be escaped when necessary + * + * @param databaseName source name + */ + public void setDefaultDatabaseName(String databaseName) { + String escapedName = toDatabaseName(databaseName); + if (escapedName.equals(databaseName) == false) { + LOGGER.error("Invalid database name. '" + databaseName + "' cannot be used as MySQL identifier. Escaped value '" + escapedName + "' will be used instead."); + } + this.defaultDatabaseName = escapedName; + } + + /** + * Returns default database name for all MySQL queries + * This value must be used with backticks only, eg. `database_name` + * + * @return default database name + */ + public String getDefaultDatabaseName() { + return this.defaultDatabaseName; + } + + /** + * Enables special JSON data type in all MySQL queries + * JSON data type requires MySQL version 5.7.8 + * + * @param enabled true to enable, otherwise false + */ + public void setJsonDataTypeEnabled(Boolean enabled) { + this.jsonDataTypeEnabled = enabled; + } + + /** + * Whether JSON data type enabled or disabled in all MySQL queries + * + * @return true if enabled otherwise false + */ + public Boolean getJsonDataTypeEnabled() { + return this.jsonDataTypeEnabled; + } + +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ObjcClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ObjcClientCodegen.java index 6800e3af389..4662fd132cc 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ObjcClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ObjcClientCodegen.java @@ -43,6 +43,9 @@ import java.util.Locale; import java.util.Map; import java.util.Set; +import org.apache.commons.lang3.StringUtils; + + public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(ObjcClientCodegen.class); @@ -429,7 +432,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { // model name starts with number /* no need for the fix below as objc model starts with prefix (e.g. SWG) if (type.matches("^\\d.*")) { - LOGGER.warn(type + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + type)); + LOGGER.warn(type + " (model name starts with number) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + type)); type = "model_" + type; // e.g. 200Response => Model200Response (after camelize) } */ @@ -453,7 +456,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { importMapping.values().contains(type) || defaultIncludes.contains(type) || languageSpecificPrimitives.contains(type)) { - return camelize(type); + return org.openapitools.codegen.utils.StringUtils.camelize(type); } // custom classes else { @@ -465,7 +468,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { type = modelNamePrefix + "_" + type; } - return classPrefix + camelize(type); // add class prefix + return classPrefix + org.openapitools.codegen.utils.StringUtils.camelize(type); // add class prefix } } @@ -526,12 +529,12 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toApiName(String name) { - return classPrefix + camelize(name) + "Api"; + return classPrefix + org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override public String toApiFilename(String name) { - return classPrefix + camelize(name) + "Api"; + return classPrefix + org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override @@ -556,7 +559,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { // camelize (lower first character) the variable name // e.g. `pet_id` to `petId` - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); // for reserved word or word starting with number, prepend `_` if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -601,11 +604,11 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true)); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId), true)); operationId = "call_" + operationId; } - return camelize(sanitizeName(operationId), true); + return org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true); } public void setClassPrefix(String classPrefix) { @@ -644,7 +647,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { for (CodegenOperation operation : ops) { if (!operation.allParams.isEmpty()) { String firstParamName = operation.allParams.get(0).paramName; - operation.vendorExtensions.put("firstParamAltName", camelize(firstParamName)); + operation.vendorExtensions.put("firstParamAltName", org.openapitools.codegen.utils.StringUtils.camelize(firstParamName)); } } } @@ -654,7 +657,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public void postProcessModelProperty(CodegenModel model, CodegenProperty schema) { super.postProcessModelProperty(model, schema); - schema.vendorExtensions.put("x-uppercaseName", camelize(schema.name)); + schema.vendorExtensions.put("x-uppercaseName", org.openapitools.codegen.utils.StringUtils.camelize(schema.name)); } /** diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java index 21ccb6aad03..f2c52611a26 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PerlClientCodegen.java @@ -32,6 +32,7 @@ import java.util.HashSet; import java.util.regex.Matcher; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.io.FilenameUtils; public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(PerlClientCodegen.class); @@ -132,6 +133,10 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig { public void processOpts() { super.processOpts(); + if (StringUtils.isEmpty(System.getenv("PERL_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable PERL_POST_PROCESS_FILE not defined so the Perl code may not be properly formatted. To define it, try 'export PERL_POST_PROCESS_FILE=/usr/local/bin/perltidy -b -bext=\"/\"' (Linux/Mac)"); + } + if (additionalProperties.containsKey(MODULE_VERSION)) { setModuleVersion((String) additionalProperties.get(MODULE_VERSION)); } else { @@ -276,7 +281,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig { public String toVarName(String name) { // return the name in underscore style // PhoneNumber => phone_number - name = underscore(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + name = org.openapitools.codegen.utils.StringUtils.underscore(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // parameter name starting with number won't compile // need to escape it by appending _ at the beginning @@ -298,13 +303,13 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig { // model name cannot use reserved keyword if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; } // model name starts with number if (name.matches("^\\d.*")) { - LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } @@ -319,7 +324,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig { // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override @@ -354,7 +359,7 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig { name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // e.g. phone_number_api.rb => PhoneNumberApi.rb - return camelize(name) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override @@ -363,32 +368,32 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig { return "DefaultApi"; } // e.g. phone_number_api => PhoneNumberApi - return camelize(name) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override public String toOperationId(String operationId) { //rename to empty_function_name_1 (e.g.) if method name is empty if (StringUtils.isEmpty(operationId)) { - operationId = underscore("empty_function_name_" + emptyFunctionNameCounter++); + operationId = org.openapitools.codegen.utils.StringUtils.underscore("empty_function_name_" + emptyFunctionNameCounter++); LOGGER.warn("Empty method name (operationId) found. Renamed to " + operationId); return operationId; } // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId))); - return underscore(sanitizeName("call_" + operationId)); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName("call_" + operationId))); + return org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName("call_" + operationId)); } // operationId starts with a number if (operationId.matches("^\\d.*")) { - LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId))); + LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName("call_" + operationId))); operationId = "call_" + operationId; } - //return underscore(operationId).replaceAll("[^A-Za-z0-9_]", ""); - return underscore(sanitizeName(operationId)); + //return org.openapitools.codegen.utils.StringUtils.underscore(operationId).replaceAll("[^A-Za-z0-9_]", ""); + return org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName(operationId)); } public void setModuleName(String moduleName) { @@ -559,4 +564,34 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig { // remove =end, =cut to avoid code injection return input.replace("=begin", "=_begin").replace("=end", "=_end").replace("=cut", "=_cut").replace("=pod", "=_pod"); } + + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + + String perlTidyPath = System.getenv("PERL_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(perlTidyPath)) { + return; // skip if PERL_POST_PROCESS_FILE env variable is not defined + } + + // only process files with .t, .pm extension + if ("t".equals(FilenameUtils.getExtension(file.toString())) || + "pm".equals(FilenameUtils.getExtension(file.toString())) || + "pl".equals(FilenameUtils.getExtension(file.toString()))) { + String command = perlTidyPath + " -b -bext='/' " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit code: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLaravelServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLaravelServerCodegen.java index 85bd0497678..5c67685d979 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLaravelServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLaravelServerCodegen.java @@ -22,6 +22,7 @@ import org.openapitools.codegen.*; import java.io.File; import java.util.*; + public class PhpLaravelServerCodegen extends AbstractPhpCodegen { protected String apiVersion = "1.0.0"; @@ -240,7 +241,7 @@ public class PhpLaravelServerCodegen extends AbstractPhpCodegen { return "DefaultController"; } - return camelize(name, false) + "Controller"; + return org.openapitools.codegen.utils.StringUtils.camelize(name, false) + "Controller"; } protected String controllerFileFolder() { @@ -262,6 +263,6 @@ public class PhpLaravelServerCodegen extends AbstractPhpCodegen { return "DefaultController"; } - return camelize(name, false) + "Controller"; + return org.openapitools.codegen.utils.StringUtils.camelize(name, false) + "Controller"; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLumenServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLumenServerCodegen.java index 2c8753b7cd3..12e4168c57b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLumenServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpLumenServerCodegen.java @@ -138,10 +138,6 @@ public class PhpLumenServerCodegen extends AbstractPhpCodegen { for (CodegenOperation op : operations) { op.httpMethod = op.httpMethod.toLowerCase(Locale.ROOT); - // check to see if the path contains ".", which is not supported by Lumen - if (op.path != null && op.path.contains(".")) { - throw new IllegalArgumentException("'.' (dot) is not supported by PHP Lumen."); - } } // sort the endpoints in ascending to avoid the route priority issure. diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSilexServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSilexServerCodegen.java index 84cf10331cc..e8866e05808 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSilexServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSilexServerCodegen.java @@ -36,6 +36,7 @@ import java.util.Map; import org.apache.commons.lang3.StringUtils; + public class PhpSilexServerCodegen extends DefaultCodegen implements CodegenConfig { protected String invokerPackage; protected String groupId = "org.openapitools"; @@ -45,7 +46,7 @@ public class PhpSilexServerCodegen extends DefaultCodegen implements CodegenConf public PhpSilexServerCodegen() { super(); - invokerPackage = camelize("OpenAPIServer"); + invokerPackage = org.openapitools.codegen.utils.StringUtils.camelize("OpenAPIServer"); String packageName = "OpenAPIServer"; modelPackage = "lib" + File.separator + "models"; apiPackage = "lib"; @@ -199,7 +200,7 @@ public class PhpSilexServerCodegen extends DefaultCodegen implements CodegenConf public String toVarName(String name) { // return the name in underscore style // PhoneNumber => phone_number - name = underscore(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + name = org.openapitools.codegen.utils.StringUtils.underscore(name); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // parameter name starting with number won't compile // need to escape it by appending _ at the beginning @@ -225,7 +226,7 @@ public class PhpSilexServerCodegen extends DefaultCodegen implements CodegenConf // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override @@ -258,7 +259,7 @@ public class PhpSilexServerCodegen extends DefaultCodegen implements CodegenConf for (int i = 0; i < items.length; ++i) { if (items[i].matches("^\\{(.*)\\}$")) { // wrap in {} // camelize path variable - items[i] = "{" + camelize(items[i].substring(1, items[i].length() - 1), true) + "}"; + items[i] = "{" + org.openapitools.codegen.utils.StringUtils.camelize(items[i].substring(1, items[i].length() - 1), true) + "}"; } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlimServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlimServerCodegen.java index 69c6bc6d677..abf676d4fec 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlimServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSlimServerCodegen.java @@ -35,8 +35,11 @@ import java.util.Map; public class PhpSlimServerCodegen extends AbstractPhpCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(PhpSlimServerCodegen.class); + public static final String PHPCS_STANDARD = "phpcsStandard"; + protected String groupId = "org.openapitools"; protected String artifactId = "openapi-server"; + protected String phpcsStandard = "PSR12"; public PhpSlimServerCodegen() { super(); @@ -70,6 +73,9 @@ public class PhpSlimServerCodegen extends AbstractPhpCodegen { break; } } + + cliOptions.add(new CliOption(PHPCS_STANDARD, "PHP CodeSniffer option. Accepts name or path of the coding standard to use.") + .defaultValue("PSR12")); } @Override @@ -109,11 +115,17 @@ public class PhpSlimServerCodegen extends AbstractPhpCodegen { public void processOpts() { super.processOpts(); + if (additionalProperties.containsKey(PHPCS_STANDARD)) { + this.setPhpcsStandard((String) additionalProperties.get(PHPCS_STANDARD)); + } else { + additionalProperties.put(PHPCS_STANDARD, phpcsStandard); + } + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); supportingFiles.add(new SupportingFile("composer.mustache", "", "composer.json")); supportingFiles.add(new SupportingFile("index.mustache", "", "index.php")); supportingFiles.add(new SupportingFile(".htaccess", "", ".htaccess")); - supportingFiles.add(new SupportingFile("AbstractApiController.mustache", toSrcPath(invokerPackage, srcBasePath), "AbstractApiController.php")); + supportingFiles.add(new SupportingFile("AbstractApiController.mustache", toSrcPath(invokerPackage, srcBasePath), toAbstractName("ApiController") + ".php")); supportingFiles.add(new SupportingFile("SlimRouter.mustache", toSrcPath(invokerPackage, srcBasePath), "SlimRouter.php")); supportingFiles.add(new SupportingFile("phpunit.xml.mustache", "", "phpunit.xml.dist")); } @@ -148,4 +160,8 @@ public class PhpSlimServerCodegen extends AbstractPhpCodegen { return objs; } + public void setPhpcsStandard(String phpcsStandard) { + this.phpcsStandard = phpcsStandard; + } + } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java index 5baf8b5d731..0714247c8ae 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PhpSymfonyServerCodegen.java @@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.util.*; + public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements CodegenConfig { @SuppressWarnings("hiding") private static final Logger LOGGER = LoggerFactory.getLogger(PhpSymfonyServerCodegen.class); @@ -563,14 +564,14 @@ public class PhpSymfonyServerCodegen extends AbstractPhpCodegen implements Codeg if (name.isEmpty()) { return "DefaultApiInterface"; } - return camelize(name, false) + "ApiInterface"; + return org.openapitools.codegen.utils.StringUtils.camelize(name, false) + "ApiInterface"; } protected String toControllerName(String name) { if (name.isEmpty()) { return "DefaultController"; } - return camelize(name, false) + "Controller"; + return org.openapitools.codegen.utils.StringUtils.camelize(name, false) + "Controller"; } protected String toSymfonyService(String name) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java index f16a7528fa7..86536a3c15a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PowerShellClientCodegen.java @@ -329,19 +329,19 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. return => ModelReturn (after camelize) } // model name starts with number if (name.matches("^\\d.*")) { - LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override @@ -406,11 +406,11 @@ public class PowerShellClientCodegen extends DefaultCodegen implements CodegenCo // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId))); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId))); operationId = "call_" + operationId; } - return camelize(sanitizeName(operationId)); + return org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId)); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index 0b8455108e2..f5aac3520d6 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -19,6 +19,7 @@ package org.openapitools.codegen.languages; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.CodegenConfig; @@ -42,6 +43,7 @@ import java.util.Locale; import java.util.Map; import java.util.regex.Pattern; + public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(PythonClientCodegen.class); @@ -169,6 +171,11 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig @Override public void processOpts() { super.processOpts(); + + if (StringUtils.isEmpty(System.getenv("PYTHON_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE=\"/usr/local/bin/yapf -i\"' (Linux/Mac)"); + } + Boolean excludeTests = false; if (additionalProperties.containsKey(CodegenConstants.EXCLUDE_TESTS)) { @@ -436,7 +443,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig // underscore the variable name // petId => pet_id - name = underscore(name); + name = org.openapitools.codegen.utils.StringUtils.underscore(name); // remove leading underscore name = name.replaceAll("^_*", ""); @@ -468,13 +475,13 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. return => ModelReturn (after camelize) } // model name starts with number if (name.matches("^\\d.*")) { - LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } @@ -488,14 +495,14 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override public String toModelFilename(String name) { // underscore the model file name // PhoneNumber => phone_number - return underscore(dropDots(toModelName(name))); + return org.openapitools.codegen.utils.StringUtils.underscore(dropDots(toModelName(name))); } @Override @@ -509,7 +516,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig name = name.replaceAll("-", "_"); // e.g. PhoneNumberApi.py => phone_number_api.py - return underscore(name) + "_api"; + return org.openapitools.codegen.utils.StringUtils.underscore(name) + "_api"; } @Override @@ -523,7 +530,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig return "DefaultApi"; } // e.g. phone_number_api => PhoneNumberApi - return camelize(name) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override @@ -531,7 +538,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig if (name.length() == 0) { return "default_api"; } - return underscore(name) + "_api"; + return org.openapitools.codegen.utils.StringUtils.underscore(name) + "_api"; } @Override @@ -543,17 +550,17 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId))); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName("call_" + operationId))); operationId = "call_" + operationId; } // operationId starts with a number if (operationId.matches("^\\d.*")) { - LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId))); + LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName("call_" + operationId))); operationId = "call_" + operationId; } - return underscore(sanitizeName(operationId)); + return org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName(operationId)); } public void setPackageName(String packageName) { @@ -583,7 +590,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig */ @SuppressWarnings("static-method") public String generatePackageName(String packageName) { - return underscore(packageName.replaceAll("[^\\w]+", "")); + return org.openapitools.codegen.utils.StringUtils.underscore(packageName.replaceAll("[^\\w]+", "")); } /** @@ -708,4 +715,31 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig return input.replace("'''", "'_'_'"); } + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + String pythonPostProcessFile = System.getenv("PYTHON_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(pythonPostProcessFile)) { + return; // skip if PYTHON_POST_PROCESS_FILE env variable is not defined + } + + // only process files with py extension + if ("py".equals(FilenameUtils.getExtension(file.toString()))) { + String command = pythonPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } + } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFlaskConnexionServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFlaskConnexionServerCodegen.java index 009dfeff8ba..f29b757f0c9 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFlaskConnexionServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFlaskConnexionServerCodegen.java @@ -27,14 +27,15 @@ import io.swagger.v3.oas.models.PathItem.HttpMethod; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; import org.apache.commons.lang3.StringUtils; +import org.apache.commons.io.FilenameUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; - import java.io.File; import java.util.*; + public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(PythonFlaskConnexionServerCodegen.class); @@ -153,6 +154,11 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements @Override public void processOpts() { super.processOpts(); + + if (StringUtils.isEmpty(System.getenv("PYTHON_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable PYTHON_POST_PROCESS_FILE not defined so the Python code may not be properly formatted. To define it, try 'export PYTHON_POST_PROCESS_FILE=\"/usr/local/bin/yapf -i\"' (Linux/Mac)"); + } + //apiTemplateFiles.clear(); if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { @@ -246,12 +252,12 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements if (name == null || name.length() == 0) { return "DefaultController"; } - return camelize(name, false) + "Controller"; + return org.openapitools.codegen.utils.StringUtils.camelize(name, false) + "Controller"; } @Override public String toApiFilename(String name) { - return underscore(toApiName(name)); + return org.openapitools.codegen.utils.StringUtils.underscore(toApiName(name)); } @Override @@ -405,7 +411,7 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements // underscore the variable name // petId => pet_id - name = underscore(name); + name = org.openapitools.codegen.utils.StringUtils.underscore(name); // remove leading underscore name = name.replaceAll("^_*", ""); @@ -433,7 +439,7 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements public String toModelFilename(String name) { // underscore the model file name // PhoneNumber => phone_number - return underscore(dropDots(toModelName(name))); + return org.openapitools.codegen.utils.StringUtils.underscore(dropDots(toModelName(name))); } @Override @@ -444,13 +450,13 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. return => ModelReturn (after camelize) } // model name starts with number if (name.matches("^\\d.*")) { - LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } @@ -464,7 +470,7 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override @@ -476,11 +482,11 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId))); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName("call_" + operationId))); operationId = "call_" + operationId; } - return underscore(sanitizeName(operationId)); + return org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName(operationId)); } /** @@ -691,4 +697,31 @@ public class PythonFlaskConnexionServerCodegen extends DefaultCodegen implements } } + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + String pythonPostProcessFile = System.getenv("PYTHON_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(pythonPostProcessFile)) { + return; // skip if PYTHON_POST_PROCESS_FILE env variable is not defined + } + + // only process files with py extension + if ("py".equals(FilenameUtils.getExtension(file.toString()))) { + String command = pythonPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } + } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java index 6be3b9814d2..49db39f4874 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RClientCodegen.java @@ -28,6 +28,7 @@ import org.slf4j.LoggerFactory; import java.io.File; import java.util.*; + public class RClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(RClientCodegen.class); @@ -172,7 +173,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { if (this.reservedWordsMappings().containsKey(name)) { return this.reservedWordsMappings().get(name); } - return camelize(name) + '_'; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + '_'; } @Override @@ -195,7 +196,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { // convert variable name to snake case // PetId => pet_id - name = underscore(name); + name = org.openapitools.codegen.utils.StringUtils.underscore(name); // for reserved word or word starting with number, append _ if (isReservedWord(name)) @@ -232,17 +233,17 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. return => ModelReturn (after camelize) } // model name starts with number if (name.matches("^\\d.*")) { - LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override @@ -251,7 +252,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // e.g. PetApi.r => pet_api.r - return camelize(name + "_api"); + return org.openapitools.codegen.utils.StringUtils.camelize(name + "_api"); } @Override @@ -276,7 +277,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toApiName(String name) { - return camelize(super.toApiName(name)); + return org.openapitools.codegen.utils.StringUtils.camelize(super.toApiName(name)); } @Override @@ -328,11 +329,11 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { // method name cannot use reserved keyword, e.g. return if (isReservedWord(sanitizedOperationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore("call_" + operationId)); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore("call_" + operationId)); sanitizedOperationId = "call_" + sanitizedOperationId; } - return underscore(sanitizedOperationId); + return org.openapitools.codegen.utils.StringUtils.underscore(sanitizedOperationId); } @Override @@ -432,7 +433,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { } // string - String enumName = sanitizeName(underscore(name).toUpperCase(Locale.ROOT)); + String enumName = sanitizeName(org.openapitools.codegen.utils.StringUtils.underscore(name).toUpperCase(Locale.ROOT)); enumName = enumName.replaceFirst("^_", ""); enumName = enumName.replaceFirst("_$", ""); @@ -445,7 +446,7 @@ public class RClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toEnumName(CodegenProperty property) { - String enumName = underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); + String enumName = org.openapitools.codegen.utils.StringUtils.underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); // remove [] for array or map of enum enumName = enumName.replace("[]", ""); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java index 539dda6d2a6..70c4fe4c343 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyClientCodegen.java @@ -215,6 +215,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen { supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore")); supportingFiles.add(new SupportingFile("Rakefile.mustache", "", "Rakefile")); supportingFiles.add(new SupportingFile("Gemfile.mustache", "", "Gemfile")); + supportingFiles.add(new SupportingFile("Gemfile.lock.mustache", "", "Gemfile.lock")); supportingFiles.add(new SupportingFile("rubocop.mustache", "", ".rubocop.yml")); // test files should not be overwritten @@ -249,7 +250,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen { */ @SuppressWarnings("static-method") public String generateModuleName(String gemName) { - return camelize(gemName.replaceAll("[^\\w]+", "_")); + return org.openapitools.codegen.utils.StringUtils.camelize(gemName.replaceAll("[^\\w]+", "_")); } /** @@ -260,7 +261,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen { */ @SuppressWarnings("static-method") public String generateGemName(String moduleName) { - return underscore(moduleName.replaceAll("[^\\w]+", "")); + return org.openapitools.codegen.utils.StringUtils.underscore(moduleName.replaceAll("[^\\w]+", "")); } @Override @@ -327,25 +328,25 @@ public class RubyClientCodegen extends AbstractRubyCodegen { // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - String modelName = camelize("Model" + name); + String modelName = org.openapitools.codegen.utils.StringUtils.camelize("Model" + name); LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + modelName); return modelName; } // model name starts with number if (name.matches("^\\d.*")) { - LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (model name starts with number) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override public String toModelFilename(String name) { - return underscore(toModelName(name)); + return org.openapitools.codegen.utils.StringUtils.underscore(toModelName(name)); } @Override @@ -359,7 +360,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen { name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // e.g. PhoneNumberApi.rb => phone_number_api.rb - return underscore(name) + "_api"; + return org.openapitools.codegen.utils.StringUtils.underscore(name) + "_api"; } @Override @@ -383,7 +384,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen { return "DefaultApi"; } // e.g. phone_number_api => PhoneNumberApi - return camelize(name) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override @@ -411,7 +412,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen { } // string - String enumName = sanitizeName(underscore(name).toUpperCase(Locale.ROOT)); + String enumName = sanitizeName(org.openapitools.codegen.utils.StringUtils.underscore(name).toUpperCase(Locale.ROOT)); enumName = enumName.replaceFirst("^_", ""); enumName = enumName.replaceFirst("_$", ""); @@ -424,7 +425,7 @@ public class RubyClientCodegen extends AbstractRubyCodegen { @Override public String toEnumName(CodegenProperty property) { - String enumName = underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); + String enumName = org.openapitools.codegen.utils.StringUtils.underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); enumName = enumName.replaceFirst("^_", ""); enumName = enumName.replaceFirst("_$", ""); @@ -445,25 +446,25 @@ public class RubyClientCodegen extends AbstractRubyCodegen { public String toOperationId(String operationId) { // rename to empty_method_name_1 (e.g.) if method name is empty if (StringUtils.isEmpty(operationId)) { - operationId = underscore("empty_method_name_" + emptyMethodNameCounter++); + operationId = org.openapitools.codegen.utils.StringUtils.underscore("empty_method_name_" + emptyMethodNameCounter++); LOGGER.warn("Empty method name (operationId) found. Renamed to " + operationId); return operationId; } // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - String newOperationId = underscore("call_" + operationId); + String newOperationId = org.openapitools.codegen.utils.StringUtils.underscore("call_" + operationId); LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); return newOperationId; } // operationId starts with a number if (operationId.matches("^\\d.*")) { - LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + underscore(sanitizeName("call_" + operationId))); + LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName("call_" + operationId))); operationId = "call_" + operationId; } - return underscore(sanitizeName(operationId)); + return org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName(operationId)); } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyOnRailsServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyOnRailsServerCodegen.java index fe929e0270d..d67b1ad5ce7 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyOnRailsServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubyOnRailsServerCodegen.java @@ -34,6 +34,7 @@ import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + public class RubyOnRailsServerCodegen extends AbstractRubyCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(RubyOnRailsServerCodegen.class); @@ -220,28 +221,28 @@ public class RubyOnRailsServerCodegen extends AbstractRubyCodegen { public String toModelName(String name) { // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - String modelName = camelize("Model" + name); + String modelName = org.openapitools.codegen.utils.StringUtils.camelize("Model" + name); LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + modelName); return modelName; } // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override public String toModelFilename(String name) { // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - String filename = underscore("model_" + name); + String filename = org.openapitools.codegen.utils.StringUtils.underscore("model_" + name); LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + filename); return filename; } // underscore the model file name // PhoneNumber.rb => phone_number.rb - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); } @Override @@ -250,7 +251,7 @@ public class RubyOnRailsServerCodegen extends AbstractRubyCodegen { name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // e.g. DefaultController => defaults_controller.rb - return underscore(name) + "_controller"; + return org.openapitools.codegen.utils.StringUtils.underscore(name) + "_controller"; } @Override @@ -260,7 +261,7 @@ public class RubyOnRailsServerCodegen extends AbstractRubyCodegen { } // e.g. PhoneNumber => phone_number - return underscore(sanitizeName(name)); + return org.openapitools.codegen.utils.StringUtils.underscore(sanitizeName(name)); } @Override @@ -269,7 +270,7 @@ public class RubyOnRailsServerCodegen extends AbstractRubyCodegen { return "ApiController"; } // e.g. phone_number_controller => PhoneNumberController - return camelize(name) + "Controller"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Controller"; } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubySinatraServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubySinatraServerCodegen.java index cfedccee553..05ecc9fa4e8 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubySinatraServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RubySinatraServerCodegen.java @@ -28,6 +28,7 @@ import java.util.Map; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + public class RubySinatraServerCodegen extends AbstractRubyCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(RubySinatraServerCodegen.class); @@ -109,26 +110,26 @@ public class RubySinatraServerCodegen extends AbstractRubyCodegen { public String toModelName(String name) { // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. return => ModelReturn (after camelize) } // camelize the model name // phone_number => PhoneNumber - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } @Override public String toModelFilename(String name) { // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + underscore("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model filename. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore("model_" + name)); name = "model_" + name; // e.g. return => ModelReturn (after camelize) } // underscore the model file name // PhoneNumber.rb => phone_number.rb - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); } @Override @@ -137,7 +138,7 @@ public class RubySinatraServerCodegen extends AbstractRubyCodegen { name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // e.g. PhoneNumberApi.rb => phone_number_api.rb - return underscore(name) + "_api"; + return org.openapitools.codegen.utils.StringUtils.underscore(name) + "_api"; } @Override @@ -146,7 +147,7 @@ public class RubySinatraServerCodegen extends AbstractRubyCodegen { return "DefaultApi"; } // e.g. phone_number_api => PhoneNumberApi - return camelize(name) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index 2625c37d06c..da9763a281f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -39,6 +39,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; + public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(RustClientCodegen.class); public static final String PACKAGE_NAME = "packageName"; @@ -208,7 +209,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { return name; // snake_case, e.g. PetId => pet_id - name = underscore(name); + name = org.openapitools.codegen.utils.StringUtils.underscore(name); // for reserved word or word starting with number, append _ if (isReservedWord(name)) @@ -230,7 +231,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { public String toModelName(String name) { // camelize the model name // phone_number => PhoneNumber - return camelize(toModelFilename(name)); + return org.openapitools.codegen.utils.StringUtils.camelize(toModelFilename(name)); } @Override @@ -257,7 +258,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { name = "model_" + name; // e.g. 200Response => Model200Response (after camelize) } - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); } @Override @@ -266,7 +267,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // e.g. PetApi.rs => pet_api.rs - return underscore(name) + "_api"; + return org.openapitools.codegen.utils.StringUtils.underscore(name) + "_api"; } @Override @@ -339,11 +340,11 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { // method name cannot use reserved keyword, e.g. return if (isReservedWord(sanitizedOperationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + underscore("call_" + operationId)); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.underscore("call_" + operationId)); sanitizedOperationId = "call_" + sanitizedOperationId; } - return underscore(sanitizedOperationId); + return org.openapitools.codegen.utils.StringUtils.underscore(sanitizedOperationId); } @Override @@ -354,7 +355,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { List operations = (List) objectMap.get("operation"); for (CodegenOperation operation : operations) { // http method verb conversion (e.g. PUT => Put) - operation.httpMethod = camelize(operation.httpMethod.toLowerCase(Locale.ROOT)); + operation.httpMethod = org.openapitools.codegen.utils.StringUtils.camelize(operation.httpMethod.toLowerCase(Locale.ROOT)); // update return type to conform to rust standard /* if (operation.returnType != null) { @@ -470,7 +471,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { } // string - String enumName = sanitizeName(underscore(name).toUpperCase(Locale.ROOT)); + String enumName = sanitizeName(org.openapitools.codegen.utils.StringUtils.underscore(name).toUpperCase(Locale.ROOT)); enumName = enumName.replaceFirst("^_", ""); enumName = enumName.replaceFirst("_$", ""); @@ -483,7 +484,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { @Override public String toEnumName(CodegenProperty property) { - String enumName = underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); + String enumName = org.openapitools.codegen.utils.StringUtils.underscore(toModelName(property.name)).toUpperCase(Locale.ROOT); // remove [] for array or map of enum enumName = enumName.replace("[]", ""); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java index 0486327f3e2..d45ce26f0ea 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustServerCodegen.java @@ -56,6 +56,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Set; + public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(RustServerCodegen.class); @@ -303,7 +304,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { if (name.length() == 0) { return "default"; } - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); } /** @@ -333,7 +334,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { public String toModelName(String name) { // camelize the model name // phone_number => PhoneNumber - String camelizedName = camelize(toModelFilename(name)); + String camelizedName = org.openapitools.codegen.utils.StringUtils.camelize(toModelFilename(name)); // model name cannot use reserved keyword, e.g. return if (isReservedWord(camelizedName)) { @@ -366,18 +367,18 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { sanitizedName = escapeReservedWord(sanitizedName); } - return underscore(sanitizedName); + return org.openapitools.codegen.utils.StringUtils.underscore(sanitizedName); } @Override public String toOperationId(String operationId) { // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId))); + LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId))); operationId = "call_" + operationId; } - return camelize(operationId); + return org.openapitools.codegen.utils.StringUtils.camelize(operationId); } @Override @@ -394,16 +395,16 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { - LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + camelize("model_" + name)); + LOGGER.warn(name + " (reserved word) cannot be used as model name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize("model_" + name)); name = "model_" + name; // e.g. return => ModelReturn (after camelize) } - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); } @Override public String toEnumName(CodegenProperty property) { - return sanitizeName(camelize(property.name)) + "Enum"; + return sanitizeName(org.openapitools.codegen.utils.StringUtils.camelize(property.name)) + "Enum"; } @Override @@ -454,7 +455,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { name = name.replaceAll("-", "_"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. // e.g. PetApi.go => pet_api.go - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); } @Override @@ -520,8 +521,8 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { pathSetMap.put(pathId, pathSetEntry); } - op.vendorExtensions.put("operation_id", underscore(op.operationId)); - op.vendorExtensions.put("uppercase_operation_id", underscore(op.operationId).toUpperCase(Locale.ROOT)); + op.vendorExtensions.put("operation_id", org.openapitools.codegen.utils.StringUtils.underscore(op.operationId)); + op.vendorExtensions.put("uppercase_operation_id", org.openapitools.codegen.utils.StringUtils.underscore(op.operationId).toUpperCase(Locale.ROOT)); op.vendorExtensions.put("path", op.path.replace("{", ":").replace("}", "")); op.vendorExtensions.put("PATH_ID", pathId); op.vendorExtensions.put("hasPathParams", !op.pathParams.isEmpty()); @@ -598,13 +599,13 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { if (rsp.vendorExtensions.containsKey("x-responseId")) { responseId = (String) rsp.vendorExtensions.get("x-responseId"); } else if (words.length != 0) { - responseId = camelize(words[0].replace(" ", "_")); + responseId = org.openapitools.codegen.utils.StringUtils.camelize(words[0].replace(" ", "_")); } else { responseId = "Status" + rsp.code; } rsp.vendorExtensions.put("x-responseId", responseId); - rsp.vendorExtensions.put("x-uppercaseResponseId", underscore(responseId).toUpperCase(Locale.ROOT)); - rsp.vendorExtensions.put("uppercase_operation_id", underscore(op.operationId).toUpperCase(Locale.ROOT)); + rsp.vendorExtensions.put("x-uppercaseResponseId", org.openapitools.codegen.utils.StringUtils.underscore(responseId).toUpperCase(Locale.ROOT)); + rsp.vendorExtensions.put("uppercase_operation_id", org.openapitools.codegen.utils.StringUtils.underscore(op.operationId).toUpperCase(Locale.ROOT)); if (rsp.dataType != null) { rsp.vendorExtensions.put("uppercase_data_type", (rsp.dataType.replace("models::", "")).toUpperCase(Locale.ROOT)); @@ -675,7 +676,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { if (op.bodyParam != null) { // Default to consuming json - op.bodyParam.vendorExtensions.put("uppercase_operation_id", underscore(op.operationId).toUpperCase(Locale.ROOT)); + op.bodyParam.vendorExtensions.put("uppercase_operation_id", org.openapitools.codegen.utils.StringUtils.underscore(op.operationId).toUpperCase(Locale.ROOT)); if (consumesXml) { op.bodyParam.vendorExtensions.put("consumesXml", true); } else if (consumesPlainText) { @@ -688,7 +689,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { for (CodegenParameter param : op.bodyParams) { processParam(param, op); - param.vendorExtensions.put("uppercase_operation_id", underscore(op.operationId).toUpperCase(Locale.ROOT)); + param.vendorExtensions.put("uppercase_operation_id", org.openapitools.codegen.utils.StringUtils.underscore(op.operationId).toUpperCase(Locale.ROOT)); // Default to producing json if nothing else is specified if (consumesXml) { @@ -926,9 +927,9 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { // If we use a more qualified model name, then only camelize the actual type, not the qualifier. if (property.dataType.contains(":")) { int position = property.dataType.lastIndexOf(":"); - property.dataType = property.dataType.substring(0, position) + camelize(property.dataType.substring(position)); + property.dataType = property.dataType.substring(0, position) + org.openapitools.codegen.utils.StringUtils.camelize(property.dataType.substring(position)); } else { - property.dataType = camelize(property.dataType, false); + property.dataType = org.openapitools.codegen.utils.StringUtils.camelize(property.dataType, false); } } @@ -976,7 +977,7 @@ public class RustServerCodegen extends DefaultCodegen implements CodegenConfig { } } - property.name = underscore(property.name); + property.name = org.openapitools.codegen.utils.StringUtils.underscore(property.name); if (!property.required) { property.defaultValue = (property.defaultValue != null) ? "Some(" + property.defaultValue + ")" : "None"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java index d3a42542a8f..ba8ea0062dd 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaAkkaClientCodegen.java @@ -35,6 +35,7 @@ import java.io.StringWriter; import java.io.Writer; import java.util.*; + public class ScalaAkkaClientCodegen extends AbstractScalaCodegen implements CodegenConfig { protected String mainPackage = "org.openapitools.client"; protected String groupId = "org.openapitools"; @@ -335,7 +336,7 @@ public class ScalaAkkaClientCodegen extends AbstractScalaCodegen implements Code @Override public String formatFragment(String fragment) { - return camelize(fragment, !capitalizeFirst); + return org.openapitools.codegen.utils.StringUtils.camelize(fragment, !capitalizeFirst); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaHttpClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaHttpClientCodegen.java index b23a7f75ce1..f02d21d289f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaHttpClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaHttpClientCodegen.java @@ -26,6 +26,7 @@ import java.io.File; import java.util.Arrays; import java.util.HashMap; + public class ScalaHttpClientCodegen extends AbstractScalaCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(ScalaHttpClientCodegen.class); @@ -184,11 +185,11 @@ public class ScalaHttpClientCodegen extends AbstractScalaCodegen implements Code case original: return name; case camelCase: - return camelize(name, true); + return org.openapitools.codegen.utils.StringUtils.camelize(name, true); case PascalCase: - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); case snake_case: - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); default: throw new IllegalArgumentException("Invalid model property naming '" + name + "'. Must be 'original', 'camelCase', " + @@ -226,7 +227,7 @@ public class ScalaHttpClientCodegen extends AbstractScalaCodegen implements Code throw new RuntimeException(operationId + " (reserved word) cannot be used as method name"); } - return camelize(operationId, true); + return org.openapitools.codegen.utils.StringUtils.camelize(operationId, true); } @Override @@ -235,7 +236,7 @@ public class ScalaHttpClientCodegen extends AbstractScalaCodegen implements Code // camelize the model name // phone_number => PhoneNumber - final String camelizedName = camelize(sanitizedName); + final String camelizedName = org.openapitools.codegen.utils.StringUtils.camelize(sanitizedName); // model name cannot use reserved keyword, e.g. return if (isReservedWord(camelizedName)) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaLagomServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaLagomServerCodegen.java index e8f9be4d39d..1b8272a262e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaLagomServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalaLagomServerCodegen.java @@ -24,6 +24,7 @@ import java.util.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(ScalaLagomServerCodegen.class); @@ -166,11 +167,11 @@ public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements Cod case original: return name; case camelCase: - return camelize(name, true); + return org.openapitools.codegen.utils.StringUtils.camelize(name, true); case PascalCase: - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); case snake_case: - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); default: throw new IllegalArgumentException("Invalid model property naming '" + name + "'. Must be 'original', 'camelCase', " + @@ -206,7 +207,7 @@ public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements Cod throw new RuntimeException(operationId + " (reserved word) cannot be used as method name"); } - return camelize(operationId, true); + return org.openapitools.codegen.utils.StringUtils.camelize(operationId, true); } @Override @@ -215,7 +216,7 @@ public class ScalaLagomServerCodegen extends AbstractScalaCodegen implements Cod // camelize the model name // phone_number => PhoneNumber - final String camelizedName = camelize(sanitizedName); + final String camelizedName = org.openapitools.codegen.utils.StringUtils.camelize(sanitizedName); // model name cannot use reserved keyword, e.g. return if (isReservedWord(camelizedName)) { diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalazClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalazClientCodegen.java index 0e55600fa65..6936e6df867 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalazClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/ScalazClientCodegen.java @@ -31,6 +31,7 @@ import java.io.Writer; import java.util.Arrays; import java.util.HashMap; + public class ScalazClientCodegen extends AbstractScalaCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(ScalazClientCodegen.class); @@ -163,11 +164,11 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen case original: return name; case camelCase: - return camelize(name, true); + return org.openapitools.codegen.utils.StringUtils.camelize(name, true); case PascalCase: - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); case snake_case: - return underscore(name); + return org.openapitools.codegen.utils.StringUtils.underscore(name); default: throw new IllegalArgumentException("Invalid model property naming '" + name + "'. Must be 'original', 'camelCase', " + @@ -203,7 +204,7 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen throw new RuntimeException(operationId + " (reserved word) cannot be used as method name"); } - return camelize(operationId, true); + return org.openapitools.codegen.utils.StringUtils.camelize(operationId, true); } @Override @@ -212,7 +213,7 @@ public class ScalazClientCodegen extends AbstractScalaCodegen implements Codegen // camelize the model name // phone_number => PhoneNumber - final String camelizedName = camelize(sanitizedName); + final String camelizedName = org.openapitools.codegen.utils.StringUtils.camelize(sanitizedName); // model name cannot use reserved keyword, e.g. return if (isReservedWord(camelizedName)) { 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 5e6f269880e..78b7075c667 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 @@ -49,6 +49,7 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.stream.Collectors; + public class SpringCodegen extends AbstractJavaCodegen implements BeanValidationFeatures, OptionalFeatures { private static final Logger LOGGER = LoggerFactory.getLogger(SpringCodegen.class); @@ -60,6 +61,8 @@ public class SpringCodegen extends AbstractJavaCodegen public static final String INTERFACE_ONLY = "interfaceOnly"; public static final String DELEGATE_PATTERN = "delegatePattern"; public static final String SINGLE_CONTENT_TYPES = "singleContentTypes"; + public static final String VIRTUAL_SERVICE = "virtualService"; + public static final String JAVA_8 = "java8"; public static final String ASYNC = "async"; public static final String REACTIVE = "reactive"; @@ -89,6 +92,7 @@ public class SpringCodegen extends AbstractJavaCodegen protected boolean openapiDocketConfig = false; protected boolean apiFirst = false; protected boolean useOptional = false; + protected boolean virtualService = false; public SpringCodegen() { super(); @@ -113,6 +117,7 @@ public class SpringCodegen extends AbstractJavaCodegen 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(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)); cliOptions.add(CliOption.newBoolean(IMPLICIT_HEADERS, "Use of @ApiImplicitParams for headers.", implicitHeaders)); @@ -197,6 +202,10 @@ public class SpringCodegen extends AbstractJavaCodegen } else { additionalProperties.put(BASE_PACKAGE, basePackage); } + + if (additionalProperties.containsKey(VIRTUAL_SERVICE)) { + this.setVirtualService(Boolean.valueOf(additionalProperties.get(VIRTUAL_SERVICE).toString())); + } if (additionalProperties.containsKey(INTERFACE_ONLY)) { this.setInterfaceOnly(Boolean.valueOf(additionalProperties.get(INTERFACE_ONLY).toString())); @@ -212,6 +221,8 @@ public class SpringCodegen extends AbstractJavaCodegen if (additionalProperties.containsKey(ASYNC)) { this.setAsync(Boolean.valueOf(additionalProperties.get(ASYNC).toString())); + //fix for issue/1164 + convertPropertyToBooleanAndWriteBack(ASYNC); } if (additionalProperties.containsKey(REACTIVE)) { @@ -354,6 +365,9 @@ public class SpringCodegen extends AbstractJavaCodegen if (this.async) { additionalProperties.put(RESPONSE_WRAPPER, "CompletableFuture"); } + if (this.reactive) { + additionalProperties.put(RESPONSE_WRAPPER, "Mono"); + } } else if (this.async) { additionalProperties.put(RESPONSE_WRAPPER, "Callable"); } @@ -441,7 +455,7 @@ public class SpringCodegen extends AbstractJavaCodegen title = title.substring(0, title.length() - 3); } - this.title = camelize(sanitizeName(title), true); + this.title = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(title), true); } additionalProperties.put(TITLE, this.title); } @@ -591,7 +605,7 @@ public class SpringCodegen extends AbstractJavaCodegen List authMethods = (List) objs.get("authMethods"); if (authMethods != null) { for (CodegenSecurity authMethod : authMethods) { - authMethod.name = camelize(sanitizeName(authMethod.name), true); + authMethod.name = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(authMethod.name), true); } } } @@ -604,7 +618,7 @@ public class SpringCodegen extends AbstractJavaCodegen return "DefaultApi"; } name = sanitizeName(name); - return camelize(name) + "Api"; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + "Api"; } @Override @@ -663,6 +677,8 @@ public class SpringCodegen extends AbstractJavaCodegen public void setJava8(boolean java8) { this.java8 = java8; } + public void setVirtualService(boolean virtualService) { this.virtualService = virtualService; } + public void setAsync(boolean async) { this.async = async; } public void setReactive(boolean reactive) { this.reactive = reactive; } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java index a975cf63bd7..e220f906343 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/StaticHtml2Generator.java @@ -45,6 +45,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; + public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(StaticHtml2Generator.class); @@ -161,7 +162,7 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi Info info = openAPI.getInfo(); if (StringUtils.isBlank(jsProjectName) && info.getTitle() != null) { // when jsProjectName is not specified, generate it from info.title - jsProjectName = sanitizeName(dashize(info.getTitle())); + jsProjectName = sanitizeName(org.openapitools.codegen.utils.StringUtils.dashize(info.getTitle())); } } @@ -170,7 +171,7 @@ public class StaticHtml2Generator extends DefaultCodegen implements CodegenConfi jsProjectName = "openapi-js-client"; } if (StringUtils.isBlank(jsModuleName)) { - jsModuleName = camelize(underscore(jsProjectName)); + jsModuleName = org.openapitools.codegen.utils.StringUtils.camelize(org.openapitools.codegen.utils.StringUtils.underscore(jsProjectName)); } additionalProperties.put("jsProjectName", jsProjectName); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift3Codegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift3Codegen.java index a8b3f0d64e5..745c57ee42e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift3Codegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/Swift3Codegen.java @@ -19,6 +19,7 @@ package org.openapitools.codegen.languages; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.text.WordUtils; @@ -32,6 +33,7 @@ import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; + public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(Swift3Codegen.class); @@ -241,6 +243,10 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { public void processOpts() { super.processOpts(); + if (StringUtils.isEmpty(System.getenv("SWIFT_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable SWIFT_POST_PROCESS_FILE not defined so the Swift code may not be properly formatted. To define it, try 'export SWIFT_POST_PROCESS_FILE=/usr/local/bin/swiftformat' (Linux/Mac)"); + } + // Setup project name if (additionalProperties.containsKey(PROJECT_NAME)) { setProjectName((String) additionalProperties.get(PROJECT_NAME)); @@ -382,7 +388,7 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { // camelize the model name // phone_number => PhoneNumber - name = camelize(name); + name = org.openapitools.codegen.utils.StringUtils.camelize(name); // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { @@ -440,7 +446,7 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { @Override public String toOperationId(String operationId) { - operationId = camelize(sanitizeName(operationId), true); + operationId = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true); // throw exception if method name is empty. This should not happen but keep the check just in case if (StringUtils.isEmpty(operationId)) { @@ -449,15 +455,15 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - String newOperationId = camelize(("call_" + operationId), true); + String newOperationId = org.openapitools.codegen.utils.StringUtils.camelize(("call_" + operationId), true); LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); return newOperationId; } // operationId starts with a number if (operationId.matches("^\\d.*")) { - LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true)); - operationId = camelize(sanitizeName("call_" + operationId), true); + LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId), true)); + operationId = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId), true); } return operationId; @@ -475,7 +481,7 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { // camelize the variable name // pet_id => petId - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -498,9 +504,9 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { return name; } - // camelize(lower) the variable name + // org.openapitools.codegen.utils.StringUtils.camelize(lower) the variable name // pet_id => petId - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -579,18 +585,18 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { String startingNumbers = startWithNumberMatcher.group(0); String nameWithoutStartingNumbers = name.substring(startingNumbers.length()); - return "_" + startingNumbers + camelize(nameWithoutStartingNumbers, true); + return "_" + startingNumbers + org.openapitools.codegen.utils.StringUtils.camelize(nameWithoutStartingNumbers, true); } // for symbol, e.g. $, # if (getSymbolName(name) != null) { - return camelize(WordUtils.capitalizeFully(getSymbolName(name).toUpperCase(Locale.ROOT)), true); + return org.openapitools.codegen.utils.StringUtils.camelize(WordUtils.capitalizeFully(getSymbolName(name).toUpperCase(Locale.ROOT)), true); } // Camelize only when we have a structure defined below Boolean camelized = false; if (name.matches("[A-Z][a-z0-9]+[a-zA-Z0-9]*")) { - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); camelized = true; } @@ -603,7 +609,7 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { // Check for numerical conversions if ("Int".equals(datatype) || "Int32".equals(datatype) || "Int64".equals(datatype) || "Float".equals(datatype) || "Double".equals(datatype)) { - String varName = "number" + camelize(name); + String varName = "number" + org.openapitools.codegen.utils.StringUtils.camelize(name); varName = varName.replaceAll("-", "minus"); varName = varName.replaceAll("\\+", "plus"); varName = varName.replaceAll("\\.", "dot"); @@ -617,7 +623,7 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { } char[] separators = {'-', '_', ' ', ':', '(', ')'}; - return camelize(WordUtils.capitalizeFully(StringUtils.lowerCase(name), separators).replaceAll("[-_ :\\(\\)]", ""), true); + return org.openapitools.codegen.utils.StringUtils.camelize(WordUtils.capitalizeFully(StringUtils.lowerCase(name), separators).replaceAll("[-_ :\\(\\)]", ""), true); } @Override @@ -680,4 +686,31 @@ public class Swift3Codegen extends DefaultCodegen implements CodegenConfig { public String escapeUnsafeCharacters(String input) { return input.replace("*/", "*_/").replace("/*", "/_*"); } + + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + String swiftPostProcessFile = System.getenv("SWIFT_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(swiftPostProcessFile)) { + return; // skip if SWIFT_POST_PROCESS_FILE env variable is not defined + } + + // only process files with swift extension + if ("swift".equals(FilenameUtils.getExtension(file.toString()))) { + String command = swiftPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } } 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 76e2b0602bd..561c9a815e8 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 @@ -19,6 +19,7 @@ package org.openapitools.codegen.languages; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Schema; +import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.text.WordUtils; @@ -26,12 +27,14 @@ import org.openapitools.codegen.*; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.commons.io.FilenameUtils; import java.io.File; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; + public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { private static final Logger LOGGER = LoggerFactory.getLogger(Swift4Codegen.class); @@ -295,6 +298,10 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { public void processOpts() { super.processOpts(); + if (StringUtils.isEmpty(System.getenv("SWIFT_POST_PROCESS_FILE"))) { + LOGGER.info("Environment variable SWIFT_POST_PROCESS_FILE not defined so the Swift code may not be properly formatted. To define it, try 'export SWIFT_POST_PROCESS_FILE=/usr/local/bin/swiftformat' (Linux/Mac)"); + } + // Setup project name if (additionalProperties.containsKey(PROJECT_NAME)) { setProjectName((String) additionalProperties.get(PROJECT_NAME)); @@ -472,7 +479,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { // camelize the model name // phone_number => PhoneNumber - name = camelize(name); + name = org.openapitools.codegen.utils.StringUtils.camelize(name); // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { @@ -509,6 +516,11 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { @Override public String toDefaultValue(Schema p) { + if (p.getEnum() != null && !p.getEnum().isEmpty()) { + if (p.getDefault() != null) { + return "." + escapeText((String) p.getDefault()); + } + } if (ModelUtils.isIntegerSchema(p) || ModelUtils.isNumberSchema(p) || ModelUtils.isBooleanSchema(p)) { if (p.getDefault() != null) { return p.getDefault().toString(); @@ -543,7 +555,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { @Override public String toOperationId(String operationId) { - operationId = camelize(sanitizeName(operationId), true); + operationId = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true); // Throw exception if method name is empty. // This should not happen but keep the check just in case @@ -553,7 +565,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - String newOperationId = camelize(("call_" + operationId), true); + String newOperationId = org.openapitools.codegen.utils.StringUtils.camelize(("call_" + operationId), true); LOGGER.warn(operationId + " (reserved word) cannot be used as method name." + " Renamed to " + newOperationId); return newOperationId; @@ -561,8 +573,8 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { // operationId starts with a number if (operationId.matches("^\\d.*")) { - LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true)); - operationId = camelize(sanitizeName("call_" + operationId), true); + LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId), true)); + operationId = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId), true); } @@ -581,7 +593,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { // camelize the variable name // pet_id => petId - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -604,9 +616,9 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { return name; } - // camelize(lower) the variable name + // org.openapitools.codegen.utils.StringUtils.camelize(lower) the variable name // pet_id => petId - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -692,18 +704,18 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { String startingNumbers = startWithNumberMatcher.group(0); String nameWithoutStartingNumbers = name.substring(startingNumbers.length()); - return "_" + startingNumbers + camelize(nameWithoutStartingNumbers, true); + return "_" + startingNumbers + org.openapitools.codegen.utils.StringUtils.camelize(nameWithoutStartingNumbers, true); } // for symbol, e.g. $, # if (getSymbolName(name) != null) { - return camelize(WordUtils.capitalizeFully(getSymbolName(name).toUpperCase(Locale.ROOT)), true); + return org.openapitools.codegen.utils.StringUtils.camelize(WordUtils.capitalizeFully(getSymbolName(name).toUpperCase(Locale.ROOT)), true); } // Camelize only when we have a structure defined below Boolean camelized = false; if (name.matches("[A-Z][a-z0-9]+[a-zA-Z0-9]*")) { - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); camelized = true; } @@ -716,7 +728,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { // Check for numerical conversions if ("Int".equals(datatype) || "Int32".equals(datatype) || "Int64".equals(datatype) || "Float".equals(datatype) || "Double".equals(datatype)) { - String varName = "number" + camelize(name); + String varName = "number" + org.openapitools.codegen.utils.StringUtils.camelize(name); varName = varName.replaceAll("-", "minus"); varName = varName.replaceAll("\\+", "plus"); varName = varName.replaceAll("\\.", "dot"); @@ -730,7 +742,7 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { } char[] separators = {'-', '_', ' ', ':', '(', ')'}; - return camelize(WordUtils.capitalizeFully(StringUtils.lowerCase(name), separators) + return org.openapitools.codegen.utils.StringUtils.camelize(WordUtils.capitalizeFully(StringUtils.lowerCase(name), separators) .replaceAll("[-_ :\\(\\)]", ""), true); } @@ -830,4 +842,30 @@ public class Swift4Codegen extends DefaultCodegen implements CodegenConfig { public String escapeUnsafeCharacters(String input) { return input.replace("*/", "*_/").replace("/*", "/_*"); } + + @Override + public void postProcessFile(File file, String fileType) { + if (file == null) { + return; + } + String swiftPostProcessFile = System.getenv("SWIFT_POST_PROCESS_FILE"); + if (StringUtils.isEmpty(swiftPostProcessFile)) { + return; // skip if SWIFT_POST_PROCESS_FILE env variable is not defined + } + // only process files with swift extension + if ("swift".equals(FilenameUtils.getExtension(file.toString()))) { + String command = swiftPostProcessFile + " " + file.toString(); + try { + Process p = Runtime.getRuntime().exec(command); + int exitValue = p.waitFor(); + if (exitValue != 0) { + LOGGER.error("Error running the command ({}). Exit value: {}", command, exitValue); + } else { + LOGGER.info("Successfully executed: " + command); + } + } catch (Exception e) { + LOGGER.error("Error running the command ({}). Exception: {}", command, e.getMessage()); + } + } + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SwiftClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SwiftClientCodegen.java index 97aeb0479b2..775694c5e09 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SwiftClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SwiftClientCodegen.java @@ -34,6 +34,7 @@ import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; + /** * Swift (2.x) generator is no longer actively maintained. Please use * 'swift3' or 'swift4' generator instead. @@ -319,7 +320,7 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig // camelize the model name // phone_number => PhoneNumber - name = camelize(name); + name = org.openapitools.codegen.utils.StringUtils.camelize(name); // model name cannot use reserved keyword, e.g. return if (isReservedWord(name)) { @@ -436,7 +437,7 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig @Override public String toOperationId(String operationId) { - operationId = camelize(sanitizeName(operationId), true); + operationId = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName(operationId), true); // throw exception if method name is empty. This should not happen but keep the check just in case if (StringUtils.isEmpty(operationId)) { @@ -445,15 +446,15 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig // method name cannot use reserved keyword, e.g. return if (isReservedWord(operationId)) { - String newOperationId = camelize(("call_" + operationId), true); + String newOperationId = org.openapitools.codegen.utils.StringUtils.camelize(("call_" + operationId), true); LOGGER.warn(operationId + " (reserved word) cannot be used as method name. Renamed to " + newOperationId); return newOperationId; } // operationId starts with a number if (operationId.matches("^\\d.*")) { - LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + camelize(sanitizeName("call_" + operationId), true)); - operationId = camelize(sanitizeName("call_" + operationId), true); + LOGGER.warn(operationId + " (starting with a number) cannot be used as method name. Renamed to " + org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId), true)); + operationId = org.openapitools.codegen.utils.StringUtils.camelize(sanitizeName("call_" + operationId), true); } return operationId; @@ -471,7 +472,7 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig // camelize the variable name // pet_id => petId - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -494,9 +495,9 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig return name; } - // camelize(lower) the variable name + // org.openapitools.codegen.utils.StringUtils.camelize(lower) the variable name // pet_id => petId - name = camelize(name, true); + name = org.openapitools.codegen.utils.StringUtils.camelize(name, true); // for reserved word or word starting with number, append _ if (isReservedWord(name) || name.matches("^\\d.*")) { @@ -524,7 +525,7 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig builder.append(stringBeforeMatch); String group = matcher.group().substring(1, matcher.group().length() - 1); - group = camelize(group, true); + group = org.openapitools.codegen.utils.StringUtils.camelize(group, true); builder .append("{") .append(group) @@ -583,7 +584,7 @@ public class SwiftClientCodegen extends DefaultCodegen implements CodegenConfig } // string - String enumName = sanitizeName(underscore(name).toUpperCase(Locale.ROOT)); + String enumName = sanitizeName(org.openapitools.codegen.utils.StringUtils.underscore(name).toUpperCase(Locale.ROOT)); enumName = enumName.replaceFirst("^_", ""); enumName = enumName.replaceFirst("_$", ""); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java index c08a980a339..5704ce5fbd1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java @@ -29,6 +29,7 @@ import java.io.File; import java.text.SimpleDateFormat; import java.util.*; + public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptAngularClientCodegen.class); @@ -49,6 +50,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode public static final String SERVICE_FILE_SUFFIX = "serviceFileSuffix"; public static final String MODEL_SUFFIX = "modelSuffix"; public static final String MODEL_FILE_SUFFIX = "modelFileSuffix"; + public static final String FILE_NAMING = "fileNaming"; protected String npmName = null; protected String npmVersion = "1.0.0"; @@ -57,6 +59,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode protected String serviceFileSuffix = ".service"; protected String modelSuffix = ""; protected String modelFileSuffix = ""; + protected String fileNaming = "camelCase"; private boolean taggedUnions = false; @@ -94,6 +97,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode this.cliOptions.add(new CliOption(SERVICE_FILE_SUFFIX, "The suffix of the file of the generated service (service.ts). Default is '.service'.")); this.cliOptions.add(new CliOption(MODEL_SUFFIX, "The suffix of the generated model. Default is ''.")); this.cliOptions.add(new CliOption(MODEL_FILE_SUFFIX, "The suffix of the file of the generated model (model.ts). Default is ''.")); + this.cliOptions.add(new CliOption(FILE_NAMING, "Naming convention for the output files: 'camelCase', 'kebab-case'. Default is 'camelCase'.")); } @Override @@ -188,6 +192,9 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode modelFileSuffix = additionalProperties.get(MODEL_FILE_SUFFIX).toString(); validateFileSuffixArgument("Model", modelFileSuffix); } + if (additionalProperties.containsKey(FILE_NAMING)) { + this.setFileNaming(additionalProperties.get(FILE_NAMING).toString()); + } } private void addNpmPackageGeneration(SemVer ngVersion) { @@ -374,7 +381,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode List> imports = (List>) operations.get("imports"); for (Map im : imports) { im.put("filename", im.get("import")); - im.put("classname", getModelnameFromModelFilename(im.get("filename").toString())); + im.put("classname", im.get("classname")); } return operations; @@ -455,7 +462,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode if (name.length() == 0) { return "default.service"; } - return camelize(removeModelSuffixIfNecessary(name), true) + serviceFileSuffix; + return this.convertUsingFileNamingConvention(name) + serviceFileSuffix; } @Override @@ -465,8 +472,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode @Override public String toModelFilename(String name) { - String modelName = toModelName(name); - return camelize(removeModelSuffixIfNecessary(modelName), true) + modelFileSuffix; + return this.sanitizeName(this.convertUsingFileNamingConvention(name) + modelFileSuffix); } @Override @@ -511,7 +517,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode if (modelFileSuffix.length() > 0) { name = name.substring(0, name.length() - modelFileSuffix.length()); } - return camelize(name) + modelSuffix; + return org.openapitools.codegen.utils.StringUtils.camelize(name) + modelSuffix; } @Override @@ -557,4 +563,32 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode ); } } + + /** + * Set the file naming type. + * @param fileNaming the file naming to use + */ + private void setFileNaming(String fileNaming) { + if ("camelCase".equals(fileNaming) || "kebab-case".equals(fileNaming)) { + this.fileNaming = fileNaming; + } else { + throw new IllegalArgumentException("Invalid file naming '" + + fileNaming + "'. Must be 'camelCase' or 'kebab-case'"); + } + } + + /** + * Converts the original name according to the current fileNaming strategy. + * @param originalName the original name to transform + * @return the transformed name + */ + private String convertUsingFileNamingConvention(String originalName) { + String name = this.removeModelSuffixIfNecessary(originalName); + if ("kebab-case".equals(fileNaming)) { + name = dashize(underscore(name)); + } else { + name = camelize(name, true); + } + return name; + } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java new file mode 100644 index 00000000000..f44c276b04b --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java @@ -0,0 +1,159 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.languages; + +import io.swagger.v3.oas.models.media.ArraySchema; +import io.swagger.v3.oas.models.media.Schema; +import io.swagger.v3.parser.util.SchemaTypeUtil; +import org.openapitools.codegen.CliOption; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.SupportingFile; +import org.openapitools.codegen.utils.ModelUtils; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.Locale; + +public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodegen { + private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm", Locale.ROOT); + + public static final String NPM_NAME = "npmName"; + public static final String NPM_VERSION = "npmVersion"; + public static final String NPM_REPOSITORY = "npmRepository"; + public static final String SNAPSHOT = "snapshot"; + public static final String WITH_INTERFACES = "withInterfaces"; + + protected String npmName = null; + protected String npmVersion = "1.0.0"; + protected String npmRepository = null; + + public TypeScriptAxiosClientCodegen() { + super(); + + // clear import mapping (from default generator) as TS does not use it + // at the moment + importMapping.clear(); + + outputFolder = "generated-code/typescript-axios"; + embeddedTemplateDir = templateDir = "typescript-axios"; + + this.cliOptions.add(new CliOption(NPM_NAME, "The name under which you want to publish generated npm package")); + this.cliOptions.add(new CliOption(NPM_VERSION, "The version of your npm package")); + this.cliOptions.add(new CliOption(NPM_REPOSITORY, "Use this property to set an url your private npmRepo in the package.json")); + this.cliOptions.add(new CliOption(SNAPSHOT, "When setting this property to true the version will be suffixed with -SNAPSHOT.yyyyMMddHHmm", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); + this.cliOptions.add(new CliOption(WITH_INTERFACES, "Setting this property to true will generate interfaces next to the default class implementations.", SchemaTypeUtil.BOOLEAN_TYPE).defaultValue(Boolean.FALSE.toString())); + } + + @Override + public String getName() { + return "typescript-axios"; + } + + @Override + public String getHelp() { + return "Generates a TypeScript client library using axios."; + } + + public String getNpmName() { + return npmName; + } + + public void setNpmName(String npmName) { + this.npmName = npmName; + } + + public String getNpmVersion() { + return npmVersion; + } + + public void setNpmVersion(String npmVersion) { + this.npmVersion = npmVersion; + } + + public String getNpmRepository() { + return npmRepository; + } + + public void setNpmRepository(String npmRepository) { + this.npmRepository = npmRepository; + } + + @Override + public void processOpts() { + super.processOpts(); + supportingFiles.add(new SupportingFile("index.mustache", "", "index.ts")); + supportingFiles.add(new SupportingFile("api.mustache", "", "api.ts")); + supportingFiles.add(new SupportingFile("configuration.mustache", "", "configuration.ts")); + supportingFiles.add(new SupportingFile("custom.d.mustache", "", "custom.d.ts")); + supportingFiles.add(new SupportingFile("git_push.sh.mustache", "", "git_push.sh")); + supportingFiles.add(new SupportingFile("gitignore", "", ".gitignore")); + + if (additionalProperties.containsKey(NPM_NAME)) { + addNpmPackageGeneration(); + } + } + + @Override + public String getTypeDeclaration(Schema p) { + Schema inner; + if (ModelUtils.isArraySchema(p)) { + inner = ((ArraySchema) p).getItems(); + return this.getSchemaType(p) + "<" + this.getTypeDeclaration(inner) + ">"; + } else if (ModelUtils.isMapSchema(p)) { + inner = ModelUtils.getAdditionalProperties(p); + return "{ [key: string]: " + this.getTypeDeclaration(inner) + "; }"; + } else if (ModelUtils.isFileSchema(p)) { + return "any"; + } else if (ModelUtils.isBinarySchema(p)) { + return "any"; + } else { + return super.getTypeDeclaration(p); + } + } + + @Override + protected void addAdditionPropertiesToCodeGenModel(CodegenModel codegenModel, Schema schema) { + codegenModel.additionalPropertiesType = getTypeDeclaration(ModelUtils.getAdditionalProperties(schema)); + addImport(codegenModel, codegenModel.additionalPropertiesType); + } + + private void addNpmPackageGeneration() { + if (additionalProperties.containsKey(NPM_NAME)) { + this.setNpmName(additionalProperties.get(NPM_NAME).toString()); + } + + if (additionalProperties.containsKey(NPM_VERSION)) { + this.setNpmVersion(additionalProperties.get(NPM_VERSION).toString()); + } + + if (additionalProperties.containsKey(SNAPSHOT) && Boolean.valueOf(additionalProperties.get(SNAPSHOT).toString())) { + this.setNpmVersion(npmVersion + "-SNAPSHOT." + SNAPSHOT_SUFFIX_FORMAT.format(new Date())); + } + additionalProperties.put(NPM_VERSION, npmVersion); + + if (additionalProperties.containsKey(NPM_REPOSITORY)) { + this.setNpmRepository(additionalProperties.get(NPM_REPOSITORY).toString()); + } + + //Files for building our lib + supportingFiles.add(new SupportingFile("README.mustache", "", "README.md")); + supportingFiles.add(new SupportingFile("package.mustache", "", "package.json")); + supportingFiles.add(new SupportingFile("tsconfig.mustache", "", "tsconfig.json")); + } + +} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java index 28259a7dcdb..9ca446c5a80 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptInversifyClientCodegen.java @@ -29,6 +29,7 @@ import java.text.SimpleDateFormat; import java.util.*; + public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCodegen { private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm", Locale.ROOT); private static final String X_DISCRIMINATOR_TYPE = "x-discriminator-value"; @@ -326,7 +327,7 @@ public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCo if (name.length() == 0) { return "default.service"; } - return camelize(name, true) + ".service"; + return org.openapitools.codegen.utils.StringUtils.camelize(name, true) + ".service"; } @Override @@ -336,7 +337,7 @@ public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCo @Override public String toModelFilename(String name) { - return camelize(toModelName(name), true); + return org.openapitools.codegen.utils.StringUtils.camelize(toModelName(name), true); } @Override @@ -375,7 +376,7 @@ public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCo private String getModelnameFromModelFilename(String filename) { String name = filename.substring((modelPackage() + "/").length()); - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } } 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 3e6b1848f01..6021187cd04 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 @@ -29,6 +29,7 @@ import java.io.File; import java.text.SimpleDateFormat; import java.util.*; + public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen { private static final Logger LOGGER = LoggerFactory.getLogger(TypeScriptNodeClientCodegen.class); private static final SimpleDateFormat SNAPSHOT_SUFFIX_FORMAT = new SimpleDateFormat("yyyyMMddHHmm", Locale.ROOT); @@ -106,7 +107,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen if (name.length() == 0) { return "default" + apiSuffix; } - return camelize(name, true) + apiSuffix; + return org.openapitools.codegen.utils.StringUtils.camelize(name, true) + apiSuffix; } @Override @@ -116,7 +117,7 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen @Override public String toModelFilename(String name) { - return camelize(toModelName(name), true); + return org.openapitools.codegen.utils.StringUtils.camelize(toModelName(name), true); } @Override @@ -295,6 +296,6 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen private String getModelnameFromModelFilename(String filename) { String name = filename.substring((modelPackage() + File.separator).length()); - return camelize(name); + return org.openapitools.codegen.utils.StringUtils.camelize(name); } } diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/mustache/CamelCaseLambda.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/mustache/CamelCaseLambda.java index 5dcfde31d80..f67b0e848a2 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/mustache/CamelCaseLambda.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/mustache/CamelCaseLambda.java @@ -17,17 +17,16 @@ package org.openapitools.codegen.mustache; -import com.google.common.base.CaseFormat; import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Template; import org.openapitools.codegen.CodegenConfig; -import org.openapitools.codegen.DefaultCodegen; -import org.apache.commons.lang3.StringUtils; -import org.apache.commons.lang3.text.WordUtils; import java.io.IOException; import java.io.Writer; +import static org.openapitools.codegen.utils.StringUtils.camelize; + + /** * Converts text in a fragment to camelCase. * @@ -61,7 +60,7 @@ public class CamelCaseLambda implements Mustache.Lambda { @Override public void execute(Template.Fragment fragment, Writer writer) throws IOException { - String text = DefaultCodegen.camelize(fragment.execute(), true); + String text = camelize(fragment.execute(), true); if (generator != null) { text = generator.sanitizeName(text); if (generator.reservedWords().contains(text)) { 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 7d2eeb40c43..7182ea67cbe 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 @@ -308,7 +308,7 @@ public class ModelUtils { if (schema.getAdditionalProperties() instanceof Schema) { return true; } - if (schema.getAdditionalProperties() instanceof Boolean && (Boolean)schema.getAdditionalProperties()) { + if (schema.getAdditionalProperties() instanceof Boolean && (Boolean) schema.getAdditionalProperties()) { return true; } return false; @@ -638,21 +638,42 @@ public class ModelUtils { * Get the actual schema from aliases. If the provided schema is not an alias, the schema itself will be returned. * * @param allSchemas all schemas - * @param schema schema (alias or direct reference) + * @param schema schema (alias or direct reference) * @return actual schema */ public static Schema unaliasSchema(Map allSchemas, Schema schema) { + if (allSchemas == null || allSchemas.isEmpty()) { + LOGGER.warn("allSchemas cann't be null/empty in unaliasSchema. Returned 'schema'"); + return schema; + } + if (schema != null && StringUtils.isNotEmpty(schema.get$ref())) { Schema ref = allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref())); if (ref == null) { LOGGER.warn("{} is not defined", schema.get$ref()); return schema; - } else if (isObjectSchema(ref)) { // model - return schema; - } else if (isStringSchema(ref) && (ref.getEnum() != null && !ref.getEnum().isEmpty())) { + } else if (ref.getEnum() != null && !ref.getEnum().isEmpty()) { // top-level enum class return schema; - } else if (isMapSchema(ref) || isArraySchema(ref) || isComposedSchema(ref)) { // map/array def should be created as models + } else if (isArraySchema(ref) || isComposedSchema(ref)) { // array def should be created as models + return schema; + } else if (isMapSchema(ref)) { + if (ref.getProperties() != null && !ref.getProperties().isEmpty()) // has properties + return schema; // treat it as model + else { + // treat it as a typical map + /* TODO unalias the map item if it's an alias + if (ref.getAdditionalProperties() != null) { + + Schema innerSchema = (Schema) ref.getAdditionalProperties(); + if (StringUtils.isNotEmpty(innerSchema.get$ref())) { // map item is a ref to something else + //Schema unaliasInnerSchema = unaliasSchema(allSchemas, allSchemas.get(ModelUtils.getSimpleRef(innerSchema.get$ref()))); + //ref.setAdditionalProperties(unaliasInnerSchema); + } + }*/ + return unaliasSchema(allSchemas, allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref()))); + } + } else if (isObjectSchema(ref)) { // model return schema; } else { return unaliasSchema(allSchemas, allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref()))); @@ -662,10 +683,10 @@ public class ModelUtils { } public static Schema getAdditionalProperties(Schema schema) { - if(schema.getAdditionalProperties() instanceof Schema) { + if (schema.getAdditionalProperties() instanceof Schema) { return (Schema) schema.getAdditionalProperties(); } - if(schema.getAdditionalProperties() instanceof Boolean && (Boolean)schema.getAdditionalProperties()) { + if (schema.getAdditionalProperties() instanceof Boolean && (Boolean) schema.getAdditionalProperties()) { return new ObjectSchema(); } return null; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/StringUtils.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/StringUtils.java new file mode 100644 index 00000000000..47679a6f8f2 --- /dev/null +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/StringUtils.java @@ -0,0 +1,165 @@ +package org.openapitools.codegen.utils; + +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +public class StringUtils { + /** + * Underscore the given word. + * Copied from Twitter elephant bird + * https://github.com/twitter/elephant-bird/blob/master/core/src/main/java/com/twitter/elephantbird/util/Strings.java + * + * @param word The word + * @return The underscored version of the word + */ + public static String underscore(String word) { + String firstPattern = "([A-Z]+)([A-Z][a-z])"; + String secondPattern = "([a-z\\d])([A-Z])"; + String replacementPattern = "$1_$2"; + // Replace package separator with slash. + word = word.replaceAll("\\.", "/"); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + // Replace $ with two underscores for inner classes. + word = word.replaceAll("\\$", "__"); + // Replace capital letter with _ plus lowercase letter. + word = word.replaceAll(firstPattern, replacementPattern); + word = word.replaceAll(secondPattern, replacementPattern); + word = word.replace('-', '_'); + // replace space with underscore + word = word.replace(' ', '_'); + word = word.toLowerCase(Locale.ROOT); + return word; + } + + /** + * Dashize the given word. + * + * @param word The word + * @return The dashized version of the word, e.g. "my-name" + */ + public static String dashize(String word) { + return underscore(word).replaceAll("[_ ]", "-"); + } + + /** + * Camelize name (parameter, property, method, etc) with upper case for first letter + * copied from Twitter elephant bird + * https://github.com/twitter/elephant-bird/blob/master/core/src/main/java/com/twitter/elephantbird/util/Strings.java + * + * @param word string to be camelize + * @return camelized string + */ + public static String camelize(String word) { + return camelize(word, false); + } + + /** + * Camelize name (parameter, property, method, etc) + * + * @param word string to be camelize + * @param lowercaseFirstLetter lower case for first letter if set to true + * @return camelized string + */ + public static String camelize(String word, boolean lowercaseFirstLetter) { + // Replace all slashes with dots (package separator) + Pattern p = Pattern.compile("\\/(.?)"); + Matcher m = p.matcher(word); + while (m.find()) { + word = m.replaceFirst("." + m.group(1)/*.toUpperCase()*/); // FIXME: a parameter should not be assigned. Also declare the methods parameters as 'final'. + m = p.matcher(word); + } + + // case out dots + String[] parts = word.split("\\."); + StringBuilder f = new StringBuilder(); + for (String z : parts) { + if (z.length() > 0) { + f.append(Character.toUpperCase(z.charAt(0))).append(z.substring(1)); + } + } + word = f.toString(); + + m = p.matcher(word); + while (m.find()) { + word = m.replaceFirst("" + Character.toUpperCase(m.group(1).charAt(0)) + m.group(1).substring(1)/*.toUpperCase()*/); + m = p.matcher(word); + } + + // Uppercase the class name. + p = Pattern.compile("(\\.?)(\\w)([^\\.]*)$"); + m = p.matcher(word); + if (m.find()) { + String rep = m.group(1) + m.group(2).toUpperCase(Locale.ROOT) + m.group(3); + rep = rep.replaceAll("\\$", "\\\\\\$"); + word = m.replaceAll(rep); + } + + // Remove all underscores (underscore_case to camelCase) + p = Pattern.compile("(_)(.)"); + m = p.matcher(word); + while (m.find()) { + String original = m.group(2); + String upperCase = original.toUpperCase(Locale.ROOT); + if (original.equals(upperCase)) { + word = word.replaceFirst("_", ""); + } else { + word = m.replaceFirst(upperCase); + } + m = p.matcher(word); + } + + // Remove all hyphens (hyphen-case to camelCase) + p = Pattern.compile("(-)(.)"); + m = p.matcher(word); + while (m.find()) { + word = m.replaceFirst(m.group(2).toUpperCase(Locale.ROOT)); + m = p.matcher(word); + } + + if (lowercaseFirstLetter && word.length() > 0) { + int i = 0; + char charAt = word.charAt(i); + while (i + 1 < word.length() && !((charAt >= 'a' && charAt <= 'z') || (charAt >= 'A' && charAt <= 'Z'))) { + i = i + 1; + charAt = word.charAt(i); + } + i = i + 1; + word = word.substring(0, i).toLowerCase(Locale.ROOT) + word.substring(i); + } + + // remove all underscore + word = word.replaceAll("_", ""); + + return word; + } + + /** + * Return the name with escaped characters. + * + * @param name the name to be escaped + * @param replacementMap map of replacement characters for non-allowed characters + * @param charactersToAllow characters that are not escaped + * @param appendToReplacement String to append to replaced characters. + * @return the escaped word + *

+ * throws Runtime exception as word is not escaped properly. + */ + public static String escape(String name, Map replacementMap, + List charactersToAllow, String appendToReplacement) { + String result = name.chars().mapToObj(c -> { + String character = "" + (char) c; + if (charactersToAllow != null && charactersToAllow.contains(character)) { + return character; + } else if (replacementMap.containsKey(character)) { + return replacementMap.get(character) + (appendToReplacement != null ? appendToReplacement: ""); + } else { + return character; + } + }).reduce( (c1, c2) -> "" + c1 + c2).orElse(null); + + if (result != null) return result; + throw new RuntimeException("Word '" + name + "' could not be escaped."); + } +} diff --git a/modules/openapi-generator/src/main/resources/Ada/server-skeleton-body.mustache b/modules/openapi-generator/src/main/resources/Ada/server-skeleton-body.mustache index b14dd242d5d..cabae11a17a 100644 --- a/modules/openapi-generator/src/main/resources/Ada/server-skeleton-body.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/server-skeleton-body.mustache @@ -13,7 +13,7 @@ package body {{package}}.Skeletons is package API_{{operationId}} is new Swagger.Servers.Operation (Handler => {{operationId}}, Method => Swagger.Servers.{{httpMethod}}, - URI => "{{path}}"); + URI => URI_Prefix & "{{path}}"); -- {{summary}} procedure {{operationId}} @@ -32,7 +32,7 @@ package body {{package}}.Skeletons is Result : {{returnType}}; {{/returnType}} begin - {{#authMethods}} + {{#vendorExtensions.x-auth-scopes}} if not Context.Is_Authenticated then Context.Set_Error (401, "Not authenticated"); return; @@ -43,7 +43,7 @@ package body {{package}}.Skeletons is return; end if; {{/scopes}} - {{/authMethods}} + {{/vendorExtensions.x-auth-scopes}} {{#queryParams}} Swagger.Servers.Get_Query_Parameter (Req, "{{baseName}}", {{paramName}}); {{/queryParams}} @@ -128,7 +128,7 @@ package body {{package}}.Skeletons is Result : {{returnType}}; {{/returnType}} begin - {{#authMethods}} + {{#vendorExtensions.x-auth-scopes}} if not Context.Is_Authenticated then Context.Set_Error (401, "Not authenticated"); return; @@ -139,7 +139,7 @@ package body {{package}}.Skeletons is return; end if; {{/scopes}} - {{/authMethods}} + {{/vendorExtensions.x-auth-scopes}} {{#queryParams}} Swagger.Servers.Get_Query_Parameter (Req, "{{baseName}}", {{paramName}}); {{/queryParams}} @@ -185,7 +185,7 @@ package body {{package}}.Skeletons is package API_{{operationId}} is new Swagger.Servers.Operation (Handler => {{operationId}}, Method => Swagger.Servers.{{httpMethod}}, - URI => "{{path}}"); + URI => URI_Prefix & "{{path}}"); {{/operation}} {{/operations}} {{/apis}} diff --git a/modules/openapi-generator/src/main/resources/Ada/server-skeleton-spec.mustache b/modules/openapi-generator/src/main/resources/Ada/server-skeleton-spec.mustache index e14600dff7b..dcab9651d93 100644 --- a/modules/openapi-generator/src/main/resources/Ada/server-skeleton-spec.mustache +++ b/modules/openapi-generator/src/main/resources/Ada/server-skeleton-spec.mustache @@ -32,6 +32,7 @@ package {{package}}.Skeletons is generic type Implementation_Type is limited new Server_Type with private; + URI_Prefix : String := ""; package Skeleton is procedure Register (Server : in out Swagger.Servers.Application_Type'Class); @@ -56,6 +57,7 @@ package {{package}}.Skeletons is generic type Implementation_Type is limited new Server_Type with private; + URI_Prefix : String := ""; package Shared_Instance is procedure Register (Server : in out Swagger.Servers.Application_Type'Class); diff --git a/modules/openapi-generator/src/main/resources/Java/JSON.mustache b/modules/openapi-generator/src/main/resources/Java/JSON.mustache index ae8de32fafc..724b428392b 100644 --- a/modules/openapi-generator/src/main/resources/Java/JSON.mustache +++ b/modules/openapi-generator/src/main/resources/Java/JSON.mustache @@ -61,20 +61,24 @@ public class JSON { public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() - {{#models}}{{#model}}{{#discriminator}} .registerTypeSelector({{classname}}.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap(); - {{#mappedModels}} - classByDiscriminatorValue.put("{{mappingName}}".toUpperCase(Locale.ROOT), {{modelName}}.class); - {{/mappedModels}} - classByDiscriminatorValue.put("{{classname}}".toUpperCase(Locale.ROOT), {{classname}}.class); - return getClassByDiscriminator( - classByDiscriminatorValue, - getDiscriminatorValue(readElement, "{{{propertyName}}}")); - } + {{#models}} + {{#model}} + {{#discriminator}} + .registerTypeSelector({{classname}}.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + {{#mappedModels}} + classByDiscriminatorValue.put("{{mappingName}}".toUpperCase(Locale.ROOT), {{modelName}}.class); + {{/mappedModels}} + classByDiscriminatorValue.put("{{classname}}".toUpperCase(Locale.ROOT), {{classname}}.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "{{{propertyName}}}")); + } }) - {{/discriminator}}{{/model}}{{/models}} + {{/discriminator}} + {{/model}} + {{/models}} ; GsonBuilder builder = fireBuilder.createGsonBuilder(); {{#disableHtmlEscaping}} @@ -85,7 +89,7 @@ public class JSON { private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { JsonElement element = readElement.getAsJsonObject().get(discriminatorField); - if(null == element) { + if (null == element) { throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); } return element.getAsString(); @@ -93,7 +97,7 @@ public class JSON { private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase(Locale.ROOT)); - if(null == clazz) { + if (null == clazz) { throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); } return clazz; @@ -172,9 +176,11 @@ public class JSON { } catch (JsonParseException e) { // Fallback processing when failed to parse JSON form response body: // return the response body string directly for the String return type; - if (returnType.equals(String.class)) + if (returnType.equals(String.class)) { return (T) body; - else throw (e); + } else { + throw (e); + } } } @@ -408,8 +414,7 @@ public class JSON { private DateFormat dateFormat; - public SqlDateTypeAdapter() { - } + public SqlDateTypeAdapter() {} public SqlDateTypeAdapter(DateFormat dateFormat) { this.dateFormat = dateFormat; @@ -462,8 +467,7 @@ public class JSON { private DateFormat dateFormat; - public DateTypeAdapter() { - } + public DateTypeAdapter() {} public DateTypeAdapter(DateFormat dateFormat) { this.dateFormat = dateFormat; diff --git a/modules/openapi-generator/src/main/resources/Java/Pair.mustache b/modules/openapi-generator/src/main/resources/Java/Pair.mustache index c08f145a482..ff9e06b20d4 100644 --- a/modules/openapi-generator/src/main/resources/Java/Pair.mustache +++ b/modules/openapi-generator/src/main/resources/Java/Pair.mustache @@ -13,13 +13,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -33,8 +37,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/modules/openapi-generator/src/main/resources/Java/StringUtil.mustache b/modules/openapi-generator/src/main/resources/Java/StringUtil.mustache index 7b72a7bab45..ce52c82384d 100644 --- a/modules/openapi-generator/src/main/resources/Java/StringUtil.mustache +++ b/modules/openapi-generator/src/main/resources/Java/StringUtil.mustache @@ -13,8 +13,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -32,7 +36,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/modules/openapi-generator/src/main/resources/Java/api.mustache b/modules/openapi-generator/src/main/resources/Java/api.mustache index 17f8d56ac6e..2b1ecb4ab6b 100644 --- a/modules/openapi-generator/src/main/resources/Java/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/api.mustache @@ -46,7 +46,7 @@ public class {{classname}} { * {{summary}} * {{notes}} {{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/isContainer}}{{/required}} {{/allParams}} {{#returnType}} * @return {{returnType}} diff --git a/modules/openapi-generator/src/main/resources/Java/api_doc.mustache b/modules/openapi-generator/src/main/resources/Java/api_doc.mustache index bbb5b66f840..7ddb1953403 100644 --- a/modules/openapi-generator/src/main/resources/Java/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/Java/api_doc.mustache @@ -62,7 +62,7 @@ try { {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} -{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{#isFile}}**{{dataType}}**{{/isFile}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} |{{^required}} [optional]{{/required}}{{^isContainer}}{{#defaultValue}} [default to {{defaultValue}}]{{/defaultValue}}{{/isContainer}}{{#allowableValues}} [enum: {{#values}}{{{.}}}{{^-last}}, {{/-last}}{{/values}}]{{/allowableValues}} {{/allParams}} ### Return type diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache index dea8a6e8aef..b446223ba53 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/api.mustache @@ -25,7 +25,7 @@ public interface {{classname}} extends ApiClient.Api { * {{summary}} * {{notes}} {{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} {{/allParams}} {{#returnType}} * @return {{returnType}} @@ -55,14 +55,14 @@ public interface {{classname}} extends ApiClient.Api { * building up this map in a fluent style. {{#allParams}} {{^isQueryParam}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}} {{/isQueryParam}} {{/allParams}} * @param queryParams Map of query parameters as name-value pairs *

The following elements may be specified in the query map:

*
    {{#queryParams}} - *
  • {{paramName}} - {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}
  • + *
  • {{paramName}} - {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}
  • {{/queryParams}} *
{{#returnType}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OAuth.mustache index 1df88d403a2..0ed92dbcae9 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OAuth.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/auth/OAuth.mustache @@ -19,6 +19,9 @@ import org.apache.oltu.oauth2.common.message.types.GrantType; import org.apache.oltu.oauth2.common.token.BasicOAuthToken; import feign.Client; +{{#useFeign10}} +import feign.Request.HttpMethod; +{{/useFeign10}} import feign.Request.Options; import feign.RequestInterceptor; import feign.RequestTemplate; @@ -92,7 +95,12 @@ public class OAuth implements RequestInterceptor { try { accessTokenResponse = oauthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); } catch (Exception e) { + {{#useFeign10}} + throw new RetryableException(e.getMessage(), HttpMethod.POST, e, null); + {{/useFeign10}} + {{^useFeign10}} throw new RetryableException(e.getMessage(), e,null); + {{/useFeign10}} } if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn()); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache index 32254e52506..b852a3d43af 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.gradle.mustache @@ -118,12 +118,12 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.9" + swagger_annotations_version = "1.5.21" jackson_version = "2.8.7" {{#threetenbp}} threepane_version = "2.6.4" {{/threetenbp}} - feign_version = "9.4.0" + feign_version = "{{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}}" feign_form_version = "2.1.0" junit_version = "4.12" oltu_version = "1.0.1" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache index d745ef7e86d..f5c8355a02b 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/build.sbt.mustache @@ -9,10 +9,10 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.9" % "compile", - "io.github.openfeign" % "feign-core" % "9.4.0" % "compile", - "io.github.openfeign" % "feign-jackson" % "9.4.0" % "compile", - "io.github.openfeign" % "feign-slf4j" % "9.4.0" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", + "io.github.openfeign" % "feign-core" % "{{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}}" % "compile", + "io.github.openfeign" % "feign-jackson" % "{{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}}" % "compile", + "io.github.openfeign" % "feign-slf4j" % "{{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}}" % "compile", "io.github.openfeign.form" % "feign-form" % "2.1.0" % "compile", "com.fasterxml.jackson.core" % "jackson-core" % "2.8.7" % "compile", "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.7" % "compile", diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache index a616e68bcff..32f01e5bb12 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/feign/pom.mustache @@ -13,6 +13,13 @@ {{scmDeveloperConnection}} {{scmUrl}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} @@ -114,8 +121,7 @@ - - src/main/java + src/main/java @@ -127,8 +133,7 @@ - - src/test/java + src/test/java @@ -191,7 +196,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} @@ -294,12 +299,12 @@ {{#supportJava6}}1.6{{/supportJava6}}{{^supportJava6}}{{#java8}}1.8{{/java8}}{{^java8}}1.7{{/java8}}{{/supportJava6}} ${java.version} ${java.version} - 1.5.18 - 9.4.0 + 1.5.21 + {{#useFeign10}}10.0.1{{/useFeign10}}{{^useFeign10}}9.4.0{{/useFeign10}} 2.1.0 2.8.9 {{#threetenbp}} - 2.6.4 + 2.6.4 {{/threetenbp}} 4.12 1.0.0 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache index 1a2b2afc6cd..acbe24a53f6 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.gradle.mustache @@ -118,7 +118,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" jackson_version = "2.8.9" google_api_client_version = "1.23.0" jersey_common_version = "2.25.1" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.sbt.mustache index d6b88c91d96..9f1aeaf1570 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/build.sbt.mustache @@ -9,7 +9,7 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.17", + "io.swagger" % "swagger-annotations" % "1.5.21", "com.google.api-client" % "google-api-client" % "1.23.0", "org.glassfish.jersey.core" % "jersey-common" % "2.25.1", "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9" % "compile", diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache index 2fff29a15b5..7ff969e9c6c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/google-api-client/pom.mustache @@ -13,6 +13,13 @@ {{scmDeveloperConnection}} {{scmUrl}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} @@ -114,8 +121,7 @@ - - src/main/java + src/main/java @@ -127,8 +133,7 @@ - - src/test/java + src/test/java @@ -287,15 +292,15 @@ UTF-8 - 1.5.17 + 1.5.21 1.23.0 2.25.1 2.8.9 {{#joda}} - 2.9.9 + 2.9.9 {{/joda}} {{#threetenbp}} - 2.6.4 + 2.6.4 {{/threetenbp}} 1.0.0 4.12 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache index 8f7c03adefa..2a4a56b935c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.gradle.mustache @@ -117,7 +117,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.20" + swagger_annotations_version = "1.5.21" jackson_version = "2.9.6" {{#supportJava6}} jersey_version = "2.6" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache index 54902da7989..cc2e9480b6a 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/build.sbt.mustache @@ -9,7 +9,7 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.20", + "io.swagger" % "swagger-annotations" % "1.5.21", "org.glassfish.jersey.core" % "jersey-client" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}}, "org.glassfish.jersey.media" % "jersey-media-multipart" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}}, "org.glassfish.jersey.media" % "jersey-media-json-jackson" % {{#supportJava6}}"2.6"{{/supportJava6}}{{^supportJava6}}"2.25.1"{{/supportJava6}}, diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache index 5c273fa147b..57db33547c4 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/jersey2/pom.mustache @@ -13,6 +13,13 @@ {{scmDeveloperConnection}} {{scmUrl}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} @@ -114,8 +121,7 @@ - - src/main/java + src/main/java @@ -127,8 +133,7 @@ - - src/test/java + src/test/java @@ -212,7 +217,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} @@ -318,7 +323,7 @@ UTF-8 - 1.5.20 + 1.5.21 {{^supportJava6}} 2.27 {{/supportJava6}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache index 5af1e2285f9..9775e5b323d 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/ApiClient.mustache @@ -19,6 +19,9 @@ import org.threeten.bp.OffsetDateTime; import org.threeten.bp.format.DateTimeFormatter; {{/threetenbp}} +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + import javax.net.ssl.*; import java.io.File; import java.io.IOException; @@ -50,6 +53,8 @@ import {{invokerPackage}}.auth.Authentication; import {{invokerPackage}}.auth.HttpBasicAuth; import {{invokerPackage}}.auth.ApiKeyAuth; import {{invokerPackage}}.auth.OAuth; +import {{invokerPackage}}.auth.RetryingOAuth; +import {{invokerPackage}}.auth.OAuthFlow; public class ApiClient { @@ -78,6 +83,38 @@ public class ApiClient { * Constructor for ApiClient */ public ApiClient() { + init(); + + // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}} + authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} + authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + {{#authMethods}}{{#isOAuth}} + /* + * Constructor for ApiClient to support access token retry on 401/403 + */ + public ApiClient( + String clientId, + String clientSecret, + Map parameters + ) { + init(); + + RetryingOAuth retryingOAuth = new RetryingOAuth("{{tokenUrl}}", clientId, OAuthFlow.{{flow}}, clientSecret, parameters); + authentications.put( + "{{name}}", + retryingOAuth + ); + httpClient.interceptors().add(retryingOAuth); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + {{/isOAuth}}{{/authMethods}} + private void init() { httpClient = new OkHttpClient(); {{#useGzipFeature}} @@ -92,13 +129,7 @@ public class ApiClient { // Set default User-Agent. setUserAgent("{{#httpUserAgent}}{{{.}}}{{/httpUserAgent}}{{^httpUserAgent}}OpenAPI-Generator/{{{artifactVersion}}}/java{{/httpUserAgent}}"); - // Setup authentications (key: authentication name, value: authentication). - authentications = new HashMap();{{#authMethods}}{{#isBasic}} - authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}} - authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} - authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); + authentications = new HashMap(); } /** @@ -502,6 +533,20 @@ public class ApiClient { return this; } + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + /** * Format the given parameter object into string. * @@ -517,7 +562,7 @@ public class ApiClient { return jsonStr.substring(1, jsonStr.length() - 1); } else if (param instanceof Collection) { StringBuilder b = new StringBuilder(); - for (Object o : (Collection)param) { + for (Object o : (Collection) param) { if (b.length() > 0) { b.append(","); } @@ -542,7 +587,9 @@ public class ApiClient { List params = new ArrayList(); // preconditions - if (name == null || name.isEmpty() || value == null || value instanceof Collection) return params; + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } params.add(new Pair(name, parameterToString(value))); return params; @@ -587,7 +634,7 @@ public class ApiClient { delimiter = escapeString("|"); } - StringBuilder sb = new StringBuilder() ; + StringBuilder sb = new StringBuilder(); for (Object item : value) { sb.append(delimiter); sb.append(escapeString(parameterToString(item))); @@ -657,7 +704,7 @@ public class ApiClient { */ public String selectHeaderContentType(String[] contentTypes) { if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { - return "application/json"; + return "application/json"; } for (String contentType : contentTypes) { if (isJsonMime(contentType)) { @@ -981,7 +1028,7 @@ public class ApiClient { * @param formParams The form parameters * @param authNames The authentications to apply * @param progressRequestListener Progress request listener - * @return The HTTP request + * @return The HTTP request * @throws ApiException If fail to serialize the request body object */ public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { @@ -1098,13 +1145,15 @@ public class ApiClient { * Update query and header parameters based on authentication settings. * * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters + * @param queryParams List of query parameters + * @param headerParams Map of header parameters */ public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { for (String authName : authNames) { Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } auth.applyToParams(queryParams, headerParams); } } @@ -1116,7 +1165,7 @@ public class ApiClient { * @return RequestBody */ public RequestBody buildRequestBodyFormEncoding(Map formParams) { - FormEncodingBuilder formBuilder = new FormEncodingBuilder(); + FormEncodingBuilder formBuilder = new FormEncodingBuilder(); for (Entry param : formParams.entrySet()) { formBuilder.add(param.getKey(), parameterToString(param.getValue())); } @@ -1179,10 +1228,12 @@ public class ApiClient { public X509Certificate[] getAcceptedIssuers() { return null; } }; SSLContext sslContext = SSLContext.getInstance("TLS"); - trustManagers = new TrustManager[]{ trustAll }; + trustManagers = new TrustManager[] {trustAll}; hostnameVerifier = new HostnameVerifier() { @Override - public boolean verify(String hostname, SSLSession session) { return true; } + public boolean verify(String hostname, SSLSession session) { + return true; + } }; } else if (sslCaCert != null) { char[] password = null; // Any password will work. diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/GzipRequestInterceptor.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/GzipRequestInterceptor.mustache index 23224cf5d5b..61a5b7b0ba2 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/GzipRequestInterceptor.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/GzipRequestInterceptor.mustache @@ -16,7 +16,8 @@ import java.io.IOException; * Taken from https://github.com/square/okhttp/issues/350 */ class GzipRequestInterceptor implements Interceptor { - @Override public Response intercept(Chain chain) throws IOException { + @Override + public Response intercept(Chain chain) throws IOException { Request originalRequest = chain.request(); if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { return chain.proceed(originalRequest); @@ -52,19 +53,22 @@ class GzipRequestInterceptor implements Interceptor { private RequestBody gzip(final RequestBody body) { return new RequestBody() { - @Override public MediaType contentType() { + @Override + public MediaType contentType() { return body.contentType(); } - @Override public long contentLength() { + @Override + public long contentLength() { return -1; // We don't know the compressed length in advance! } - @Override public void writeTo(BufferedSink sink) throws IOException { + @Override + public void writeTo(BufferedSink sink) throws IOException { BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); body.writeTo(gzipSink); gzipSink.close(); } }; } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache index 5f599b117d8..affaec014b9 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/api.mustache @@ -65,7 +65,7 @@ public class {{classname}} { {{#operation}} /** * Build call for {{operationId}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{/allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute @@ -89,23 +89,34 @@ public class {{classname}} { .replaceAll("\\{" + "{{baseName}}" + "\\}", {{localVariablePrefix}}apiClient.escapeString({{{paramName}}}.toString())){{/pathParams}}; {{javaUtilPrefix}}List {{localVariablePrefix}}localVarQueryParams = new {{javaUtilPrefix}}ArrayList(); - {{javaUtilPrefix}}List {{localVariablePrefix}}localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList();{{#queryParams}} - if ({{paramName}} != null) - {{localVariablePrefix}}{{#collectionFormat}}localVarCollectionQueryParams.addAll({{localVariablePrefix}}apiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll({{localVariablePrefix}}apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}}));{{/queryParams}} + {{javaUtilPrefix}}List {{localVariablePrefix}}localVarCollectionQueryParams = new {{javaUtilPrefix}}ArrayList(); + {{#queryParams}} + if ({{paramName}} != null) { + {{localVariablePrefix}}{{#collectionFormat}}localVarCollectionQueryParams.addAll({{localVariablePrefix}}apiClient.parameterToPairs("{{{collectionFormat}}}", {{/collectionFormat}}{{^collectionFormat}}localVarQueryParams.addAll({{localVariablePrefix}}apiClient.parameterToPair({{/collectionFormat}}"{{baseName}}", {{paramName}})); + } - {{javaUtilPrefix}}Map {{localVariablePrefix}}localVarHeaderParams = new {{javaUtilPrefix}}HashMap();{{#headerParams}} - if ({{paramName}} != null) - {{localVariablePrefix}}localVarHeaderParams.put("{{baseName}}", {{localVariablePrefix}}apiClient.parameterToString({{paramName}}));{{/headerParams}} + {{/queryParams}} + {{javaUtilPrefix}}Map {{localVariablePrefix}}localVarHeaderParams = new {{javaUtilPrefix}}HashMap(); + {{#headerParams}} + if ({{paramName}} != null) { + {{localVariablePrefix}}localVarHeaderParams.put("{{baseName}}", {{localVariablePrefix}}apiClient.parameterToString({{paramName}})); + } - {{javaUtilPrefix}}Map {{localVariablePrefix}}localVarFormParams = new {{javaUtilPrefix}}HashMap();{{#formParams}} - if ({{paramName}} != null) - {{localVariablePrefix}}localVarFormParams.put("{{baseName}}", {{paramName}});{{/formParams}} + {{/headerParams}} + {{javaUtilPrefix}}Map {{localVariablePrefix}}localVarFormParams = new {{javaUtilPrefix}}HashMap(); + {{#formParams}} + if ({{paramName}} != null) { + {{localVariablePrefix}}localVarFormParams.put("{{baseName}}", {{paramName}}); + } + {{/formParams}} final String[] {{localVariablePrefix}}localVarAccepts = { {{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}} }; final String {{localVariablePrefix}}localVarAccept = {{localVariablePrefix}}apiClient.selectHeaderAccept({{localVariablePrefix}}localVarAccepts); - if ({{localVariablePrefix}}localVarAccept != null) {{localVariablePrefix}}localVarHeaderParams.put("Accept", {{localVariablePrefix}}localVarAccept); + if ({{localVariablePrefix}}localVarAccept != null) { + {{localVariablePrefix}}localVarHeaderParams.put("Accept", {{localVariablePrefix}}localVarAccept); + } final String[] {{localVariablePrefix}}localVarContentTypes = { {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} @@ -113,7 +124,7 @@ public class {{classname}} { final String {{localVariablePrefix}}localVarContentType = {{localVariablePrefix}}apiClient.selectHeaderContentType({{localVariablePrefix}}localVarContentTypes); {{localVariablePrefix}}localVarHeaderParams.put("Content-Type", {{localVariablePrefix}}localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -177,7 +188,7 @@ public class {{classname}} { /** * {{summary}} * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{/allParams}}{{#returnType}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}}{{#returnType}} * @return {{returnType}}{{/returnType}} * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body {{#isDeprecated}} @@ -199,7 +210,7 @@ public class {{classname}} { /** * {{summary}} * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{/allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} * @return ApiResponse<{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body {{#isDeprecated}} @@ -222,7 +233,7 @@ public class {{classname}} { /** * {{summary}} (asynchronously) * {{notes}}{{#allParams}} - * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}}{{/allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{^isContainer}}{{#defaultValue}}, default to {{.}}{{/defaultValue}}{{/isContainer}}){{/required}}{{/allParams}} * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -265,4 +276,4 @@ public class {{classname}} { } {{/operation}} } -{{/operations}} \ No newline at end of file +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache new file mode 100644 index 00000000000..6886c2fc358 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/OAuthOkHttpClient.mustache @@ -0,0 +1,68 @@ +package {{invokerPackage}}.auth; + +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.MediaType; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.RequestBody; +import com.squareup.okhttp.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(mediaType, request.getBody()) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache new file mode 100644 index 00000000000..4703c2488d0 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/auth/RetryingOAuth.mustache @@ -0,0 +1,165 @@ +package {{invokerPackage}}.auth; + +import com.squareup.okhttp.Interceptor; +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.Map; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (String paramName : parameters.keySet()) { + tokenRequestBuilder.setParameter(paramName, parameters.get(paramName)); + } + } + } + + public void setFlow(OAuthFlow flow) { + switch(flow) { + case accessCode: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case implicit: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case password: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case application: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.urlString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (String headerName : headers.keySet()) { + requestBuilder.addHeader(headerName, headers.get(headerName)); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /* + * Returns true if the access token has been updated + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + return !getAccessToken().equals(requestAccessToken); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + + return false; + } + + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache index 69621c1a6bd..6bb7a2f5636 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/build.gradle.mustache @@ -123,6 +123,7 @@ dependencies { compile 'com.squareup.okhttp:logging-interceptor:2.7.5' compile 'com.google.code.gson:gson:2.8.1' compile 'io.gsonfire:gson-fire:1.8.0' + compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1' {{#joda}} compile 'joda-time:joda-time:2.9.9' {{/joda}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache index 0b0903d617b..0cff2363ea3 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pom.mustache @@ -13,6 +13,13 @@ {{scmDeveloperConnection}} {{scmUrl}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} @@ -213,6 +220,11 @@ gson-fire ${gson-fire-version} + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.1 + {{#joda}} joda-time diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache index 54b90483f4c..87608f21024 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.gradle.mustache @@ -94,7 +94,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.15" + swagger_annotations_version = "1.5.21" rest_assured_version = "3.1.0" junit_version = "4.12" gson_version = "2.6.1" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.sbt.mustache index 68f3eff08d0..7a666ebace6 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/build.sbt.mustache @@ -9,7 +9,7 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.15", + "io.swagger" % "swagger-annotations" % "1.5.21", "io.rest-assured" % "scala-support" % "3.1.0", "com.google.code.gson" % "gson" % "2.6.1", "io.gsonfire" % "gson-fire" % "1.8.2" % "compile", diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/pom.mustache index 1d0c1711389..64285da8111 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/rest-assured/pom.mustache @@ -13,6 +13,13 @@ {{scmDeveloperConnection}} {{scmUrl}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} @@ -113,8 +120,7 @@ - - src/main/java + src/main/java @@ -126,8 +132,7 @@ - - src/test/java + src/test/java @@ -199,7 +204,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} io.rest-assured @@ -245,7 +250,7 @@ UTF-8 - 1.5.15 + 1.5.21 3.1.0 2.6.1 1.8.2 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache index f2f7fa53a40..2950d3e748e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resteasy/pom.mustache @@ -11,6 +11,13 @@ scm:git:git@github.com:openapitools/openapi-generator.git https://openapi-generator.tech +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} @@ -95,8 +102,7 @@ - - src/main/java + src/main/java @@ -108,8 +114,7 @@ - - src/test/java + src/test/java @@ -155,7 +160,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} @@ -259,7 +264,7 @@ UTF-8 - 1.5.18 + 1.5.21 3.1.3.Final 2.8.6 2.6.4 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache index 9925cc43daf..b50203a337a 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/build.gradle.mustache @@ -118,7 +118,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" jackson_version = "2.8.9" spring_web_version = "4.3.9.RELEASE" jodatime_version = "2.9.9" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache index 0d371de6ea1..95b3f7cb5d0 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/resttemplate/pom.mustache @@ -13,6 +13,13 @@ {{scmDeveloperConnection}} {{scmUrl}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} @@ -114,8 +121,7 @@ - - src/main/java + src/main/java @@ -127,8 +133,7 @@ - - src/test/java + src/test/java @@ -290,7 +295,7 @@ UTF-8 - 1.5.17 + 1.5.21 4.3.9.RELEASE 2.8.9 {{#joda}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache index f0c1cbe4c88..45da8dd03bb 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.gradle.mustache @@ -109,7 +109,7 @@ ext { okhttp_version = "2.7.5" oltu_version = "1.0.1" retrofit_version = "1.9.0" - swagger_annotations_version = "1.5.8" + swagger_annotations_version = "1.5.21" junit_version = "4.12" jodatime_version = "2.9.3" {{#threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.sbt.mustache index ffa308d528a..9d5df5e223c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/build.sbt.mustache @@ -11,7 +11,7 @@ lazy val root = (project in file(".")). libraryDependencies ++= Seq( "com.squareup.okhttp" % "okhttp" % "2.7.5" % "compile", "com.squareup.retrofit" % "retrofit" % "1.9.0" % "compile", - "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "joda-time" % "joda-time" % "2.9.3" % "compile", {{#threetenbp}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/pom.mustache index adbd6e99e50..c2a5eeced6f 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit/pom.mustache @@ -13,6 +13,13 @@ {{scmDeveloperConnection}} {{scmUrl}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} @@ -114,8 +121,7 @@ - - src/main/java + src/main/java @@ -127,8 +133,7 @@ - - src/test/java + src/test/java @@ -212,7 +217,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} com.squareup.retrofit @@ -241,17 +246,15 @@ ${threetenbp-version} {{/threetenbp}} - {{#parcelableModel}} - - - com.google.android - android - 4.1.1.4 - provided - + + + com.google.android + android + 4.1.1.4 + provided + {{/parcelableModel}} - junit @@ -262,7 +265,7 @@ UTF-8 - 1.5.18 + 1.5.21 1.9.0 2.7.5 2.9.9 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache index 858b88971b2..dfd1f6d9405 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.gradle.mustache @@ -129,8 +129,12 @@ ext { jackson_version = "2.7.8" play_version = "2.5.14" {{/play25}} + {{#play26}} + jackson_version = "2.8.10" + play_version = "2.6.7" + {{/play26}} {{/usePlayWS}} - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" junit_version = "4.12" {{#useRxJava}} rx_java_version = "1.3.0" @@ -171,7 +175,13 @@ dependencies { compile "org.threeten:threetenbp:$threetenbp_version" {{/threetenbp}} {{#usePlayWS}} + {{#play26}} + compile "com.typesafe.play:play-ahc-ws_2.12:$play_version" + compile "javax.validation:validation-api:1.1.0.Final" + {{/play26}} + {{^play26}} compile "com.typesafe.play:play-java-ws_2.11:$play_version" + {{/play26}} compile "com.squareup.retrofit2:converter-jackson:$retrofit_version" compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache index 66635daa973..e66ca784036 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/build.sbt.mustache @@ -27,6 +27,13 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.8" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.8" % "compile", {{/play25}} + {{#play26}} + "com.typesafe.play" % "play-ahc-ws_2.12" % "2.6.7" % "compile", + "javax.validation" % "validation-api" % "1.1.0.Final" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.10" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.10" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.10" % "compile", + {{/play26}} "com.squareup.retrofit2" % "converter-jackson" % "2.3.0" % "compile", {{/usePlayWS}} {{#useRxJava}} @@ -37,7 +44,7 @@ lazy val root = (project in file(".")). "com.squareup.retrofit2" % "adapter-rxjava2" % "2.3.0" % "compile", "io.reactivex.rxjava2" % "rxjava" % "2.1.1" % "compile", {{/useRxJava2}} - "io.swagger" % "swagger-annotations" % "1.5.17" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", {{#joda}} "joda-time" % "joda-time" % "2.9.9" % "compile", diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/formParams.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/formParams.mustache index af65a37bc36..0456f44947e 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/formParams.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/formParams.mustache @@ -1 +1 @@ -{{#isFormParam}}{{^isFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}}("{{baseName}}") MultipartBody.Part {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file +{{#isFormParam}}{{^isFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field{{/isMultipart}}("{{baseName}}") {{{dataType}}} {{paramName}}{{/isFile}}{{#isFile}}{{#isMultipart}}@retrofit2.http.Part{{/isMultipart}}{{^isMultipart}}@retrofit2.http.Field("{{baseName}}"){{/isMultipart}} MultipartBody.Part {{paramName}}{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play26/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play26/ApiClient.mustache new file mode 100644 index 00000000000..d59912773c8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play26/ApiClient.mustache @@ -0,0 +1,205 @@ +package {{invokerPackage}}; + +import java.io.File; +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.*; + +import com.fasterxml.jackson.databind.ObjectMapper; +import retrofit2.Converter; +import retrofit2.Retrofit; +import retrofit2.converter.scalars.ScalarsConverterFactory; +import retrofit2.converter.jackson.JacksonConverterFactory; + +import play.libs.Json; +import play.libs.ws.WSClient; + +import {{invokerPackage}}.Play26CallAdapterFactory; +import {{invokerPackage}}.Play26CallFactory; + +import okhttp3.Interceptor; +import okhttp3.ResponseBody; +import {{invokerPackage}}.auth.ApiKeyAuth; +import {{invokerPackage}}.auth.Authentication; + +/** + * API client + */ +public class ApiClient { + + /** Underlying HTTP-client */ + private WSClient wsClient; + + /** Creates HTTP call instances */ + private Play26CallFactory callFactory; + + /** Create {@link java.util.concurrent.CompletionStage} instances from HTTP calls */ + private Play26CallAdapterFactory callAdapterFactory; + + /** Supported auths */ + private Map authentications; + + /** API base path */ + private String basePath = "{{{basePath}}}"; + + /** Default ObjectMapper */ + private ObjectMapper defaultMapper; + + public ApiClient(WSClient wsClient) { + this(); + this.wsClient = wsClient; + } + + public ApiClient() { + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap<>();{{#authMethods}}{{#isBasic}} + // authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}} + authentications.put("{{name}}", new ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}"));{{/isApiKey}}{{#isOAuth}} + // authentications.put("{{name}}", new OAuth());{{/isOAuth}}{{/authMethods}} + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Creates a retrofit2 client for given API interface + */ + public S createService(Class serviceClass) { + if(!basePath.endsWith("/")) { + basePath = basePath + "/"; + } + + Map extraHeaders = new HashMap<>(); + List extraQueryParams = new ArrayList<>(); + + for (String authName : authentications.keySet()) { + Authentication auth = authentications.get(authName); + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + + auth.applyToParams(extraQueryParams, extraHeaders); + } + + if (callFactory == null) { + callFactory = new Play26CallFactory(wsClient, extraHeaders, extraQueryParams); + } + if (callAdapterFactory == null) { + callAdapterFactory = new Play26CallAdapterFactory(); + } + if (defaultMapper == null) { + defaultMapper = Json.mapper(); + } + + return new Retrofit.Builder() + .baseUrl(basePath) + .addConverterFactory(new FileConverter()) + .addConverterFactory(ScalarsConverterFactory.create()) + .addConverterFactory(JacksonConverterFactory.create(defaultMapper)) + .callFactory(callFactory) + .addCallAdapterFactory(callAdapterFactory) + .build() + .create(serviceClass); + } + + /** + * Helper method to set API base path + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set API key value for the first API key authentication. + */ + public ApiClient setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return this; + } + } + + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + */ + public ApiClient setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return this; + } + } + + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set HTTP call instances factory + */ + public ApiClient setCallFactory(Play26CallFactory callFactory) { + this.callFactory = callFactory; + return this; + } + + /** + * Helper method to set {@link java.util.concurrent.CompletionStage} instances factory + */ + public ApiClient setCallAdapterFactory(Play26CallAdapterFactory callAdapterFactory) { + this.callAdapterFactory = callAdapterFactory; + return this; + } + + /** + * Helper method to set Jackson's {@link ObjectMapper} + */ + public ApiClient setObjectMapper(ObjectMapper mapper) { + this.defaultMapper = mapper; + return this; + } + + static class FileConverter extends Converter.Factory { + + @Override + public Converter responseBodyConverter(Type type, + Annotation[] annotations, Retrofit retrofit) { + + if (!File.class.getTypeName().equals(type.getTypeName())) { + return null; + } + + return new Converter() { + + @Override + public File convert(ResponseBody value) throws IOException { + + File file = File.createTempFile("retrofit-file", ".tmp"); + Files.write(Paths.get(file.getPath()), value.bytes()); + return file; + } + }; + } + } + +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play26/Play26CallAdapterFactory.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play26/Play26CallAdapterFactory.mustache new file mode 100644 index 00000000000..efbc0ac298b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play26/Play26CallAdapterFactory.mustache @@ -0,0 +1,116 @@ +package {{invokerPackage}}; + +import java.util.concurrent.CompletionStage; +import retrofit2.*; + +import java.lang.annotation.Annotation; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.lang.reflect.WildcardType; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import java.util.function.Function; + +/** + * Creates {@link CallAdapter} instances that convert {@link Call} into {@link java.util.concurrent.CompletionStage} + */ +public class Play26CallAdapterFactory extends CallAdapter.Factory { + + private Function exceptionConverter = Function.identity(); + + public Play26CallAdapterFactory() { + } + + public Play26CallAdapterFactory( + Function exceptionConverter) { + this.exceptionConverter = exceptionConverter; + } + + @Override + public CallAdapter get(Type returnType, Annotation[] annotations, Retrofit retrofit) { + if (!(returnType instanceof ParameterizedType)) { + return null; + } + + ParameterizedType type = (ParameterizedType) returnType; + if (type.getRawType() != CompletionStage.class) { + return null; + } + + return createAdapter((ParameterizedType) returnType); + } + + private CallAdapter> createAdapter(ParameterizedType returnType) { + // Get CompletionStage type argument + Type[] types = returnType.getActualTypeArguments(); + if (types.length != 1) { + throw new IllegalStateException("Must be exactly one type parameter"); + } + + Type resultType = types[0]; + Class rawTypeParam = getRawType(resultType); + + boolean includeResponse = false; + if (rawTypeParam == Response.class) { + if (!(resultType instanceof ParameterizedType)) { + throw new IllegalStateException("Response must be parameterized" + + " as Response"); + } + resultType = ((ParameterizedType) resultType).getActualTypeArguments()[0]; + includeResponse = true; + } + + return new ValueAdapter(resultType, includeResponse, exceptionConverter); + } + + /** + * Adpater that coverts values returned by API interface into CompletionStage + */ + private static final class ValueAdapter implements CallAdapter> { + + private final Type responseType; + private final boolean includeResponse; + private Function exceptionConverter; + + ValueAdapter(Type responseType, boolean includeResponse, + Function exceptionConverter) { + this.responseType = responseType; + this.includeResponse = includeResponse; + this.exceptionConverter = exceptionConverter; + } + + @Override + public Type responseType() { + return responseType; + } + + @Override + public CompletionStage adapt(final Call call) { + final CompletableFuture promise = new CompletableFuture(); + + call.enqueue(new Callback() { + + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccessful()) { + if (includeResponse) { + promise.complete((R) response); + } else { + promise.complete(response.body()); + } + } else { + promise.completeExceptionally(exceptionConverter.apply(new HttpException(response))); + } + } + + @Override + public void onFailure(Call call, Throwable t) { + promise.completeExceptionally(t); + } + + }); + + return promise; + } + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play26/Play26CallFactory.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play26/Play26CallFactory.mustache new file mode 100644 index 00000000000..6e4180341bf --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play26/Play26CallFactory.mustache @@ -0,0 +1,245 @@ +package {{invokerPackage}}; + +import okhttp3.*; +import okio.Buffer; +import okio.BufferedSource; +import play.libs.ws.WSClient; +import play.libs.ws.WSRequest; +import play.libs.ws.WSResponse; +import play.libs.ws.WSRequestFilter; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.Executor; + +/** + * Creates {@link Call} instances that invoke underlying {@link WSClient} + */ +public class Play26CallFactory implements okhttp3.Call.Factory { + + /** PlayWS http client */ + private final WSClient wsClient; + + /** Extra headers to add to request */ + private Map extraHeaders = new HashMap<>(); + + /** Extra query parameters to add to request */ + private List extraQueryParams = new ArrayList<>(); + + /** Filters (interceptors) */ + private List filters = new ArrayList<>(); + + /** Executor for WSClient */ + private Executor executor; + + public Play26CallFactory(WSClient wsClient) { + this.wsClient = wsClient; + } + + public Play26CallFactory(WSClient wsClient, List filters) { + this.wsClient = wsClient; + this.filters.addAll(filters); + } + + public Play26CallFactory(WSClient wsClient, Map extraHeaders, + List extraQueryParams) { + this.wsClient = wsClient; + + this.extraHeaders.putAll(extraHeaders); + this.extraQueryParams.addAll(extraQueryParams); + } + + public Play26CallFactory withExecutor(Executor executor) { + this.executor = executor; + return this; + } + + @Override + public Call newCall(Request request) { + // add extra headers + Request.Builder rb = request.newBuilder(); + for (Map.Entry header : this.extraHeaders.entrySet()) { + rb.addHeader(header.getKey(), header.getValue()); + } + + // add extra query params + if (!this.extraQueryParams.isEmpty()) { + String newQuery = request.url().uri().getQuery(); + for (Pair queryParam : this.extraQueryParams) { + String param = String.format("%s=%s", queryParam.getName(), queryParam.getValue()); + if (newQuery == null) { + newQuery = param; + } else { + newQuery += "&" + param; + } + } + + URI newUri; + try { + newUri = new URI(request.url().uri().getScheme(), request.url().uri().getAuthority(), + request.url().uri().getPath(), newQuery, request.url().uri().getFragment()); + rb.url(newUri.toURL()); + } catch (MalformedURLException | URISyntaxException e) { + throw new RuntimeException("Error while updating an url", e); + } + } + + return new PlayWSCall(wsClient, this.executor, this.filters, rb.build()); + } + + /** + * Call implementation that delegates to Play WS Client + */ + static class PlayWSCall implements Call { + + private final WSClient wsClient; + private WSRequest wsRequest; + private List filters; + private Executor executor = java.util.concurrent.ForkJoinPool.commonPool(); + + private final Request request; + + public PlayWSCall(WSClient wsClient, Executor executor, List filters, Request request) { + this.wsClient = wsClient; + this.request = request; + this.filters = filters; + + if (executor != null) { + this.executor = executor; + } + } + + @Override + public Request request() { + return request; + } + + @Override + public void enqueue(final okhttp3.Callback responseCallback) { + final Call call = this; + final CompletionStage promise = executeAsync(); + + promise.whenCompleteAsync((v, t) -> { + if (t != null) { + if (t instanceof IOException) { + responseCallback.onFailure(call, (IOException) t); + } else { + responseCallback.onFailure(call, new IOException(t)); + } + } else { + try { + responseCallback.onResponse(call, PlayWSCall.this.toWSResponse(v)); + } catch (Exception e) { + responseCallback.onFailure(call, new IOException(e)); + } + } + }, this.executor); + } + + CompletionStage executeAsync() { + try { + HttpUrl url = request.url(); + wsRequest = wsClient.url(url.scheme()+ "://" + url.host() + ":" + url.port() + url.encodedPath()); + url.queryParameterNames().forEach(queryParam -> { + wsRequest.addQueryParameter(queryParam, url.queryParameter(queryParam)); + }); + addHeaders(wsRequest); + if (request.body() != null) { + addBody(wsRequest); + } + filters.stream().forEach(f -> wsRequest.setRequestFilter(f)); + + return wsRequest.execute(request.method()); + } catch (Exception e) { + throw new RuntimeException(e.getMessage(), e); + } + } + + private void addHeaders(WSRequest wsRequest) { + for(Map.Entry> entry : request.headers().toMultimap().entrySet()) { + List values = entry.getValue(); + for (String value : values) { + wsRequest.setHeader(entry.getKey(), value); + } + } + } + + private void addBody(WSRequest wsRequest) throws IOException { + MediaType mediaType = request.body().contentType(); + if (mediaType != null) { + wsRequest.setContentType(mediaType.toString()); + } + + Buffer buffer = new Buffer(); + request.body().writeTo(buffer); + wsRequest.setBody(buffer.inputStream()); + } + + private Response toWSResponse(final WSResponse r) { + final Response.Builder builder = new Response.Builder(); + builder.request(request) + .code(r.getStatus()) + .body(new ResponseBody() { + + @Override + public MediaType contentType() { + return r.getSingleHeader("Content-Type") + .map(MediaType::parse) + .orElse(null); + } + + @Override + public long contentLength() { + return r.asByteArray().length; + } + + @Override + public BufferedSource source() { + return new Buffer().write(r.asByteArray()); + } + }); + + for (Map.Entry> entry : r.getAllHeaders().entrySet()) { + for (String value : entry.getValue()) { + builder.addHeader(entry.getKey(), value); + } + } + + builder.message(r.getStatusText()); + builder.protocol(Protocol.HTTP_1_1); + return builder.build(); + } + + @Override + public Response execute() throws IOException { + throw new UnsupportedOperationException("Not supported"); + } + + @Override + public void cancel() { + throw new UnsupportedOperationException("Not supported"); + } + + @Override + public PlayWSCall clone() { + throw new UnsupportedOperationException("Not supported"); + } + + @Override + public boolean isExecuted() { + return false; + } + + @Override + public boolean isCanceled() { + return false; + } + } +} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play26/api.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play26/api.mustache new file mode 100644 index 00000000000..b435a16c051 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/play26/api.mustache @@ -0,0 +1,59 @@ +package {{package}}; + +import {{invokerPackage}}.CollectionFormats.*; + +{{#useRxJava}}import rx.Observable;{{/useRxJava}} +{{#useRxJava2}}import io.reactivex.Observable;{{/useRxJava2}} +{{#doNotUseRx}}import retrofit2.Call;{{/doNotUseRx}} +import retrofit2.http.*; + +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import okhttp3.MultipartBody; + +{{#imports}}import {{import}}; +{{/imports}} + +{{^fullJavaUtil}} +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +{{/fullJavaUtil}} + +import java.util.concurrent.*; +import retrofit2.Response; + +{{#operations}} +public interface {{classname}} { + {{#operation}} + /** + * {{summary}} + * {{notes}} +{{#allParams}} + * @param {{paramName}} {{description}}{{#required}} (required){{/required}}{{^required}} (optional{{#defaultValue}}, default to {{.}}{{/defaultValue}}){{/required}} +{{/allParams}} + * @return Call<{{#returnType}}{{returnType}}{{/returnType}}{{^returnType}}Void{{/returnType}}> + */ + {{#formParams}} + {{#-first}} + {{#isMultipart}}@retrofit2.http.Multipart{{/isMultipart}}{{^isMultipart}}@retrofit2.http.FormUrlEncoded{{/isMultipart}} + {{/-first}} + {{/formParams}} + {{^formParams}} + {{#prioritizedContentTypes}} + {{#-first}} + @Headers({ + "Content-Type:{{{mediaType}}}" + }) + {{/-first}} + {{/prioritizedContentTypes}} + {{/formParams}} + @{{httpMethod}}("{{{path}}}") + CompletionStage> {{operationId}}({{^allParams}});{{/allParams}} + {{#allParams}}{{>libraries/retrofit2/queryParams}}{{>libraries/retrofit2/pathParams}}{{>libraries/retrofit2/headerParams}}{{>libraries/retrofit2/bodyParams}}{{>libraries/retrofit2/formParams}}{{#hasMore}}, {{/hasMore}}{{^hasMore}} + );{{/hasMore}}{{/allParams}} + + {{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache index f23642e46bb..29347aee8e6 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/retrofit2/pom.mustache @@ -13,6 +13,13 @@ {{scmDeveloperConnection}} {{scmUrl}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} @@ -114,8 +121,7 @@ - - src/main/java + src/main/java @@ -127,8 +133,7 @@ - - src/test/java + src/test/java @@ -191,7 +196,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} com.squareup.retrofit2 @@ -262,7 +267,6 @@ ${retrofit-version} {{/useRxJava2}} - {{#usePlayWS}} @@ -291,22 +295,40 @@ ${jackson-version} {{#withXml}} - com.fasterxml.jackson.dataformat jackson-dataformat-xml ${jackson-version} - {{/withXml}} + {{#play24}} com.typesafe.play play-java-ws_2.11 ${play-version} + {{/play24}} + {{#play25}} + + com.typesafe.play + play-java-ws_2.11 + ${play-version} + + {{/play25}} + {{#play26}} + + com.typesafe.play + play-ahc-ws_2.12 + ${play-version} + + + javax.validation + validation-api + 1.1.0.Final + + {{/play26}} {{/usePlayWS}} - {{#parcelableModel}} @@ -316,7 +338,6 @@ provided {{/parcelableModel}} - junit @@ -331,29 +352,33 @@ ${java.version} ${java.version} 1.8.0 - 1.5.18 + 1.5.21 {{#usePlayWS}} - {{#play24}} - 2.6.6 - 2.4.11 - {{/play24}} - {{#play25}} - 2.7.8 - 2.5.15 - {{/play25}} + {{#play24}} + 2.6.6 + 2.4.11 + {{/play24}} + {{#play25}} + 2.7.8 + 2.5.15 + {{/play25}} + {{#play26}} + 2.8.10 + 2.6.7 + {{/play26}} {{/usePlayWS}} 2.3.0 {{#useRxJava}} - 1.3.0 + 1.3.0 {{/useRxJava}} {{#useRxJava2}} - 2.1.1 + 2.1.1 {{/useRxJava2}} {{#joda}} - 2.9.9 + 2.9.9 {{/joda}} {{#threetenbp}} - 1.3.5 + 1.3.5 {{/threetenbp}} 1.0.1 4.12 diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache index e1c956d5f72..1f2ebac4399 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/build.gradle.mustache @@ -26,7 +26,7 @@ task execute(type:JavaExec) { } ext { - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" jackson_version = "{{^threetenbp}}2.8.9{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}}" vertx_version = "3.4.2" junit_version = "4.12" diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache index 32f94b62639..46687cd0c7c 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/vertx/pom.mustache @@ -13,6 +13,13 @@ {{scmDeveloperConnection}} {{scmUrl}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} @@ -114,8 +121,7 @@ - - src/main/java + src/main/java @@ -127,8 +133,7 @@ - - src/test/java + src/test/java @@ -200,7 +205,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} @@ -271,7 +276,7 @@ UTF-8 3.4.2 - 1.5.18 + 1.5.21 {{^threetenbp}}2.8.9{{/threetenbp}}{{#threetenbp}}2.6.4{{/threetenbp}} 4.12 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 28260368a9b..7f91fe44134 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 @@ -33,6 +33,7 @@ import org.springframework.web.reactive.function.BodyInserters; import org.springframework.web.reactive.function.client.ExchangeStrategies; import reactor.core.publisher.Mono; import reactor.core.publisher.Flux; +import java.util.Optional; import java.io.BufferedReader; import java.io.IOException; @@ -76,7 +77,7 @@ public class ApiClient { } private HttpHeaders defaultHeaders = new HttpHeaders(); - + private String basePath = "{{basePath}}"; private final WebClient webClient; @@ -87,16 +88,22 @@ public class ApiClient { public ApiClient() { this.dateFormat = createDefaultDateFormat(); - this.webClient = buildWebClient(new ObjectMapper(), this.dateFormat); + this.webClient = buildWebClient(new ObjectMapper(), dateFormat); + this.init(); } public ApiClient(ObjectMapper mapper, DateFormat format) { this(buildWebClient(mapper.copy(), format), format); } + public ApiClient(WebClient webClient, ObjectMapper mapper, DateFormat format) { + this(Optional.ofNullable(webClient).orElseGet(() ->buildWebClient(mapper.copy(), format)), format); + } + private ApiClient(WebClient webClient, DateFormat format) { this.webClient = webClient; this.dateFormat = format; + this.init(); } public DateFormat createDefaultDateFormat() { @@ -104,7 +111,7 @@ public class ApiClient { dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return dateFormat; } - + protected void init() { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap();{{#authMethods}}{{#isBasic}} @@ -132,7 +139,7 @@ public class ApiClient { return webClient.build(); } - + /** * Get the current base path * @return String the base path @@ -538,7 +545,7 @@ public class ApiClient { builder.queryParams(queryParams); } - final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(builder.build().toUri()); + final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(builder.build(true).toUri()); if(accept != null) { requestBuilder.accept(accept.toArray(new MediaType[accept.size()])); } @@ -585,7 +592,7 @@ public class ApiClient { auth.applyToParams(queryParams, headerParams); } } - + private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor { private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class); @@ -624,7 +631,7 @@ public class ApiClient { builder.setLength(builder.length() - 1); // Get rid of trailing comma return builder.toString(); } - + private String bodyToString(InputStream body) throws IOException { StringBuilder builder = new StringBuilder(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8)); diff --git a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache index 4771a9bb658..7fde2317697 100644 --- a/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/libraries/webclient/pom.mustache @@ -13,6 +13,13 @@ {{scmDeveloperConnection}} {{scmUrl}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} diff --git a/modules/openapi-generator/src/main/resources/Java/pojo.mustache b/modules/openapi-generator/src/main/resources/Java/pojo.mustache index 21c21b1ddd3..2d08f65d6ac 100644 --- a/modules/openapi-generator/src/main/resources/Java/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pojo.mustache @@ -62,7 +62,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{{#parcela private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} {{^isContainer}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/Java/pom.mustache b/modules/openapi-generator/src/main/resources/Java/pom.mustache index 0c1501e115c..a2703f141d0 100644 --- a/modules/openapi-generator/src/main/resources/Java/pom.mustache +++ b/modules/openapi-generator/src/main/resources/Java/pom.mustache @@ -13,6 +13,13 @@ {{scmDeveloperConnection}} {{scmUrl}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} @@ -114,8 +121,7 @@ - - src/main/java + src/main/java @@ -127,8 +133,7 @@ - - src/test/java + src/test/java @@ -327,7 +332,7 @@ UTF-8 - 1.5.17 + 1.5.21 1.19.4 {{#supportJava6}} 2.5 diff --git a/modules/openapi-generator/src/main/resources/JavaInflector/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaInflector/pojo.mustache index a9aa18e6dc9..badfdbc35a3 100644 --- a/modules/openapi-generator/src/main/resources/JavaInflector/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaInflector/pojo.mustache @@ -22,7 +22,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} {{^isContainer}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/README.mustache index dcf00bfdcf4..98a0fd82419 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/README.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/README.mustache @@ -1,11 +1,12 @@ -# Swagger Jersey generated server +# JAX-RS/Jersey server with OpenAPI ## 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 JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. +Jersey is used as JAX-RS implementation, `io.swagger:swagger-jersey2-jaxrs` is used to derive the OpenAPI Specification from the annotated code. To run the server, please execute the following: @@ -13,10 +14,10 @@ To run the server, please execute the following: mvn clean package jetty:run ``` -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:{{serverPort}}{{contextPath}}/openapi.json +http://localhost:{{serverPort}}{{contextPath}}/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/api.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/api.mustache index e9d909539f8..e7ac940a512 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/api.mustache @@ -26,6 +26,7 @@ import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; {{#useBeanValidation}} import javax.validation.constraints.*; +import javax.validation.Valid; {{/useBeanValidation}} {{#commonPath}}@Path("/{{{commonPath}}}"){{/commonPath}}{{^commonPath}}@Path(""){{/commonPath}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/bodyParams.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/bodyParams.mustache index 2b28441d3d0..3856b7189ce 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/bodyParams.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/bodyParams.mustache @@ -1 +1 @@ -{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{{dataType}}} {{paramName}}{{/isBodyParam}} \ No newline at end of file +{{#isBodyParam}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, {{> allowableValues }}{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{#useBeanValidation}}@Valid {{/useBeanValidation}}{{{dataType}}} {{paramName}}{{/isBodyParam}} \ 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 3bb3087a1a2..9a79494fbf8 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 @@ -15,7 +15,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} {{^isContainer}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}}{{/vars}} {{#vars}} 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 7daa0a4fbe9..c6d73b3dbe8 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/cxf/pojo.mustache @@ -40,7 +40,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} { private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} {{^isContainer}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{/vars}} {{#vars}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey1/api.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey1/api.mustache index 386ebe68321..8c12ad4c682 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey1/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/libraries/jersey1/api.mustache @@ -7,11 +7,6 @@ import {{package}}.factories.{{classname}}ServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -{{#useBeanValidation}} -import javax.validation.constraints.*; -{{/useBeanValidation}} - {{#imports}}import {{import}}; {{/imports}} @@ -28,6 +23,10 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +{{#useBeanValidation}} +import javax.validation.constraints.*; +import javax.validation.Valid; +{{/useBeanValidation}} @Path("/{{{baseName}}}") {{#hasConsumes}}@Consumes({ {{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}} }){{/hasConsumes}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/model.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/model.mustache index 1d4785dda12..fce25592536 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/model.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/model.mustache @@ -15,6 +15,7 @@ import java.io.Serializable; {{/serializableModel}} {{#useBeanValidation}} import javax.validation.constraints.*; +import javax.validation.Valid; {{/useBeanValidation}} {{#models}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/pojo.mustache index 4839b81da83..519ea86e311 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/pojo.mustache @@ -25,7 +25,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} {{^isContainer}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{/vars}} @@ -83,7 +83,8 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali @JsonProperty("{{baseName}}") {{/jackson}} @ApiModelProperty({{#example}}example = "{{{example}}}", {{/example}}{{#required}}required = {{required}}, {{/required}}value = "{{{description}}}") -{{#useBeanValidation}}{{>beanValidation}}{{/useBeanValidation}} public {{{datatypeWithEnum}}} {{getter}}() { + {{#useBeanValidation}}{{>beanValidation}}{{^isPrimitiveType}}{{^isDate}}{{^isDateTime}}{{^isString}}{{^isFile}}@Valid{{/isFile}}{{/isString}}{{/isDateTime}}{{/isDate}}{{/isPrimitiveType}}{{/useBeanValidation}} + public {{{datatypeWithEnum}}} {{getter}}() { return {{name}}; } {{^isReadOnly}} diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/README.mustache index 45f4438e36a..647f45ff5a3 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/README.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/README.mustache @@ -1,22 +1,23 @@ -# OpenAPI generated server +# JAX-RS/RESTEasy server with OpenAPI ## 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 JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. +RESTEasy is used as JAX-RS implementation library and is defined as dependency. To run the server, please execute the following: ``` -mvn clean package jetty:run +mvn -Djetty.http.port={{serverPort}} package org.eclipse.jetty:jetty-maven-plugin:run ``` -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:{{serverPort}}{{contextPath}}/openapi.json +http://localhost:{{serverPort}}{{contextPath}}/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/README.mustache index 5e1dce9b0a8..ed1aa06a3cc 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/README.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/eap/README.mustache @@ -1,18 +1,18 @@ -# OpenAPI generated server +# JAX-RS/Resteasy server with OpenAPI for Jboss EAP ## 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 JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework for Jboss Resteasy. You can deploy the WAR file to Jboss EAP or any other JEE server supporting Jboss Resteasy. -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:{{serverPort}}{{contextPath}}/openapi.json +http://localhost:{{serverPort}}{{contextPath}}/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through 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 f495de66748..0a2d19435bc 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 @@ -12,7 +12,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali {{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}};{{/vars}} {{#vars}} /** 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 084e8b502c0..5fb981e140d 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/resteasy/pojo.mustache @@ -11,7 +11,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} {{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{defaultValue}}}{{/defaultValue}};{{/vars}} {{#vars}} /** diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/README.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/README.mustache new file mode 100644 index 00000000000..93c1ccb7811 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/README.mustache @@ -0,0 +1,33 @@ +# JAX-RS server with OpenAPI + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. + +This is an example of building a OpenAPI-enabled JAX-RS server. +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. + +{{#interfaceOnly}} +This project produces a jar that defines some interfaces. +The jar can be used in combination with an other project providing the implementation. +{{/interfaceOnly}} + +{{^interfaceOnly}} +The JAX-RS implementation needs to be provided by the application server you are deploying on. + +To run the server from the command line, you can use maven to provision an start a TomEE Server. +Please execute the following: + +``` +mvn -Dtomee-embedded-plugin.http={{serverPort}} package org.apache.tomee.maven:tomee-embedded-maven-plugin:7.0.5:run +``` + +You can then call your server endpoints under: + +``` +http://localhost:{{serverPort}}{{contextPath}}/ +``` + +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! +{{/interfaceOnly}} 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 ec8264cf8f3..264ff89006a 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pojo.mustache @@ -17,7 +17,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali {{>enumClass}}{{/isContainer}}{{#isContainer}}{{#mostInnerItems}} {{>enumClass}}{{/mostInnerItems}}{{/isContainer}}{{/isEnum}} - private {{#useBeanValidation}}@Valid{{/useBeanValidation}} {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}};{{/vars}} + private {{#useBeanValidation}}@Valid{{/useBeanValidation}} {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}};{{/vars}} {{#vars}} /** diff --git a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache index c12b6a719e0..5d2110b5f6e 100644 --- a/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaJaxRS/spec/pom.mustache @@ -7,7 +7,26 @@ {{artifactVersion}} src/main/java - {{#interfaceOnly}} + + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + {{#interfaceOnly}} org.apache.maven.plugins maven-jar-plugin @@ -39,9 +58,28 @@ javax.ws.rs javax.ws.rs-api - 2.0 + 2.1.1 provided + {{#java8}} + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + {{/java8}} + {{^java8}} + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + + {{/java8}} + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson-version} + {{#useSwaggerAnnotations}} io.swagger @@ -87,6 +125,7 @@ {{/useBeanValidation}} + 2.8.9 4.8.1 diff --git a/modules/openapi-generator/src/main/resources/JavaPlayFramework/pojo.mustache b/modules/openapi-generator/src/main/resources/JavaPlayFramework/pojo.mustache index 1ac8120d767..164bbcea5d9 100644 --- a/modules/openapi-generator/src/main/resources/JavaPlayFramework/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaPlayFramework/pojo.mustache @@ -29,7 +29,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} {{^isContainer}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache index 66121f30584..08bebd3a975 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/api.mustache @@ -9,6 +9,10 @@ package {{package}}; {{/imports}} import io.swagger.annotations.*; {{#jdk8-no-delegate}} +{{#virtualService}} +import io.virtualan.annotation.ApiVirtual; +import io.virtualan.annotation.VirtualService; +{{/virtualService}} import org.springframework.http.HttpStatus; import org.springframework.http.MediaType; {{/jdk8-no-delegate}} @@ -58,6 +62,9 @@ import java.util.concurrent.{{^jdk8}}Callable{{/jdk8}}{{#jdk8}}CompletableFuture {{/useBeanValidation}} @Api(value = "{{{baseName}}}", description = "the {{{baseName}}} API") {{#operations}} +{{#virtualService}} +@VirtualService +{{/virtualService}} public interface {{classname}} { {{#jdk8}} {{^isDelegate}} @@ -77,6 +84,9 @@ public interface {{classname}} { {{/jdk8}} {{#operation}} + {{#virtualService}} + @ApiVirtual + {{/virtualService}} @ApiOperation(value = "{{{summary}}}", nickname = "{{{operationId}}}", notes = "{{{notes}}}"{{#returnBaseType}}, response = {{{returnBaseType}}}.class{{/returnBaseType}}{{#returnContainer}}, responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, authorizations = { {{#authMethods}}@Authorization(value = "{{name}}"{{#isOAuth}}, scopes = { {{#scopes}}@AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}}, @@ -111,7 +121,7 @@ public interface {{classname}} { {{>methodBody}} {{/isDelegate}} {{#isDelegate}} - return getDelegate().{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#reactive}}, exchange{{/reactive}}); + return getDelegate().{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}{{#reactive}}{{#hasParams}}, {{/hasParams}}exchange{{/reactive}}); {{/isDelegate}} }{{/jdk8}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/apiController.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/apiController.mustache index 4c9e6271d59..5052f367a27 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/apiController.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/apiController.mustache @@ -69,6 +69,8 @@ public class {{classname}}Controller implements {{classname}} { {{^isDelegate}} {{^reactive}} + {{^jdk8}} + {{/jdk8}} private final NativeWebRequest request; @org.springframework.beans.factory.annotation.Autowired diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/apiDelegate.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/apiDelegate.mustache index 45f31bd4e14..76bc71fbb33 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/apiDelegate.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/apiDelegate.mustache @@ -12,6 +12,11 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.context.request.NativeWebRequest; {{/jdk8}} import org.springframework.web.multipart.MultipartFile; +{{#reactive}} +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; +{{/reactive}} import java.util.List; import java.util.Map; @@ -45,9 +50,9 @@ public interface {{classname}}Delegate { /** * @see {{classname}}#{{operationId}} */ - {{#jdk8}}default {{/jdk8}}{{#responseWrapper}}{{.}}<{{/responseWrapper}}ResponseEntity<{{>returnTypes}}>{{#responseWrapper}}>{{/responseWrapper}} {{operationId}}({{#allParams}}{{^isFile}} {{>optionalDataType}} {{/isFile}}{{#isFile}}MultipartFile{{/isFile}} {{paramName}}{{#hasMore}}, - {{/hasMore}}{{^hasMore}}{{#reactive}}, - {{/reactive}}{{/hasMore}}{{/allParams}}{{#reactive}}ServerWebExchange exchange{{/reactive}}){{^jdk8}};{{/jdk8}}{{#jdk8}} { + {{#jdk8}}default {{/jdk8}}{{#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}}, + {{/hasMore}}{{/allParams}}{{#reactive}}{{#hasParams}}, + {{/hasParams}}ServerWebExchange exchange{{/reactive}}){{^jdk8}};{{/jdk8}}{{#jdk8}} { {{>methodBody}} }{{/jdk8}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/apiUtil.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/apiUtil.mustache index c6255465d69..67816edd971 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/apiUtil.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/apiUtil.mustache @@ -16,8 +16,10 @@ public class ApiUtil { {{^reactive}} public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { try { - req.getNativeResponse(HttpServletResponse.class).addHeader("Content-Type", contentType); - req.getNativeResponse(HttpServletResponse.class).getOutputStream().print(example); + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/README.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/README.mustache index f824f03035f..fdc844423d6 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/README.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/README.mustache @@ -47,3 +47,14 @@ public interface PetClient extends PetApi { } ``` {{/interfaceOnly}} +{{#virtualService}} + + +## Virtualan : + +You can view Virtualan UI by pointing to +http://localhost:80//virtualan-ui.html. + +How to use guide available in the Virtualan wiki +https://github.com/elan-venture/virtualan/wiki +{{/virtualService}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/application.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/application.mustache index 1193554dd22..b7fea3f6262 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/application.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/application.mustache @@ -3,4 +3,10 @@ springfox.documentation.swagger.v2.path=/api-docs {{/useSpringfox}} server.port={{serverPort}} spring.jackson.date-format={{basePackage}}.RFC3339DateFormat -spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false +{{#virtualService}} +virtual.datasource.driver-class-name=org.hsqldb.jdbcDriver +virtual.datasource.jdbcurl=jdbc:hsqldb:mem:dataSource +virtual.datasource.username=sa +virtual.datasource.password= +{{/virtualService}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache index 2d35c75cd1b..555896e60e3 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-boot/pom.mustache @@ -13,11 +13,20 @@ 2.8.0 {{/useSpringfox}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} +{{^parentOverridden}} org.springframework.boot spring-boot-starter-parent {{#java8}}2.0.1.RELEASE{{/java8}}{{^java8}}1.5.12.RELEASE{{/java8}} +{{/parentOverridden}} src/main/java {{^interfaceOnly}} @@ -134,6 +143,26 @@ javax.validation validation-api -{{/useBeanValidation}} +{{/useBeanValidation}} +{{#virtualService}} + + + io.virtualan + virtualan-plugin + 1.0.0 + + + + org.hsqldb + hsqldb + 2.3.2 + + + org.springframework.boot + spring-boot-starter-data-jpa + 1.5.9.RELEASE + + +{{/virtualService}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/apiClient.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/apiClient.mustache index 52fedbea776..2a3e72fb1c4 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/apiClient.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/apiClient.mustache @@ -1,6 +1,6 @@ package {{package}}; -import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.cloud.openfeign.FeignClient; import {{configPackage}}.ClientConfiguration; {{=<% %>=}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache index 9efcee55a51..7001f567571 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-cloud/pom.mustache @@ -11,11 +11,20 @@ ${java.version} 1.5.18 +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} +{{^parentOverridden}} org.springframework.boot spring-boot-starter-parent - 1.5.4.RELEASE + 2.0.5.RELEASE +{{/parentOverridden}} src/main/java @@ -25,7 +34,7 @@ org.springframework.cloud spring-cloud-starter-parent - Dalston.SR1 + Finchley.SR1 pom import @@ -40,56 +49,38 @@ org.springframework.cloud - spring-cloud-starter-feign + spring-cloud-starter-openfeign org.springframework.cloud - spring-cloud-security - - - org.springframework.security.oauth - spring-security-oauth2 + spring-cloud-starter-oauth2 {{#withXml}} - com.fasterxml.jackson.dataformat jackson-dataformat-xml - {{/withXml}} {{#java8}} - com.fasterxml.jackson.datatype jackson-datatype-jsr310 {{/java8}} {{#joda}} - com.fasterxml.jackson.datatype jackson-datatype-joda {{/joda}} {{#threetenbp}} - com.github.joschi.jackson jackson-datatype-threetenbp 2.6.4 {{/threetenbp}} -{{#useBeanValidation}} - - - javax.validation - validation-api - 1.1.0.Final - provided - -{{/useBeanValidation}} org.springframework.boot spring-boot-starter-test diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache index 5ebe4d2b5c3..533ccb9a569 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/libraries/spring-mvc/pom.mustache @@ -5,6 +5,13 @@ jar {{artifactId}} {{artifactVersion}} +{{#parentOverridden}} + + {{{parentGroupId}}} + {{{parentArtifactId}}} + {{{parentVersion}}} + +{{/parentOverridden}} src/main/java diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/methodBody.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/methodBody.mustache index 0c2de9868ef..8597a7419ca 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/methodBody.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/methodBody.mustache @@ -29,19 +29,19 @@ return {{#jdk8}}{{#async}}CompletableFuture.completedFuture({{/async}}{{/jdk8}}n {{/examples}} {{/reactive}} {{#reactive}} -{{>returnTypes}} result = {{#isListContainer}}Flux{{/isListContainer}}{{^isListContainer}}Mono{{/isListContainer}}.empty(); +exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); {{#examples}} {{#-first}} for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { {{/-first}} if (mediaType.isCompatibleWith(MediaType.valueOf("{{{contentType}}}"))) { - result = ApiUtil.getExampleResponse(exchange, "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}") - .then{{#isListContainer}}Many{{/isListContainer}}(Mono.empty()); + result = ApiUtil.getExampleResponse(exchange, "{{#lambdaRemoveLineBreak}}{{#lambdaEscapeDoubleQuote}}{{{example}}}{{/lambdaEscapeDoubleQuote}}{{/lambdaRemoveLineBreak}}"); break; } {{#-last}} } {{/-last}} {{/examples}} - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body({{^isListContainer}}{{#allParams}}{{#isBodyParam}}{{paramName}}.then({{/isBodyParam}}{{/allParams}}{{/isListContainer}}{{#isListContainer}}{{#allParams}}{{#isBodyParam}}{{paramName}}.thenMany({{/isBodyParam}}{{/allParams}}{{/isListContainer}}result{{#allParams}}{{#isBodyParam}}){{/isBodyParam}}{{/allParams}}); + return result.then(Mono.empty()); {{/reactive}} \ 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 a7545a77f16..a82f2e40f4c 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache @@ -31,7 +31,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} {{^isContainer}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/JavaSpring/returnTypes.mustache b/modules/openapi-generator/src/main/resources/JavaSpring/returnTypes.mustache index 67d79cc198c..bd6283296da 100644 --- a/modules/openapi-generator/src/main/resources/JavaSpring/returnTypes.mustache +++ b/modules/openapi-generator/src/main/resources/JavaSpring/returnTypes.mustache @@ -1 +1 @@ -{{#isMapContainer}}{{#reactive}}Mono<{{/reactive}}Map{{/reactive}}>{{/isMapContainer}}{{#isListContainer}}{{#reactive}}Flux{{/reactive}}{{^reactive}}List{{/reactive}}<{{{returnType}}}>{{/isListContainer}}{{^returnContainer}}{{#reactive}}Mono<{{{returnType}}}>{{/reactive}}{{^reactive}}{{{returnType}}}{{/reactive}}{{/returnContainer}} \ No newline at end of file +{{#isMapContainer}}Map{{/isMapContainer}}{{#isListContainer}}{{#reactive}}Flux{{/reactive}}{{^reactive}}List{{/reactive}}<{{{returnType}}}>{{/isListContainer}}{{^returnContainer}}{{{returnType}}}{{/returnContainer}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/Javascript/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Javascript/ApiClient.mustache index 4c5a5d60e7f..997e9446f0f 100644 --- a/modules/openapi-generator/src/main/resources/Javascript/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Javascript/ApiClient.mustache @@ -463,7 +463,7 @@ // Attach previously saved cookies, if enabled if (this.enableCookies){ if (typeof window === 'undefined') { - this.agent.attachCookies(request); + this.agent._attachCookies(request); } else { request.withCredentials(); @@ -478,7 +478,7 @@ try { var data = _this.deserialize(response, returnType); if (_this.enableCookies && typeof window === 'undefined'){ - _this.agent.saveCookies(response); + _this.agent._saveCookies(response); } resolve({data: data, response: response}); } catch (err) { @@ -494,7 +494,7 @@ try { data = _this.deserialize(response, returnType); if (_this.enableCookies && typeof window === 'undefined'){ - _this.agent.saveCookies(response); + _this.agent._saveCookies(response); } } catch (err) { error = err; diff --git a/modules/openapi-generator/src/main/resources/Javascript/es6/ApiClient.mustache b/modules/openapi-generator/src/main/resources/Javascript/es6/ApiClient.mustache index 7ba837e183d..f824d552fce 100644 --- a/modules/openapi-generator/src/main/resources/Javascript/es6/ApiClient.mustache +++ b/modules/openapi-generator/src/main/resources/Javascript/es6/ApiClient.mustache @@ -415,7 +415,7 @@ class ApiClient { // Attach previously saved cookies, if enabled if (this.enableCookies){ if (typeof window === 'undefined') { - this.agent.attachCookies(request); + this.agent._attachCookies(request); } else { request.withCredentials(); @@ -430,7 +430,7 @@ class ApiClient { try { var data = this.deserialize(response, returnType); if (this.enableCookies && typeof window === 'undefined'){ - this.agent.saveCookies(response); + this.agent._saveCookies(response); } resolve({data, response}); @@ -448,7 +448,7 @@ class ApiClient { try { data = this.deserialize(response, returnType); if (this.enableCookies && typeof window === 'undefined'){ - this.agent.saveCookies(response); + this.agent._saveCookies(response); } } catch (err) { error = err; diff --git a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig index a5c3d07b08a..1659fc4169c 100644 --- a/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig +++ b/modules/openapi-generator/src/main/resources/META-INF/services/org.openapitools.codegen.CodegenConfig @@ -17,6 +17,7 @@ org.openapitools.codegen.languages.CSharpClientCodegen org.openapitools.codegen.languages.CSharpDotNet2ClientCodegen org.openapitools.codegen.languages.CSharpNancyFXServerCodegen org.openapitools.codegen.languages.DartClientCodegen +org.openapitools.codegen.languages.DartJaguarClientCodegen org.openapitools.codegen.languages.EiffelClientCodegen org.openapitools.codegen.languages.ElixirClientCodegen org.openapitools.codegen.languages.ElmClientCodegen @@ -26,9 +27,11 @@ org.openapitools.codegen.languages.FlashClientCodegen org.openapitools.codegen.languages.FinchServerCodegen org.openapitools.codegen.languages.GoClientCodegen org.openapitools.codegen.languages.GoServerCodegen +org.openapitools.codegen.languages.GoGinServerCodegen org.openapitools.codegen.languages.GroovyClientCodegen org.openapitools.codegen.languages.KotlinClientCodegen org.openapitools.codegen.languages.KotlinServerCodegen +org.openapitools.codegen.languages.KotlinSpringServerCodegen org.openapitools.codegen.languages.HaskellHttpClientCodegen org.openapitools.codegen.languages.HaskellServantCodegen org.openapitools.codegen.languages.JavaClientCodegen @@ -50,6 +53,7 @@ org.openapitools.codegen.languages.JavascriptFlowtypedClientCodegen org.openapitools.codegen.languages.JavascriptClosureAngularClientCodegen org.openapitools.codegen.languages.JMeterClientCodegen org.openapitools.codegen.languages.LuaClientCodegen +org.openapitools.codegen.languages.MysqlSchemaCodegen org.openapitools.codegen.languages.NodeJSServerCodegen org.openapitools.codegen.languages.ObjcClientCodegen org.openapitools.codegen.languages.OpenAPIGenerator @@ -87,7 +91,8 @@ org.openapitools.codegen.languages.Swift4Codegen org.openapitools.codegen.languages.TypeScriptAngularClientCodegen org.openapitools.codegen.languages.TypeScriptAngularJsClientCodegen org.openapitools.codegen.languages.TypeScriptAureliaClientCodegen +org.openapitools.codegen.languages.TypeScriptAxiosClientCodegen org.openapitools.codegen.languages.TypeScriptFetchClientCodegen org.openapitools.codegen.languages.TypeScriptInversifyClientCodegen org.openapitools.codegen.languages.TypeScriptJqueryClientCodegen -org.openapitools.codegen.languages.TypeScriptNodeClientCodegen +org.openapitools.codegen.languages.TypeScriptNodeClientCodegen \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/MSF4J/pojo.mustache b/modules/openapi-generator/src/main/resources/MSF4J/pojo.mustache index 4a9dfb6a7c5..38559db8fb4 100644 --- a/modules/openapi-generator/src/main/resources/MSF4J/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/MSF4J/pojo.mustache @@ -25,7 +25,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} {{^isContainer}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/Dockerfile.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/Dockerfile.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/Dockerfile.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/Dockerfile.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/Filters/BasePathFilter.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/Filters/BasePathFilter.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/Filters/BasePathFilter.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/Filters/BasePathFilter.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/Filters/GeneratePathParamsValidationFilter.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/Filters/GeneratePathParamsValidationFilter.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/Filters/GeneratePathParamsValidationFilter.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/Filters/GeneratePathParamsValidationFilter.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/Program.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/Program.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/Program.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/Program.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/Project.csproj.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/Project.csproj.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/Project.csproj.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/Project.csproj.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/Properties/launchSettings.json b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/Properties/launchSettings.json similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/Properties/launchSettings.json rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/Properties/launchSettings.json diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/README.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/README.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/README.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/README.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/Solution.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/Solution.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/Solution.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/Solution.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/Startup.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/Startup.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/Startup.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/Startup.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/appsettings.json b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/appsettings.json similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/appsettings.json rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/appsettings.json diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/bodyParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/bodyParam.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/bodyParam.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/bodyParam.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/build.bat.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/build.bat.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/build.bat.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/build.bat.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/build.sh.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/build.sh.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/build.sh.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/build.sh.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/controller.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/controller.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/controller.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/controller.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/enumClass.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/enumClass.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/enumClass.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/enumClass.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/formParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/formParam.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/formParam.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/formParam.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/gitignore b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/gitignore similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/gitignore rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/gitignore diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/headerParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/headerParam.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/headerParam.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/headerParam.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/listReturn.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/listReturn.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/listReturn.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/listReturn.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/mapReturn.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/mapReturn.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/mapReturn.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/mapReturn.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/model.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/model.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/model.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/model.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/objectReturn.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/objectReturn.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/objectReturn.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/objectReturn.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/partial_header.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/partial_header.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/partial_header.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/partial_header.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/pathParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/pathParam.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/pathParam.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/pathParam.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/queryParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/queryParam.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/queryParam.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/queryParam.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/tags.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/tags.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/tags.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/tags.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/validateModel.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/validateModel.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/validateModel.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/validateModel.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/web.config b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/web.config similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/web.config rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/web.config diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/wwwroot/README.md b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/wwwroot/README.md similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/wwwroot/README.md rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/wwwroot/README.md diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/wwwroot/index.html b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/wwwroot/index.html similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/wwwroot/index.html rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/wwwroot/index.html diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/wwwroot/openapi-original.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/wwwroot/openapi-original.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/wwwroot/openapi-original.mustache rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/wwwroot/openapi-original.mustache diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/wwwroot/web.config b/modules/openapi-generator/src/main/resources/aspnetcore/2.0/wwwroot/web.config similarity index 100% rename from modules/openapi-generator/src/main/resources/aspnetcore/wwwroot/web.config rename to modules/openapi-generator/src/main/resources/aspnetcore/2.0/wwwroot/web.config diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Dockerfile.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Dockerfile.mustache new file mode 100644 index 00000000000..e9d80c52833 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Dockerfile.mustache @@ -0,0 +1,18 @@ +FROM microsoft/aspnetcore-build:2.0 AS build-env +WORKDIR /app + +ENV DOTNET_CLI_TELEMETRY_OPTOUT 1 + +# copy csproj and restore as distinct layers +COPY *.csproj ./ +RUN dotnet restore + +# copy everything else and build +COPY . ./ +RUN dotnet publish -c Release -o out + +# build runtime image +FROM microsoft/aspnetcore:2.0 +WORKDIR /app +COPY --from=build-env /app/out . +ENTRYPOINT ["dotnet", "{{packageName}}.dll"] diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Filters/BasePathFilter.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Filters/BasePathFilter.mustache new file mode 100644 index 00000000000..a3e1b9ce080 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Filters/BasePathFilter.mustache @@ -0,0 +1,50 @@ +using System.Linq; +using System.Text.RegularExpressions; +using Swashbuckle.AspNetCore.Swagger; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace {{packageName}}.Filters +{ + /// + /// BasePath Document Filter sets BasePath property of Swagger and removes it from the individual URL paths + /// + public class BasePathFilter : IDocumentFilter + { + /// + /// Constructor + /// + /// BasePath to remove from Operations + public BasePathFilter(string basePath) + { + BasePath = basePath; + } + + /// + /// Gets the BasePath of the Swagger Doc + /// + /// The BasePath of the Swagger Doc + public string BasePath { get; } + + /// + /// Apply the filter + /// + /// SwaggerDocument + /// FilterContext + public void Apply(SwaggerDocument swaggerDoc, DocumentFilterContext context) + { + swaggerDoc.BasePath = BasePath; + + var pathsToModify = swaggerDoc.Paths.Where(p => p.Key.StartsWith(BasePath)).ToList(); + + foreach (var path in pathsToModify) + { + if (path.Key.StartsWith(BasePath)) + { + string newKey = Regex.Replace(path.Key, $"^{BasePath}", string.Empty); + swaggerDoc.Paths.Remove(path.Key); + swaggerDoc.Paths.Add(newKey, path.Value); + } + } + } + } +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Filters/GeneratePathParamsValidationFilter.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Filters/GeneratePathParamsValidationFilter.mustache new file mode 100644 index 00000000000..d857a4a0f96 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Filters/GeneratePathParamsValidationFilter.mustache @@ -0,0 +1,97 @@ +using System.ComponentModel.DataAnnotations; +using System.Linq; +using Microsoft.AspNetCore.Mvc.Controllers; +using Swashbuckle.AspNetCore.Swagger; +using Swashbuckle.AspNetCore.SwaggerGen; + +namespace {{packageName}}.Filters +{ + /// + /// Path Parameter Validation Rules Filter + /// + public class GeneratePathParamsValidationFilter : IOperationFilter + { + /// + /// Constructor + /// + /// Operation + /// OperationFilterContext + public void Apply(Operation operation, OperationFilterContext context) + { + var pars = context.ApiDescription.ParameterDescriptions; + + foreach (var par in pars) + { + var swaggerParam = operation.Parameters.SingleOrDefault(p => p.Name == par.Name); + + var attributes = ((ControllerParameterDescriptor)par.ParameterDescriptor).ParameterInfo.CustomAttributes; + + if (attributes != null && attributes.Count() > 0 && swaggerParam != null) + { + // Required - [Required] + var requiredAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RequiredAttribute)); + if (requiredAttr != null) + { + swaggerParam.Required = true; + } + + // Regex Pattern [RegularExpression] + var regexAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RegularExpressionAttribute)); + if (regexAttr != null) + { + string regex = (string)regexAttr.ConstructorArguments[0].Value; + if (swaggerParam is NonBodyParameter) + { + ((NonBodyParameter)swaggerParam).Pattern = regex; + } + } + + // String Length [StringLength] + int? minLenght = null, maxLength = null; + var stringLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(StringLengthAttribute)); + if (stringLengthAttr != null) + { + if (stringLengthAttr.NamedArguments.Count == 1) + { + minLenght = (int)stringLengthAttr.NamedArguments.Single(p => p.MemberName == "MinimumLength").TypedValue.Value; + } + maxLength = (int)stringLengthAttr.ConstructorArguments[0].Value; + } + + var minLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MinLengthAttribute)); + if (minLengthAttr != null) + { + minLenght = (int)minLengthAttr.ConstructorArguments[0].Value; + } + + var maxLengthAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(MaxLengthAttribute)); + if (maxLengthAttr != null) + { + maxLength = (int)maxLengthAttr.ConstructorArguments[0].Value; + } + + if (swaggerParam is NonBodyParameter) + { + ((NonBodyParameter)swaggerParam).MinLength = minLenght; + ((NonBodyParameter)swaggerParam).MaxLength = maxLength; + } + + // Range [Range] + var rangeAttr = attributes.FirstOrDefault(p => p.AttributeType == typeof(RangeAttribute)); + if (rangeAttr != null) + { + int rangeMin = (int)rangeAttr.ConstructorArguments[0].Value; + int rangeMax = (int)rangeAttr.ConstructorArguments[1].Value; + + if (swaggerParam is NonBodyParameter) + { + ((NonBodyParameter)swaggerParam).Minimum = rangeMin; + ((NonBodyParameter)swaggerParam).Maximum = rangeMax; + } + } + } + } + } + } +} + diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Program.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Program.mustache new file mode 100644 index 00000000000..73cb81a3e41 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Program.mustache @@ -0,0 +1,30 @@ +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore; + +namespace {{packageName}} +{ + /// + /// Program + /// + public class Program + { + /// + /// Main + /// + /// + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + /// + /// Create the web host builder. + /// + /// + /// IWebHostBuilder + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup() + .UseUrls("http://0.0.0.0:{{#serverPort}}{{serverPort}}{{/serverPort}}{{^serverPort}}8080{{/serverPort}}/"); + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Project.csproj.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Project.csproj.mustache new file mode 100644 index 00000000000..faa7dbd53b5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Project.csproj.mustache @@ -0,0 +1,21 @@ + + + {{packageName}} + {{packageName}} + netcoreapp2.1 + true + true + {{packageName}} + {{packageName}} + + + +{{#useSwashbuckle}} + + +{{/useSwashbuckle}} + + + + + diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Properties/launchSettings.json b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Properties/launchSettings.json new file mode 100644 index 00000000000..1b527df2c2b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Properties/launchSettings.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:61788", + "sslPort": 44301 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "api/values", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "WebApplication1": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "api/values", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/README.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/README.mustache new file mode 100644 index 00000000000..71c4cfebb8b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/README.mustache @@ -0,0 +1,27 @@ +# {{packageName}} - ASP.NET Core 2.0 Server + +{{#appDescription}} +{{{appDescription}}} +{{/appDescription}} + +## Run + +Linux/OS X: + +``` +sh build.sh +``` + +Windows: + +``` +build.bat +``` + +## Run in Docker + +``` +cd {{sourceFolder}}/{{packageName}} +docker build -t {{dockerTag}} . +docker run -p 5000:5000 {{dockerTag}} +``` diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Solution.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Solution.mustache new file mode 100644 index 00000000000..8c6d69ea93d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Solution.mustache @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2043 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "{{packageName}}", "{{sourceFolder}}\{{packageName}}\{{packageName}}.csproj", "{{packageGuid}}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {{packageGuid}}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {{packageGuid}}.Debug|Any CPU.Build.0 = Debug|Any CPU + {{packageGuid}}.Release|Any CPU.ActiveCfg = Release|Any CPU + {{packageGuid}}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Startup.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Startup.mustache new file mode 100644 index 00000000000..7a488bfcf17 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/Startup.mustache @@ -0,0 +1,120 @@ +{{>partial_header}} +using System; +using System.IO; +using System.Reflection; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Serialization;{{#useSwashbuckle}} +using Swashbuckle.AspNetCore.Swagger; +using Swashbuckle.AspNetCore.SwaggerGen; +using {{packageName}}.Filters;{{/useSwashbuckle}} + +namespace {{packageName}} +{ + /// + /// Startup + /// + public class Startup + { + /// + /// Constructor + /// + /// + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + /// + /// The application configuration. + /// + public IConfiguration Configuration { get; } + + /// + /// This method gets called by the runtime. Use this method to add services to the container. + /// + /// + public void ConfigureServices(IServiceCollection services) + { + // Add framework services. + services + .AddMvc() + .SetCompatibilityVersion (CompatibilityVersion.Version_2_1) + .AddJsonOptions(opts => + { + opts.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); + opts.SerializerSettings.Converters.Add(new StringEnumConverter + { + CamelCaseText = true + }); + });{{#useSwashbuckle}} + + services + .AddSwaggerGen(c => + { + c.SwaggerDoc("{{#version}}{{{version}}}{{/version}}{{^version}}v1{{/version}}", new Info + { + Version = "{{#version}}{{{version}}}{{/version}}{{^version}}v1{{/version}}", + Title = "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}}", + Description = "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}} (ASP.NET Core 2.0)", + Contact = new Contact() + { + Name = "{{#infoName}}{{{infoName}}}{{/infoName}}{{^infoName}}OpenAPI-Generator Contributors{{/infoName}}", + Url = "{{#infoUrl}}{{{infoUrl}}}{{/infoUrl}}{{^infoUrl}}https://github.com/openapitools/openapi-generator{{/infoUrl}}", + Email = "{{#infoEmail}}{{{infoEmail}}}{{/infoEmail}}" + }, + TermsOfService = "{{#termsOfService}}{{{termsOfService}}}{{/termsOfService}}" + }); + c.CustomSchemaIds(type => type.FriendlyId(true)); + c.DescribeAllEnumsAsStrings(); + c.IncludeXmlComments($"{AppContext.BaseDirectory}{Path.DirectorySeparatorChar}{Assembly.GetEntryAssembly().GetName().Name}.xml"); + {{#basePathWithoutHost}} + // Sets the basePath property in the Swagger document generated + c.DocumentFilter("{{{basePathWithoutHost}}}"); + {{/basePathWithoutHost}} + + // Include DataAnnotation attributes on Controller Action parameters as Swagger validation rules (e.g required, pattern, ..) + // Use [ValidateModelState] on Actions to actually validate it in C# as well! + c.OperationFilter(); + });{{/useSwashbuckle}} + } + + /// + /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + /// + /// + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + app.UseHttpsRedirection(); + app + .UseMvc() + .UseDefaultFiles() + .UseStaticFiles(){{#useSwashbuckle}} + .UseSwagger(c => + { + c.RouteTemplate = "swagger/{documentName}/openapi.json"; + }) + .UseSwaggerUI(c => + { + //TODO: Either use the SwaggerGen generated Swagger contract (generated from C# classes) + c.SwaggerEndpoint("/swagger/{{#version}}{{{version}}}{{/version}}{{^version}}v1{{/version}}/openapi.json", "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}}"); + + //TODO: Or alternatively use the original Swagger contract that's included in the static files + // c.SwaggerEndpoint("/openapi-original.json", "{{#appName}}{{{appName}}}{{/appName}}{{^appName}}{{packageName}}{{/appName}} Original"); + }){{/useSwashbuckle}}; + +if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseHsts(); + } + } + } +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/appsettings.Development.json b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/appsettings.Development.json new file mode 100644 index 00000000000..e203e9407e7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/appsettings.json b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/appsettings.json new file mode 100644 index 00000000000..def9159a7d9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/appsettings.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/bodyParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/bodyParam.mustache new file mode 100644 index 00000000000..02b0fa1d2de --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/bodyParam.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}[FromBody]{{&dataType}} {{paramName}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/build.bat.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/build.bat.mustache new file mode 100644 index 00000000000..e437bccf7d6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/build.bat.mustache @@ -0,0 +1,9 @@ +:: Generated by: https://openapi-generator.tech +:: + +@echo off + +dotnet restore {{sourceFolder}}\{{packageName}} +dotnet build {{sourceFolder}}\{{packageName}} +echo Now, run the following to start the project: dotnet run -p {{sourceFolder}}\{{packageName}}\{{packageName}}.csproj --launch-profile web. +echo. diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/build.sh.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/build.sh.mustache new file mode 100644 index 00000000000..3804359d7e2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/build.sh.mustache @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# +# Generated by: https://openapi-generator.tech +# + +dotnet restore {{sourceFolder}}/{{packageName}}/ && \ + dotnet build {{sourceFolder}}/{{packageName}}/ && \ + echo "Now, run the following to start the project: dotnet run -p {{sourceFolder}}/{{packageName}}/{{packageName}}.csproj --launch-profile web" diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/controller.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/controller.mustache new file mode 100644 index 00000000000..1805b7d2cc6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/controller.mustache @@ -0,0 +1,55 @@ +{{>partial_header}} +using System; +using System.Collections.Generic; +using Microsoft.AspNetCore.Mvc;{{#useSwashbuckle}} +using Swashbuckle.AspNetCore.Annotations; +using Swashbuckle.AspNetCore.SwaggerGen;{{/useSwashbuckle}} +using Newtonsoft.Json; +using System.ComponentModel.DataAnnotations; +using {{packageName}}.Attributes; +using {{packageName}}.Models; + +namespace {{packageName}}.Controllers +{ {{#operations}} + /// + /// {{description}} + /// {{#description}} + [Description("{{description}}")]{{/description}} + public class {{classname}}Controller : ControllerBase + { {{#operation}} + /// + /// {{#summary}}{{summary}}{{/summary}} + /// {{#notes}} + /// {{notes}}{{/notes}}{{#allParams}} + /// {{description}}{{/allParams}}{{#responses}} + /// {{message}}{{/responses}} + [{{httpMethod}}] + [Route("{{{basePathWithoutHost}}}{{{path}}}")] + [ValidateModelState]{{#useSwashbuckle}} + [SwaggerOperation("{{operationId}}")]{{#responses}}{{#dataType}} + [SwaggerResponse(statusCode: {{code}}, type: typeof({{&dataType}}), description: "{{message}}")]{{/dataType}}{{^dataType}}{{/dataType}}{{/responses}}{{/useSwashbuckle}} + public virtual IActionResult {{operationId}}({{#allParams}}{{>pathParam}}{{>queryParam}}{{>bodyParam}}{{>formParam}}{{>headerParam}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + { {{#responses}} +{{#dataType}} + //TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode({{code}}, default({{&dataType}})); +{{/dataType}} +{{^dataType}} + //TODO: Uncomment the next line to return response {{code}} or use other options such as return this.NotFound(), return this.BadRequest(..), ... + // return StatusCode({{code}}); +{{/dataType}}{{/responses}} +{{#returnType}} + string exampleJson = null; + {{#examples}} + exampleJson = "{{{example}}}"; + {{/examples}} + {{#isListCollection}}{{>listReturn}}{{/isListCollection}}{{^isListCollection}}{{#isMapContainer}}{{>mapReturn}}{{/isMapContainer}}{{^isMapContainer}}{{>objectReturn}}{{/isMapContainer}}{{/isListCollection}} + {{!TODO: defaultResponse, examples, auth, consumes, produces, nickname, externalDocs, imports, security}} + //TODO: Change the data returned + return new ObjectResult(example);{{/returnType}}{{^returnType}} + throw new NotImplementedException();{{/returnType}} + } + {{/operation}} + } +{{/operations}} +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/enumClass.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/enumClass.mustache new file mode 100644 index 00000000000..a8a68b99844 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/enumClass.mustache @@ -0,0 +1,18 @@ + + /// + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{{description}}}{{/description}} + /// + {{#description}} + /// {{{description}}} + {{/description}} + {{#allowableValues}}{{#enumVars}}{{#-first}}{{#isString}}[JsonConverter(typeof(Newtonsoft.Json.Converters.StringEnumConverter))]{{/isString}}{{/-first}}{{/enumVars}}{{/allowableValues}} + public enum {{#datatypeWithEnum}}{{.}}{{/datatypeWithEnum}}{{^datatypeWithEnum}}{{classname}}{{/datatypeWithEnum}} + { + {{#allowableValues}}{{#enumVars}} + /// + /// Enum {{name}} for {{{value}}} + /// + {{#isString}}[EnumMember(Value = "{{{value}}}")]{{/isString}} + {{name}}{{^isString}} = {{{value}}}{{/isString}}{{#isString}} = {{-index}}{{/isString}}{{^-last}}, + {{/-last}}{{/enumVars}}{{/allowableValues}} + } diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/formParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/formParam.mustache new file mode 100644 index 00000000000..2d42dc2916b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/formParam.mustache @@ -0,0 +1 @@ +{{#isFormParam}}[FromForm]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/gitignore b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/gitignore new file mode 100644 index 00000000000..cd9b840e549 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/gitignore @@ -0,0 +1,208 @@ +PID + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.userosscache +*.sln.docstates + +# User-specific files (MonoDevelop/Xamarin Studio) +*.userprefs + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Visual Studio 2015 cache/options directory +.vs/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +# NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +# DNX +project.lock.json +artifacts/ + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding add-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# MightyMoose +*.mm.* +AutoTest.Net/ + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Visual Studio cache files +# files ending in .cache can be ignored +*.[Cc]ache +# but keep track of directories ending in .cache +!*.[Cc]ache/ + +# Others +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ +bower_components/ +orleans.codegen.cs + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + +# Node.js Tools for Visual Studio +.ntvs_analysis.dat + +# Visual Studio 6 build log +*.plg + +# Visual Studio 6 workspace options file +*.opt diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/headerParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/headerParam.mustache new file mode 100644 index 00000000000..45a5be9d7b5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/headerParam.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}[FromHeader]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isHeaderParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/listReturn.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/listReturn.mustache new file mode 100644 index 00000000000..d609e67148c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/listReturn.mustache @@ -0,0 +1,4 @@ + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<{{returnContainer}}<{{#returnType}}{{{returnType}}}{{/returnType}}>>(exampleJson) + : Enumerable.Empty<{{#returnType}}{{{returnType}}}{{/returnType}}>(); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/mapReturn.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/mapReturn.mustache new file mode 100644 index 00000000000..856fb1b3507 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/mapReturn.mustache @@ -0,0 +1,4 @@ + + var example = exampleJson != null + ? JsonConvert.DeserializeObject>(exampleJson) + : new Dictionary<{{#returnType}}{{{returnType}}}{{/returnType}}>(); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/model.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/model.mustache new file mode 100644 index 00000000000..7b06958ef67 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/model.mustache @@ -0,0 +1,136 @@ +{{>partial_header}} +using System; +using System.Linq; +using System.Text; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +{{#models}} +{{#model}} +namespace {{packageName}}.Models +{ {{#isEnum}}{{>enumClass}}{{/isEnum}}{{^isEnum}} + /// + /// {{description}} + /// + [DataContract] + public partial class {{classname}} : {{#parent}}{{{parent}}}, {{/parent}}IEquatable<{{classname}}> + { {{#vars}}{{#isEnum}}{{>enumClass}}{{/isEnum}}{{#items.isEnum}}{{#items}}{{>enumClass}}{{/items}}{{/items.isEnum}} + /// + /// {{^description}}Gets or Sets {{{name}}}{{/description}}{{#description}}{{description}}{{/description}} + /// + {{#description}} + /// {{description}} + {{/description}} + {{#required}} + [Required] + {{/required}} + [DataMember(Name="{{baseName}}")] + {{#isEnum}} + public {{{datatypeWithEnum}}}{{#isEnum}}{{^isContainer}}?{{/isContainer}}{{/isEnum}} {{name}} { get; set; } + {{/isEnum}} + {{^isEnum}} + public {{{dataType}}} {{name}} { get; {{#isReadOnly}}private {{/isReadOnly}}set; } + {{/isEnum}} + {{#hasMore}} + {{/hasMore}} + {{/vars}} + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class {{classname}} {\n"); + {{#vars}} + sb.Append(" {{name}}: ").Append({{name}}).Append("\n"); + {{/vars}} + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public {{#parent}}{{^isMapModel}}{{^isArrayModel}}new {{/isArrayModel}}{{/isMapModel}}{{/parent}}string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + if (obj is null) return false; + if (ReferenceEquals(this, obj)) return true; + return obj.GetType() == GetType() && Equals(({{classname}})obj); + } + + /// + /// Returns true if {{classname}} instances are equal + /// + /// Instance of {{classname}} to be compared + /// Boolean + public bool Equals({{classname}} other) + { + if (other is null) return false; + if (ReferenceEquals(this, other)) return true; + + return {{#vars}}{{#isNotContainer}} + ( + {{name}} == other.{{name}} || + {{name}} != null && + {{name}}.Equals(other.{{name}}) + ){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{^isNotContainer}} + ( + {{name}} == other.{{name}} || + {{name}} != null && + {{name}}.SequenceEqual(other.{{name}}) + ){{#hasMore}} && {{/hasMore}}{{/isNotContainer}}{{/vars}}{{^vars}}false{{/vars}}; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + var hashCode = 41; + // Suitable nullity checks etc, of course :) + {{#vars}} + if ({{name}} != null) + hashCode = hashCode * 59 + {{name}}.GetHashCode(); + {{/vars}} + return hashCode; + } + } + + #region Operators + #pragma warning disable 1591 + + public static bool operator ==({{classname}} left, {{classname}} right) + { + return Equals(left, right); + } + + public static bool operator !=({{classname}} left, {{classname}} right) + { + return !Equals(left, right); + } + + #pragma warning restore 1591 + #endregion Operators + } +{{/isEnum}} +{{/model}} +{{/models}} +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/objectReturn.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/objectReturn.mustache new file mode 100644 index 00000000000..4059a61ac0b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/objectReturn.mustache @@ -0,0 +1,4 @@ + + var example = exampleJson != null + ? JsonConvert.DeserializeObject<{{#returnType}}{{{returnType}}}{{/returnType}}>(exampleJson) + : default({{#returnType}}{{{returnType}}}{{/returnType}}); \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/partial_header.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/partial_header.mustache new file mode 100644 index 00000000000..4a682818a37 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/partial_header.mustache @@ -0,0 +1,13 @@ +/* + {{#appName}} + * {{{appName}}} + * + {{/appName}} + {{#appDescription}} + * {{{appDescription}}} + * + {{/appDescription}} + * {{#version}}OpenAPI spec version: {{{version}}}{{/version}} + * {{#infoEmail}}Contact: {{{infoEmail}}}{{/infoEmail}} + * Generated by: https://openapi-generator.tech + */ diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/pathParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/pathParam.mustache new file mode 100644 index 00000000000..70303432d48 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/pathParam.mustache @@ -0,0 +1 @@ +{{#isPathParam}}[FromRoute]{{#required}}[Required]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/queryParam.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/queryParam.mustache new file mode 100644 index 00000000000..e9fa09b005d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/queryParam.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}[FromQuery]{{#required}}[Required()]{{/required}}{{#pattern}}[RegularExpression("{{{pattern}}}")]{{/pattern}}{{#minLength}}{{#maxLength}}[StringLength({{maxLength}}, MinimumLength={{minLength}}){{/maxLength}}{{/minLength}}{{#minLength}}{{^maxLength}} [MinLength({{minLength}})]{{/maxLength}}{{/minLength}}{{^minLength}}{{#maxLength}} [MaxLength({{maxLength}})]{{/maxLength}}{{/minLength}}{{#minimum}}{{#maximum}}[Range({{minimum}}, {{maximum}})]{{/maximum}}{{/minimum}}{{&dataType}} {{paramName}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/tags.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/tags.mustache new file mode 100644 index 00000000000..c97df19949e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/tags.mustache @@ -0,0 +1 @@ +{{!TODO: Need iterable tags object...}}{{#tags}}, Tags = new[] { {{/tags}}"{{#tags}}{{tag}} {{/tags}}"{{#tags}} }{{/tags}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/validateModel.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/validateModel.mustache new file mode 100644 index 00000000000..e11aaa5d270 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/validateModel.mustache @@ -0,0 +1,61 @@ +using System.ComponentModel.DataAnnotations; +using System.Reflection; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Controllers; +using Microsoft.AspNetCore.Mvc.Filters; +using Microsoft.AspNetCore.Mvc.ModelBinding; + +namespace {{packageName}}.Attributes +{ + /// + /// Model state validation attribute + /// + public class ValidateModelStateAttribute : ActionFilterAttribute + { + /// + /// Called before the action method is invoked + /// + /// + public override void OnActionExecuting(ActionExecutingContext context) + { + // Per https://blog.markvincze.com/how-to-validate-action-parameters-with-dataannotation-attributes/ + var descriptor = context.ActionDescriptor as ControllerActionDescriptor; + if (descriptor != null) + { + foreach (var parameter in descriptor.MethodInfo.GetParameters()) + { + object args = null; + if (context.ActionArguments.ContainsKey(parameter.Name)) + { + args = context.ActionArguments[parameter.Name]; + } + + ValidateAttributes(parameter, args, context.ModelState); + } + } + + if (!context.ModelState.IsValid) + { + context.Result = new BadRequestObjectResult(context.ModelState); + } + } + + private void ValidateAttributes(ParameterInfo parameter, object args, ModelStateDictionary modelState) + { + foreach (var attributeData in parameter.CustomAttributes) + { + var attributeInstance = parameter.GetCustomAttribute(attributeData.AttributeType); + + var validationAttribute = attributeInstance as ValidationAttribute; + if (validationAttribute != null) + { + var isValid = validationAttribute.IsValid(args); + if (!isValid) + { + modelState.AddModelError(parameter.Name, validationAttribute.FormatErrorMessage(parameter.Name)); + } + } + } + } + } +} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/wwwroot/README.md b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/wwwroot/README.md new file mode 100644 index 00000000000..6a0b78471a3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/wwwroot/README.md @@ -0,0 +1,42 @@ +# Welcome to ASP.NET 5 Preview + +We've made some big updates in this release, so it’s **important** that you spend a few minutes to learn what’s new. + +ASP.NET 5 has been rearchitected to make it **lean** and **composable**. It's fully **open source** and available on [GitHub](http://go.microsoft.com/fwlink/?LinkID=517854). +Your new project automatically takes advantage of modern client-side utilities like [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) and [npm](http://go.microsoft.com/fwlink/?LinkId=518005) (to add client-side libraries) and [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) (for client-side build and automation tasks). + +We hope you enjoy the new capabilities in ASP.NET 5 and Visual Studio 2015. +The ASP.NET Team + +### You've created a new ASP.NET 5 project. [Learn what's new](http://go.microsoft.com/fwlink/?LinkId=518016) + +### This application consists of: +* Sample pages using ASP.NET MVC 6 +* [Gulp](http://go.microsoft.com/fwlink/?LinkId=518007) and [Bower](http://go.microsoft.com/fwlink/?LinkId=518004) for managing client-side resources +* Theming using [Bootstrap](http://go.microsoft.com/fwlink/?LinkID=398939) + +#### NEW CONCEPTS +* [The 'wwwroot' explained](http://go.microsoft.com/fwlink/?LinkId=518008) +* [Configuration in ASP.NET 5](http://go.microsoft.com/fwlink/?LinkId=518012) +* [Dependency Injection](http://go.microsoft.com/fwlink/?LinkId=518013) +* [Razor TagHelpers](http://go.microsoft.com/fwlink/?LinkId=518014) +* [Manage client packages using Gulp](http://go.microsoft.com/fwlink/?LinkID=517849) +* [Develop on different platforms](http://go.microsoft.com/fwlink/?LinkID=517850) + +#### CUSTOMIZE APP +* [Add Controllers and Views](http://go.microsoft.com/fwlink/?LinkID=398600) +* [Add Data using EntityFramework](http://go.microsoft.com/fwlink/?LinkID=398602) +* [Add Authentication using Identity](http://go.microsoft.com/fwlink/?LinkID=398603) +* [Add real time support using SignalR](http://go.microsoft.com/fwlink/?LinkID=398606) +* [Add Class library](http://go.microsoft.com/fwlink/?LinkID=398604) +* [Add Web APIs with MVC 6](http://go.microsoft.com/fwlink/?LinkId=518009) +* [Add client packages using Bower](http://go.microsoft.com/fwlink/?LinkID=517848) + +#### DEPLOY +* [Run your app locally](http://go.microsoft.com/fwlink/?LinkID=517851) +* [Run your app on ASP.NET Core 5](http://go.microsoft.com/fwlink/?LinkID=517852) +* [Run commands in your 'project.json'](http://go.microsoft.com/fwlink/?LinkID=517853) +* [Publish to Microsoft Azure Web Sites](http://go.microsoft.com/fwlink/?LinkID=398609) +* [Publish to the file system](http://go.microsoft.com/fwlink/?LinkId=518019) + +We would love to hear your [feedback](http://go.microsoft.com/fwlink/?LinkId=518015) diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/wwwroot/index.html b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/wwwroot/index.html new file mode 100644 index 00000000000..cde1f2f90b9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/wwwroot/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/wwwroot/openapi-original.mustache b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/wwwroot/openapi-original.mustache new file mode 100644 index 00000000000..2c1b461cf00 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/wwwroot/openapi-original.mustache @@ -0,0 +1 @@ +{{{openapi-json}}} diff --git a/modules/openapi-generator/src/main/resources/aspnetcore/2.1/wwwroot/web.config b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/wwwroot/web.config new file mode 100644 index 00000000000..e70a7778d60 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/aspnetcore/2.1/wwwroot/web.config @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/modules/openapi-generator/src/main/resources/codegen/README.mustache b/modules/openapi-generator/src/main/resources/codegen/README.mustache index d8c6ab3ca32..7b274871839 100644 --- a/modules/openapi-generator/src/main/resources/codegen/README.mustache +++ b/modules/openapi-generator/src/main/resources/codegen/README.mustache @@ -1,15 +1,16 @@ # OpenAPI Generator for the {{name}} library ## Overview -This is a boiler-plate project to generate your own client library with Swagger. Its goal is -to get you started with the basic plumbing so you can put in your own logic. It won't work without -your changes applied. +This is a boiler-plate project to generate your own project derived from an OpenAPI specification. +Its goal is to get you started with the basic plumbing so you can put in your own logic. +It won't work without your changes applied. -## What's Swagger? -The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service. +## What's OpenAPI +The goal of OpenAPI is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. +When properly described with OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. +Similar to what interfaces have done for lower-level programming, OpenAPI removes the guesswork in calling the service. - -Check out [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the Swagger project, including additional libraries with support for other languages and more. +Check out [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the OpenAPI project, including additional libraries with support for other languages and more. ## How do I use this? At this point, you've likely generated a client setup. It will include something along these lines: @@ -43,10 +44,17 @@ Once modified, you can run this: mvn package ``` -In your generator project. A single jar file will be produced in `target`. You can now use that with codegen: +In your generator project. A single jar file will be produced in `target`. You can now use that with [OpenAPI Generator](https://openapi-generator.tech): +For mac/linux: ``` -java -cp /path/to/openapi-generator-cli.jar:/path/to/your.jar org.openapitools.codegen.Codegen -g {{name}} -i /path/to/openapi.yaml -o ./test +java -cp /path/to/openapi-generator-cli.jar:/path/to/your.jar org.openapitools.codegen.OpenAPIGenerator generate -g {{name}} -i /path/to/openapi.yaml -o ./test +``` +(Do not forget to replace the values `/path/to/openapi-generator-cli.jar`, `/path/to/your.jar` and `/path/to/openapi.yaml` in the previous command) + +For Windows users, you will need to use `;` instead of `:` in the classpath, e.g. +``` +java -cp /path/to/openapi-generator-cli.jar;/path/to/your.jar org.openapitools.codegen.OpenAPIGenerator generate -g {{name}} -i /path/to/openapi.yaml -o ./test ``` Now your templates are available to the client generator and you can write output values @@ -67,8 +75,8 @@ the object you have available during client generation: # -DdebugOperations prints operations passed to the template engine # -DdebugSupportingFiles prints additional data passed to the template engine -java -DdebugOperations -cp /path/to/openapi-generator-cli.jar:/path/to/your.jar org.openapitools.codegen.Codegen -g {{name}} -i /path/to/swagger.yaml -o ./test +java -DdebugOperations -cp /path/to/openapi-generator-cli.jar:/path/to/your.jar org.openapitools.codegen.OpenAPIGenerator generate -g {{name}} -i /path/to/openapi.yaml -o ./test ``` -Will, for example, output the debug info for operations. You can use this info -in the `api.mustache` file. \ No newline at end of file +Will, for example, output the debug info for operations. +You can use this info in the `api.mustache` file. \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/codegen/generatorClass.mustache b/modules/openapi-generator/src/main/resources/codegen/generatorClass.mustache index acdeeba6f49..cefd218cb50 100644 --- a/modules/openapi-generator/src/main/resources/codegen/generatorClass.mustache +++ b/modules/openapi-generator/src/main/resources/codegen/generatorClass.mustache @@ -19,7 +19,7 @@ public class {{generatorClass}} extends DefaultCodegen implements CodegenConfig * @see org.openapitools.codegen.CodegenType */ public CodegenType getTag() { - return CodegenType.CLIENT; + return CodegenType.{{generatorType}}; } /** diff --git a/modules/openapi-generator/src/main/resources/codegen/pom.mustache b/modules/openapi-generator/src/main/resources/codegen/pom.mustache index 2548456f813..cb3712e87ad 100644 --- a/modules/openapi-generator/src/main/resources/codegen/pom.mustache +++ b/modules/openapi-generator/src/main/resources/codegen/pom.mustache @@ -100,8 +100,8 @@ maven-compiler-plugin 3.6.1 - 1.7 - 1.7 + 1.8 + 1.8 diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache index 9db55ca4bac..7ecc6c48a38 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-header.mustache @@ -29,7 +29,7 @@ using namespace {{modelNamespace}};{{/hasModelImport}} class {{declspec}} {{classname}} { public: {{classname}}(Pistache::Address addr); - virtual ~{{classname}}() {}; + virtual ~{{classname}}() {} void init(size_t thr); void start(); void shutdown(); diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-impl-header.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-impl-header.mustache index 49c274d8fd7..357765cf57f 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-impl-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-impl-header.mustache @@ -32,7 +32,7 @@ using namespace {{modelNamespace}};{{/hasModelImport}} class {{classname}}Impl : public {{apiNamespace}}::{{classname}} { public: {{classname}}Impl(Pistache::Address addr); - ~{{classname}}Impl() { }; + ~{{classname}}Impl() {} {{#operation}} {{#vendorExtensions.x-codegen-pistache-isParsingSupported}} diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache index c40c67eaa74..58104a36223 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/api-source.mustache @@ -2,11 +2,13 @@ {{#operations}} #include "{{classname}}.h" +#include "{{prefix}}Helpers.h" {{#apiNamespaceDeclarations}} namespace {{this}} { {{/apiNamespaceDeclarations}} +using namespace {{helpersNamespace}}; {{#hasModelImport}} using namespace {{modelNamespace}};{{/hasModelImport}} @@ -62,7 +64,14 @@ void {{classname}}::{{operationIdSnakeCase}}_handler(const Pistache::Rest::Reque {{/hasBodyParam}}{{#hasQueryParams}} // Getting the query params {{#queryParams}} - auto {{paramName}} = request.query().get("{{baseName}}"); + auto {{paramName}}Query = request.query().get("{{baseName}}"); + Pistache::Optional<{{^isContainer}}{{dataType}}{{/isContainer}}{{#isListContainer}}std::vector<{{items.baseType}}>{{/isListContainer}}> {{paramName}}; + if(!{{paramName}}Query.isEmpty()){ + {{^isContainer}}{{dataType}}{{/isContainer}}{{#isListContainer}}std::vector<{{items.baseType}}>{{/isListContainer}} value; + if(fromStringValue({{paramName}}Query.get(), value)){ + {{paramName}} = Pistache::Some(value); + } + } {{/queryParams}} {{/hasQueryParams}}{{#hasHeaderParams}} // Getting the header params diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/cmake.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/cmake.mustache index bec55299241..11c7a5c3c52 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/cmake.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/cmake.mustache @@ -56,6 +56,9 @@ set(<%classnameSnakeUpperCase%>_SERVER_SOURCES <%#operations%> add_executable(<%classnameSnakeLowerCase%>_server ${<%classnameSnakeUpperCase%>_SERVER_SOURCES}) +<%#addExternalLibs%> +add_dependencies(<%classnameSnakeLowerCase%>_server PISTACHE NLOHMANN) +<%/addExternalLibs%> <%/operations%> <%/apiInfo.apis%> diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-header.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-header.mustache new file mode 100644 index 00000000000..c39cca04fe1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-header.mustache @@ -0,0 +1,64 @@ +{{>licenseInfo}} +/* + * {{prefix}}Helpers.h + * + * This is the helper class for models and primitives + */ + +#ifndef {{prefix}}Helpers_H_ +#define {{prefix}}Helpers_H_ + +#include +#include +#include +#include +#include + +{{#helpersNamespaceDeclarations}} +namespace {{this}} { +{{/helpersNamespaceDeclarations}} + + std::string toStringValue(const std::string &value); + std::string toStringValue(const int32_t &value); + std::string toStringValue(const int64_t &value); + std::string toStringValue(const bool &value); + std::string toStringValue(const float &value); + std::string toStringValue(const double &value); + + bool fromStringValue(const std::string &inStr, std::string &value); + bool fromStringValue(const std::string &inStr, int32_t &value); + bool fromStringValue(const std::string &inStr, int64_t &value); + bool fromStringValue(const std::string &inStr, bool &value); + bool fromStringValue(const std::string &inStr, float &value); + bool fromStringValue(const std::string &inStr, double &value); + template + bool fromStringValue(const std::vector &inStr, std::vector &value){ + try{ + for(auto & item : inStr){ + T itemValue; + if(fromStringValue(item, itemValue)){ + value.push_back(itemValue); + } + } + } + catch(...){ + return false; + } + return value.size() > 0; + } + template + bool fromStringValue(const std::string &inStr, std::vector &value, char separator = ','){ + std::vector inStrings; + std::istringstream f(inStr); + std::string s; + while (std::getline(f, s, separator)) { + inStrings.push_back(s); + } + return fromStringValue(inStrings, value); + } + +{{#helpersNamespaceDeclarations}} +} +{{/helpersNamespaceDeclarations}} + +#endif // {{prefix}}Helpers_H_ \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-source.mustache new file mode 100644 index 00000000000..f08981eff5a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/helpers-source.mustache @@ -0,0 +1,86 @@ +{{>licenseInfo}} +#include "{{prefix}}Helpers.h" + +{{#helpersNamespaceDeclarations}} +namespace {{this}} { +{{/helpersNamespaceDeclarations}} + + +std::string toStringValue(const std::string &value){ + return std::string(value); +} + +std::string toStringValue(const int32_t &value){ + return std::to_string(value); +} + +std::string toStringValue(const int64_t &value){ + return std::to_string(value); +} + +std::string toStringValue(const bool &value){ + return value?std::string("true"):std::string("false"); +} + +std::string toStringValue(const float &value){ + return std::to_string(value); +} + +std::string toStringValue(const double &value){ + return std::to_string(value); +} + +bool fromStringValue(const std::string &inStr, std::string &value){ + value = std::string(inStr); + return true; +} + +bool fromStringValue(const std::string &inStr, int32_t &value){ + try { + value = std::stoi( inStr ); + } + catch (const std::invalid_argument) { + return false; + } + return true; +} + +bool fromStringValue(const std::string &inStr, int64_t &value){ + try { + value = std::stol( inStr ); + } + catch (const std::invalid_argument) { + return false; + } + return true; +} + +bool fromStringValue(const std::string &inStr, bool &value){ + bool result = true; + inStr == "true"?value = true: inStr == "false"?value = false: result = false; + return result; +} + +bool fromStringValue(const std::string &inStr, float &value){ + try { + value = std::stof( inStr ); + } + catch (const std::invalid_argument) { + return false; + } + return true; +} + +bool fromStringValue(const std::string &inStr, double &value){ + try { + value = std::stod( inStr ); + } + catch (const std::invalid_argument) { + return false; + } + return true; +} + +{{#helpersNamespaceDeclarations}} +} +{{/helpersNamespaceDeclarations}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache index 9c60bbbaae0..41d64dcf75d 100644 --- a/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-pistache-server/model-source.mustache @@ -95,15 +95,15 @@ void {{classname}}::fromJson(nlohmann::json& val) } {{/isListContainer}}{{^isListContainer}}{{^isPrimitiveType}}{{^required}}if(val.find("{{baseName}}") != val.end()) { - {{#isString}}{{setter}}(val.at("{{baseName}}"));{{/isString}}{{#isByteArray}}{{setter}}(val.at("{{baseName}}")); - {{/isByteArray}}{{^isString}}{{#isDateTime}}{{setter}}(val.at("{{baseName}}")); - {{/isDateTime}}{{^isDateTime}}{{^isByteArray}}if(!val["{{baseName}}"].is_null()) + {{#isString}}{{setter}}(val.at("{{baseName}}"));{{/isString}}{{#isByteArray}}{{setter}}(val.at("{{baseName}}"));{{/isByteArray}}{{#isBinary}}{{setter}}(val.at("{{baseName}}")); + {{/isBinary}}{{^isString}}{{#isDateTime}}{{setter}}(val.at("{{baseName}}")); + {{/isDateTime}}{{^isDateTime}}{{^isByteArray}}{{^isBinary}}if(!val["{{baseName}}"].is_null()) { {{{dataType}}} newItem; newItem.fromJson(val["{{baseName}}"]); {{setter}}( newItem ); } - {{/isByteArray}}{{/isDateTime}}{{/isString}} + {{/isBinary}}{{/isByteArray}}{{/isDateTime}}{{/isString}} } {{/required}}{{#required}}{{#isString}}{{setter}}(val.at("{{baseName}}")); {{/isString}}{{^isString}}{{#isDateTime}}{{setter}}(val.at("{{baseName}}")); diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/CMakeLists.txt.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/CMakeLists.txt.mustache index 527b76ca9b4..54e6d36d73f 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/CMakeLists.txt.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/CMakeLists.txt.mustache @@ -7,7 +7,8 @@ set(EXTERNAL_INSTALL_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/external) ExternalProject_Add(QHTTPENGINE GIT_REPOSITORY https://github.com/etherealjoy/qhttpengine.git - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} ) include_directories(${EXTERNAL_INSTALL_LOCATION}/include) diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/Dockerfile.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/Dockerfile.mustache index b3395482976..b0c591d10f6 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/Dockerfile.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/Dockerfile.mustache @@ -1,11 +1,11 @@ FROM alpine:latest AS build -RUN apk add --update \ +RUN apk add --update \ cmake \ alpine-sdk \ - openssl \ - qt5-qtbase-dev \ - qt5-qttools-dev + openssl \ + qt5-qtbase-dev \ + qt5-qttools-dev WORKDIR /usr/server ADD ./src ./src @@ -13,17 +13,17 @@ ADD ./CMakeLists.txt ./ RUN mkdir -p ./build WORKDIR /usr/server/build RUN cmake -DNODEBUG:STRING="ON" .. -RUN make +RUN make FROM alpine:latest AS runtime -RUN apk add --update \ +RUN apk add --update \ libgcc \ libstdc++ \ qt5-qtbase \ openssl WORKDIR /usr/server -COPY --from=build /usr/server/build/src/cpp-qt5-server ./build/src/ +COPY --from=build /usr/server/build/src/cpp-qt5-qhttpengine-server ./build/src/ COPY --from=build /usr/server/external/ ./external EXPOSE 8080/tcp -ENTRYPOINT ["/usr/server/build/src/cpp-qt5-server"] \ No newline at end of file +ENTRYPOINT ["/usr/server/build/src/cpp-qt5-qhttpengine-server"] \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/LICENSE.txt.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/LICENSE.txt.mustache index 04938f840c9..be59130f858 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/LICENSE.txt.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/LICENSE.txt.mustache @@ -1,4 +1,4 @@ -QHttpEngine +QHttpEngine The MIT License (MIT) diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/README.md.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/README.md.mustache index 45f2f724676..df0570717b5 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/README.md.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/README.md.mustache @@ -1,8 +1,9 @@ +# C++ Qt5 Server + ## Qt5 HTTP Server based on the Qhttpengine -This server was generated by the [openapi-generator] -(https://openapi-generator.tech) project. -By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. -- + +This server was generated by the [openapi-generator](https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. To see how to make this your own, look here: @@ -25,30 +26,36 @@ Simple set of classes for developing HTTP server applications in Qt. To learn more about building and using the library, please visit this page: -https://ci.quickmediasolutions.com/job/qhttpengine-documentation/doxygen/ - +[Link](https://ci.quickmediasolutions.com/job/qhttpengine-documentation/doxygen) ### Viewing the code -You can view the code using an editor like Microsoft Visual Studio Code or you can + +You can view the code using an editor like Microsoft Visual Studio Code or you can Use QtCreator and browse for the root CMakeLists.txt and load it as a project ### Build with make + Install the tools [Linux/Debian] -``` + +```shell sudo apt install cmake build-essential libssl-dev qtbase5-dev qtbase5-dev-tools git curl ``` To build, go to the `server` folder -``` -make + +```shell +make ``` To run the server -``` + +```shell ./build/src/cpp-qt5-server & ``` + #### Invoke an API -``` + +```shell curl -X GET http://localhost:8080/v2/store/inventory curl -X POST http://localhost:8080/v2/store/order -H "Content-Type: application/json" -d "{ \"id\": 22, \"petId\": 1541, \"quantity\": 5, \"shipDate\": \"2018-06-16T18:31:43.870Z\", \"status\": \"placed\", \"complete\": \"true\" }" curl -X GET http://localhost:8080/v2/pet/findByStatus @@ -56,38 +63,50 @@ curl -X GET http://localhost:8080/v2/store/inventory ``` ### Run and build with docker + Building with docker multistage If you dont have docker install [here](https://docs.docker.com/install) Add yourself to the docker group -``` +```shell docker build --network=host -t cpp-qt5-server . ``` -Running with docker -``` -docker run --rm -it --name=server-container cpp-qt5-server + +Running with docker + +```shell +docker run --rm -it --name=server-container cpp-qt5-server ``` #### Invoking an API + Mind the IP here -``` + +```shell curl -X GET http://172.17.0.2:8080/v2/store/inventory curl -X POST http://172.17.0.2:8080/v2/store/order -H "Content-Type: application/json" -d "{ \"id\": 22, \"petId\": 1541, \"quantity\": 5, \"shipDate\": \"2018-06-16T18:31:43.870Z\", \"status\": \"placed\", \"complete\": \"true\" }" ``` use this command to get the container IP -``` + +```shell docker inspect server-container | grep "IPAddress" ``` -To exit from the command line -``` + +To exit from the command line + +```shell Ctrl + p + q ``` + To stop container -``` + +```shell docker stop ``` + or to terminate and quit -``` + +```shell Ctrl+C ``` diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirequest.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirequest.cpp.mustache index 4fa84629c38..c191fbc3b9d 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirequest.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirequest.cpp.mustache @@ -16,7 +16,7 @@ namespace {{this}} { auto headers = s->headers(); for(auto itr = headers.begin(); itr != headers.end(); itr++) { requestHeaders.insert(QString(itr.key()), QString(itr.value())); - } + } } {{classname}}Request::~{{classname}}Request(){ @@ -24,7 +24,7 @@ namespace {{this}} { qDebug() << "{{classname}}Request::~{{classname}}Request()"; } -QMap +QMap {{classname}}Request::getRequestHeaders() const { return requestHeaders; } @@ -44,9 +44,9 @@ QHttpEngine::Socket* {{classname}}Request::getRawSocket(){ void {{classname}}Request::{{nickname}}Request({{#hasPathParams}}{{#pathParams}}const QString& {{{paramName}}}str{{#hasMore}}, {{/hasMore}}{{/pathParams}}{{/hasPathParams}}){ qDebug() << "{{{basePathWithoutHost}}}{{{path}}}"; connect(this, &{{classname}}Request::{{nickname}}, handler, &{{classname}}Handler::{{nickname}}); - + {{#queryParams}}{{queryParam}} - {{{dataType}}} {{paramName}}; + {{{dataType}}} {{paramName}}; if(socket->queryString().keys().contains("{{paramName}}")){ fromStringValue(socket->queryString().value{{#isListContainer}}s{{/isListContainer}}("{{paramName}}"), {{paramName}}); } @@ -63,7 +63,7 @@ void {{classname}}Request::{{nickname}}Request({{#hasPathParams}}{{#pathParams}} {{{dataType}}} {{paramName}};{{/formParams}}{{#bodyParams}} {{#bodyParam}} {{#isListContainer}} QJsonDocument doc; - {{{dataType}}} {{paramName}}; + {{{dataType}}} {{paramName}}; if(socket->readJson(doc)){ QJsonArray jsonArray = doc.array(); foreach(QJsonValue obj, jsonArray) { @@ -84,7 +84,7 @@ void {{classname}}Request::{{nickname}}Request({{#hasPathParams}}{{#pathParams}} QJsonDocument doc; socket->readJson(doc); QJsonObject obj = doc.object(); - {{{dataType}}} {{paramName}}; + {{{dataType}}} {{paramName}}; foreach(QString key, obj.keys()) { {{baseType}} val; ::{{cppNamespace}}::fromJsonValue(val, obj[key]); @@ -100,19 +100,21 @@ void {{classname}}Request::{{nickname}}Request({{#hasPathParams}}{{#pathParams}} ::{{cppNamespace}}::fromJsonValue({{paramName}}, obj); {{/isPrimitiveType}} {{/isMapContainer}} - {{/isListContainer}} + {{/isListContainer}} {{/bodyParam}}{{/bodyParams}} - emit {{nickname}}({{#allParams}}{{#isBodyParam}}{{/isBodyParam}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + emit {{nickname}}({{#allParams}}{{#isBodyParam}}{{/isBodyParam}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); } -{{/operation}}{{/operations}} +{{/operation}}{{/operations}} {{#operations}}{{#operation}}void {{classname}}Request::{{nickname}}Response({{#returnType}}const {{{returnType}}}& res{{/returnType}}){ - writeResponseHeaders();{{#returnType}}{{^isPrimitiveType}} - QJsonDocument resDoc(::{{cppNamespace}}::toJsonValue(res).to{{^isListContainer}}Object{{/isListContainer}}{{#isListContainer}}Array{{/isListContainer}}());{{/isPrimitiveType}} - socket->writeJson(resDoc);{{#isPrimitiveType}} - socket->write({{#isListContainer}}QString("["+{{/isListContainer}}::{{cppNamespace}}::toStringValue(res){{#isListContainer}}+"]"){{/isListContainer}}.toUtf8());{{/isPrimitiveType}}{{/returnType}}{{^returnType}} + writeResponseHeaders();{{#returnType}}{{#isMapContainer}} + QJsonDocument resDoc(::{{cppNamespace}}::toJsonValue(res).toObject()); + socket->writeJson(resDoc);{{/isMapContainer}}{{^isMapContainer}}{{^returnTypeIsPrimitive}} + QJsonDocument resDoc(::{{cppNamespace}}::toJsonValue(res).to{{^isListContainer}}Object{{/isListContainer}}{{#isListContainer}}Array{{/isListContainer}}()); + socket->writeJson(resDoc);{{/returnTypeIsPrimitive}}{{#returnTypeIsPrimitive}} + socket->write({{#isListContainer}}QString("["+{{/isListContainer}}::{{cppNamespace}}::toStringValue(res){{#isListContainer}}+"]"){{/isListContainer}}.toUtf8());{{/returnTypeIsPrimitive}}{{/isMapContainer}}{{/returnType}}{{^returnType}} socket->setStatusCode(QHttpEngine::Socket::OK);{{/returnType}} if(socket->isOpen()){ socket->close(); @@ -123,10 +125,12 @@ void {{classname}}Request::{{nickname}}Request({{#hasPathParams}}{{#pathParams}} {{#operations}}{{#operation}}void {{classname}}Request::{{nickname}}Error({{#returnType}}const {{{returnType}}}& res, {{/returnType}}QNetworkReply::NetworkError error_type, QString& error_str){ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors writeResponseHeaders();{{#returnType}} - Q_UNUSED(error_str); // response will be used instead of error string{{^isPrimitiveType}} - QJsonDocument resDoc(::{{cppNamespace}}::toJsonValue(res).to{{^isListContainer}}Object{{/isListContainer}}{{#isListContainer}}Array{{/isListContainer}}());{{/isPrimitiveType}} - socket->writeJson(resDoc);{{#isPrimitiveType}} - socket->write({{#isListContainer}}QString("["+{{/isListContainer}}::{{cppNamespace}}::toStringValue(res){{#isListContainer}}+"]"){{/isListContainer}}.toUtf8());{{/isPrimitiveType}}{{/returnType}}{{^returnType}} + Q_UNUSED(error_str); // response will be used instead of error string{{#isMapContainer}} + QJsonDocument resDoc(::{{cppNamespace}}::toJsonValue(res).toObject()); + socket->writeJson(resDoc);{{/isMapContainer}}{{^isMapContainer}}{{^returnTypeIsPrimitive}} + QJsonDocument resDoc(::{{cppNamespace}}::toJsonValue(res).to{{^isListContainer}}Object{{/isListContainer}}{{#isListContainer}}Array{{/isListContainer}}()); + socket->writeJson(resDoc);{{/returnTypeIsPrimitive}}{{#returnTypeIsPrimitive}} + socket->write({{#isListContainer}}QString("["+{{/isListContainer}}::{{cppNamespace}}::toStringValue(res){{#isListContainer}}+"]"){{/isListContainer}}.toUtf8());{{/returnTypeIsPrimitive}}{{/isMapContainer}}{{/returnType}}{{^returnType}} socket->setStatusCode(QHttpEngine::Socket::NotFound); socket->write(error_str.toUtf8());{{/returnType}} if(socket->isOpen()){ @@ -139,7 +143,7 @@ void {{classname}}Request::sendCustomResponse(QByteArray & res, QNetworkReply::N Q_UNUSED(res); // TODO Q_UNUSED(error_type); // TODO } - + void {{classname}}Request::sendCustomResponse(QIODevice *res, QNetworkReply::NetworkError error_type){ Q_UNUSED(res); // TODO Q_UNUSED(error_type); // TODO diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirequest.h.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirequest.h.mustache index ed7339278ad..c736195d744 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirequest.h.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirequest.h.mustache @@ -20,7 +20,7 @@ namespace {{this}} { class {{classname}}Request : public QObject { Q_OBJECT - + public: {{classname}}Request(QHttpEngine::Socket *s, {{classname}}Handler* handler); virtual ~{{classname}}Request(); @@ -60,7 +60,7 @@ private: resHeaders.insert(itr.key().toUtf8(), itr.value().toUtf8()); } socket->setHeaders(resHeaders); - socket->writeHeaders(); + socket->writeHeaders(); } }; diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirouter.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirouter.cpp.mustache index be6c0bb0724..e6308bb957b 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirouter.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirouter.cpp.mustache @@ -3,7 +3,7 @@ #include #include #include -#include + #include "{{prefix}}ApiRouter.h" {{#apiInfo}}{{#apis}}{{#operations}}#include "{{classname}}Request.h" @@ -13,80 +13,69 @@ namespace {{this}} { {{/cppNamespaceDeclarations}} -inline QHttpEngine::Socket::Method toQHttpEngineMethod(QString method){ - - if( method == QString("OPTIONS")) - return QHttpEngine::Socket::Method::OPTIONS; - if( method == QString("GET")) - return QHttpEngine::Socket::Method::GET; - if( method == QString("HEAD")) - return QHttpEngine::Socket::Method::HEAD; - if( method == QString("POST")) - return QHttpEngine::Socket::Method::POST; - if( method == QString("PUT")) - return QHttpEngine::Socket::Method::PUT; - if( method == QString("DELETE")) - return QHttpEngine::Socket::Method::DELETE; - if( method == QString("TRACE")) - return QHttpEngine::Socket::Method::TRACE; - if( method == QString("CONNECT")) - return QHttpEngine::Socket::Method::CONNECT; - - return static_cast(-1); +{{prefix}}ApiRouter::{{prefix}}ApiRouter() { + createApiHandlers(); } -ApiRouter::ApiRouter() { - {{#apiInfo}}{{#apis}}{{classname}}ApiHandler = new {{classname}}Handler(); - {{/apis}}{{/apiInfo}} +{{prefix}}ApiRouter::~{{prefix}}ApiRouter(){ + {{#apiInfo}}{{#apis}} + delete {{classname}}ApiHandler;{{/apis}}{{/apiInfo}} } -ApiRouter::~ApiRouter(){ - qDebug() << "~ApiRouter()"; - {{#apiInfo}}{{#apis}}delete {{classname}}ApiHandler; - {{/apis}}{{/apiInfo}} +void {{prefix}}ApiRouter::createApiHandlers() { {{#apiInfo}}{{#apis}} + {{classname}}ApiHandler = new {{classname}}Handler();{{/apis}}{{/apiInfo}} } -void ApiRouter::setUpRoutes() { - {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{^pathParams}} - Routes.insert("{{{basePathWithoutHost}}}{{{path}}}",[this](QHttpEngine::Socket *socket) { - if(toQHttpEngineMethod("{{httpMethod}}") == socket->method()){ +void {{prefix}}ApiRouter::setUpRoutes() { + {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{^hasPathParams}} + Routes.insert(QString("%1 %2").arg("{{httpMethod}}").arg("{{{basePathWithoutHost}}}{{{path}}}").toLower(), [this](QHttpEngine::Socket *socket) { auto reqObj = new {{classname}}Request(socket, {{classname}}ApiHandler); reqObj->{{nickname}}Request(); - } - });{{/pathParams}}{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + });{{/hasPathParams}}{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} } -void ApiRouter::processRequest(QHttpEngine::Socket *socket){ - if (Routes.contains(socket->path())) { - for(auto endpoints : Routes.values(socket->path())) { - endpoints.operator()(socket); - } - } else - { {{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{#pathParams}} - { - QString completePath("{{{basePathWithoutHost}}}{{{path}}}"); - QString {{paramName}}PathParam("{"); - {{paramName}}PathParam.append("{{baseName}}").append("}"); - completePath.replace("/", "\\/"); // replace '/' with '\/' for regex - completePath.replace({{paramName}}PathParam, "([^\\/]*?)"); // match anything but '/'' - completePath.append("$"); // End of string - QRegularExpression re(completePath, QRegularExpression::CaseInsensitiveOption); - QRegularExpressionMatch match = re.match(socket->path()); - if ((toQHttpEngineMethod("{{httpMethod}}") == socket->method()) && match.hasMatch() ) { - QString pathparam = match.captured(1); - auto reqObj = new {{classname}}Request(socket, {{classname}}ApiHandler); - reqObj->{{nickname}}Request({{#hasPathParams}}{{#pathParams}}pathparam{{/pathParams}}{{/hasPathParams}}); - return; - } - }{{/pathParams}}{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} +void {{prefix}}ApiRouter::processRequest(QHttpEngine::Socket *socket){ + if( handleRequest(socket) ){ + return; + } + if( handleRequestAndExtractPathParam(socket) ){ + return; } socket->setStatusCode(QHttpEngine::Socket::NotFound); if(socket->isOpen()){ socket->writeHeaders(); socket->close(); } - return; } + +bool {{prefix}}ApiRouter::handleRequest(QHttpEngine::Socket *socket){ + auto reqPath = QString("%1 %2").arg(fromQHttpEngineMethod(socket->method())).arg(socket->path()).toLower(); + if ( Routes.contains(reqPath) ) { + Routes.value(reqPath).operator()(socket); + return true; + } + return false; +} + +bool {{prefix}}ApiRouter::handleRequestAndExtractPathParam(QHttpEngine::Socket *socket){ + auto reqPath = QString("%1 %2").arg(fromQHttpEngineMethod(socket->method())).arg(socket->path()).toLower();{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}{{#hasPathParams}} + { + auto completePath = QString("%1 %2").arg("{{httpMethod}}").arg("{{{basePathWithoutHost}}}{{{path}}}").toLower(); + if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); + if ( match.hasMatch() ){ + {{#pathParams}} + QString {{baseName}} = match.captured(QString("{{baseName}}").toLower()); + {{/pathParams}} + auto reqObj = new {{classname}}Request(socket, {{classname}}ApiHandler); + reqObj->{{nickname}}Request({{#pathParams}}{{baseName}}{{#hasMore}}, {{/hasMore}}{{/pathParams}}); + return true; + } + } + }{{/hasPathParams}}{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + return false; +} + {{#cppNamespaceDeclarations}} } {{/cppNamespaceDeclarations}} diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirouter.h.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirouter.h.mustache index a55da19cc4b..47a787fc8fa 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirouter.h.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/apirouter.h.mustache @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -19,7 +20,7 @@ namespace {{this}} { {{/cppNamespaceDeclarations}} -class RequestHandler : public QHttpEngine::QObjectHandler +class {{prefix}}ApiRequestHandler : public QHttpEngine::QObjectHandler { Q_OBJECT signals: @@ -32,19 +33,59 @@ protected: } }; -class ApiRouter : public QObject +class {{prefix}}ApiRouter : public QObject { Q_OBJECT public: - ApiRouter(); - virtual ~ApiRouter(); + {{prefix}}ApiRouter(); + virtual ~{{prefix}}ApiRouter(); void setUpRoutes(); void processRequest(QHttpEngine::Socket *socket); private: - QMultiMap> Routes; + QMap> Routes; + QMultiMap> RoutesWithPathParam; + + bool handleRequest(QHttpEngine::Socket *socket); + bool handleRequestAndExtractPathParam(QHttpEngine::Socket *socket); + {{#apiInfo}}{{#apis}} - {{classname}}Handler *{{classname}}ApiHandler;{{/apis}}{{/apiInfo}} + {{classname}}Handler *{{classname}}ApiHandler;{{/apis}}{{/apiInfo}} +protected: + // override this method to provide custom class derived from ApiHandler classes + virtual void createApiHandlers(); + +private : + inline QString fromQHttpEngineMethod(QHttpEngine::Socket::Method method){ + switch( method ){ + case QHttpEngine::Socket::Method::OPTIONS: + return QStringLiteral("OPTIONS"); + case QHttpEngine::Socket::Method::GET: + return QStringLiteral("GET"); + case QHttpEngine::Socket::Method::HEAD: + return QStringLiteral("HEAD"); + case QHttpEngine::Socket::Method::POST: + return QStringLiteral("POST"); + case QHttpEngine::Socket::Method::PUT: + return QStringLiteral("PUT"); + case QHttpEngine::Socket::Method::DELETE: + return QStringLiteral("DELETE"); + case QHttpEngine::Socket::Method::TRACE: + return QStringLiteral("TRACE"); + case QHttpEngine::Socket::Method::CONNECT: + return QStringLiteral("CONNECT"); + } + return QStringLiteral(""); + } + + inline QRegularExpressionMatch getRequestMatch(QString serverTemplatePath, QString requestPath){ + QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); + serverTemplatePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); + serverTemplatePath.append("[\\/]?$"); + QRegularExpression pathExpr( serverTemplatePath ); + return pathExpr.match( requestPath ); + } + }; diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/helpers-header.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/helpers-header.mustache index 167676df65b..78a0094eb02 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/helpers-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/helpers-header.mustache @@ -125,7 +125,7 @@ namespace {{this}} { for(auto itemkey : varmap.keys() ){ T itemVal; fromJsonValue(itemVal, QJsonValue::fromVariant(varmap.value(itemkey))); - val.insert(itemkey, val); + val.insert(itemkey, itemVal); } } return; diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/main.cpp.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/main.cpp.mustache index c030bcb47f3..b4770935165 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/main.cpp.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/main.cpp.mustache @@ -8,43 +8,43 @@ #include #include #include -#ifdef __linux__ +#ifdef __linux__ #include #include -#endif +#endif #include #include "{{prefix}}ApiRouter.h" -#ifdef __linux__ +#ifdef __linux__ void catchUnixSignals(QList quitSignals) { auto handler = [](int sig) -> void { // blocking and not aysnc-signal-safe func are valid qDebug() << "\nquit the application by signal " << sig; QCoreApplication::quit(); }; - - sigset_t blocking_mask; - sigemptyset(&blocking_mask); - for (auto sig : quitSignals) - sigaddset(&blocking_mask, sig); - - struct sigaction sa; - sa.sa_handler = handler; - sa.sa_mask = blocking_mask; - sa.sa_flags = 0; - - for (auto sig : quitSignals) + + sigset_t blocking_mask; + sigemptyset(&blocking_mask); + for (auto sig : quitSignals) + sigaddset(&blocking_mask, sig); + + struct sigaction sa; + sa.sa_handler = handler; + sa.sa_mask = blocking_mask; + sa.sa_flags = 0; + + for (auto sig : quitSignals) sigaction(sig, &sa, nullptr); } -#endif +#endif int main(int argc, char * argv[]) { QCoreApplication a(argc, argv); -#ifdef __linux__ +#ifdef __linux__ QList sigs({SIGQUIT, SIGINT, SIGTERM, SIGHUP}); catchUnixSignals(sigs); -#endif +#endif // Build the command-line options QCommandLineParser parser; QCommandLineOption addressOption( @@ -69,11 +69,11 @@ int main(int argc, char * argv[]) // Obtain the values QHostAddress address = QHostAddress(parser.value(addressOption)); quint16 port = static_cast(parser.value(portOption).toInt()); - - QSharedPointer<{{cppNamespace}}::RequestHandler> handler(new {{cppNamespace}}::RequestHandler()); - {{cppNamespace}}::ApiRouter router; + + QSharedPointer<{{cppNamespace}}::{{prefix}}ApiRequestHandler> handler(new {{cppNamespace}}::{{prefix}}ApiRequestHandler()); + {{cppNamespace}}::{{prefix}}ApiRouter router; router.setUpRoutes(); - QObject::connect(handler.data(), &{{cppNamespace}}::RequestHandler::requestReceived, [&](QHttpEngine::Socket *socket) { + QObject::connect(handler.data(), &{{cppNamespace}}::{{prefix}}ApiRequestHandler::requestReceived, [&](QHttpEngine::Socket *socket) { router.processRequest(socket); }); @@ -84,6 +84,6 @@ int main(int argc, char * argv[]) qCritical("Unable to listen on the specified port."); return 1; } - + return a.exec(); } diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-body.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-body.mustache index b83b21a0127..9c0de18a32f 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-body.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/model-body.mustache @@ -22,7 +22,7 @@ namespace {{this}} { } {{classname}}::~{{classname}}() { - + } void @@ -48,17 +48,19 @@ void if(json["{{baseName}}"].isArray()){ auto arr = json["{{baseName}}"].toArray(); for (const QJsonValue & jval : arr) { - {{items.baseType}} item; - {{name}}.push_back(::{{cppNamespace}}::fromJsonValue(item, jval)); + {{^items.isContainer}}{{items.baseType}}{{/items.isContainer}}{{#items.isListContainer}}QList<{{items.items.baseType}}>{{/items.isListContainer}}{{#items.isMapContainer}}QMap{{/items.isMapContainer}} item; + ::{{cppNamespace}}::fromJsonValue(item, jval) + {{name}}.push_back(item); } }{{/isListContainer}}{{#isMapContainer}} if(json["{{baseName}}"].isObject()){ auto varmap = json["{{baseName}}"].toObject().toVariantMap(); if(varmap.count() > 0){ for(auto val : varmap.keys()){ - {{items.baseType}} item; + {{^items.isContainer}}{{items.baseType}}{{/items.isContainer}}{{#items.isListContainer}}QList<{{items.items.baseType}}>{{/items.isListContainer}}{{#items.isMapContainer}}QMap{{/items.isMapContainer}} item; auto jval = QJsonValue::fromVariant(varmap.value(val)); - {{name}}.insert({{name}}.end(), val, ::{{cppNamespace}}::fromJsonValue(item, jval)); + ::{{cppNamespace}}::fromJsonValue(item, jval); + {{name}}.insert({{name}}.end(), val, item); } } }{{/isMapContainer}}{{/items.isContainer}}{{/isContainer}} @@ -77,7 +79,7 @@ QJsonObject {{classname}}::asJsonObject() const { QJsonObject obj; {{#vars}} - {{^isContainer}}{{#complexType}}{{^isString}}{{^isDateTime}}{{^isByteArray}}{{^isDate}}if({{name}}.isSet()){{/isDate}}{{/isByteArray}}{{/isDateTime}}{{/isString}}{{/complexType}}{{^complexType}}if(m_{{name}}_isSet){{/complexType}}{{#isString}}if(m_{{name}}_isSet){{/isString}}{{#isDateTime}}if(m_{{name}}_isSet){{/isDateTime}}{{#isByteArray}}if(m_{{name}}_isSet){{/isByteArray}}{{#isDate}}if(m_{{name}}_isSet){{/isDate}}{ + {{^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){ @@ -105,7 +107,7 @@ bool {{classname}}::isSet() const { bool isObjectUpdated = false; do{ {{#vars}} - {{#isContainer}}if({{name}}.size() > 0){{/isContainer}}{{^isContainer}}{{#complexType}}{{^isString}}{{^isDateTime}}{{^isByteArray}}{{^isDate}}if({{name}}.isSet()){{/isDate}}{{/isByteArray}}{{/isDateTime}}{{/isString}}{{/complexType}}{{^complexType}}if(m_{{name}}_isSet){{/complexType}}{{#isString}}if(m_{{name}}_isSet){{/isString}}{{#isDateTime}}if(m_{{name}}_isSet){{/isDateTime}}{{#isByteArray}}if(m_{{name}}_isSet){{/isByteArray}}{{#isDate}}if(m_{{name}}_isSet){{/isDate}}{{/isContainer}}{ isObjectUpdated = true; break;} + {{#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); return isObjectUpdated; } diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/object.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/object.mustache index a3ed43c95fa..26621c747ed 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/object.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/object.mustache @@ -12,9 +12,9 @@ namespace {{this}} { class {{prefix}}Object { public: virtual ~{{prefix}}Object(){ - + } - + virtual QJsonObject asJsonObject() const { return jObj; } diff --git a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/src-CMakeLists.txt.mustache b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/src-CMakeLists.txt.mustache index 9faf5db60e4..0311ec2020f 100644 --- a/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/src-CMakeLists.txt.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-qt5-qhttpengine-server/src-CMakeLists.txt.mustache @@ -12,7 +12,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++14 -Wall -Wno-unused-varia if(${NODEBUG} STREQUAL "OFF") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg -g3") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg -g3") -else (${NODEBUG} STREQUAL "OFF") +else (${NODEBUG} STREQUAL "OFF") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s -O3") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s -O3") endif(${NODEBUG} STREQUAL "OFF") diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache index 842571dcbef..7325a888f99 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache @@ -140,7 +140,11 @@ void {{classname}}::fromJson(web::json::value& val) {{^required}} if(val.has_field(utility::conversions::to_string_t("{{baseName}}"))) { - {{setter}}(ModelBase::{{baseType}}FromJson(val[utility::conversions::to_string_t("{{baseName}}")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("{{baseName}}")]; + if(!fieldValue.is_null()) + { + {{setter}}(ModelBase::{{baseType}}FromJson(fieldValue)); + } } {{/required}} {{#required}} @@ -200,36 +204,35 @@ void {{classname}}::fromJson(web::json::value& val) {{/required}} for( auto& item : val[utility::conversions::to_string_t("{{baseName}}")].as_array() ) { - utility::string_t key; if(item.has_field(utility::conversions::to_string_t("key"))) { - key = ModelBase::stringFromJson(item[utility::conversions::to_string_t("key")]); + utility::string_t key = ModelBase::stringFromJson(item[utility::conversions::to_string_t("key")]); + {{#items.isPrimitiveType}} + m_{{name}}.insert(std::pair( key, ModelBase::{{items.baseType}}FromJson(item[utility::conversions::to_string_t("value")]))); + {{/items.isPrimitiveType}} + {{^items.isPrimitiveType}} + {{#items.isString}} + m_{{name}}.insert(std::pair( key, ModelBase::stringFromJson(item[utility::conversions::to_string_t("value")]))); + {{/items.isString}} + {{^items.isString}} + {{#items.isDateTime}} + m_{{name}}.insert(std::pair( key, ModelBase::dateFromJson(item[utility::conversions::to_string_t("value")]))); + {{/items.isDateTime}} + {{^items.isDateTime}} + if(item.is_null()) + { + m_{{name}}.insert(std::pair( key, {{{items.datatype}}}(nullptr) )); + } + else + { + {{{items.datatype}}} newItem({{{items.defaultValue}}}); + newItem->fromJson(item[utility::conversions::to_string_t("value")]); + m_{{name}}.insert(std::pair( key, newItem )); + } + {{/items.isDateTime}} + {{/items.isString}} + {{/items.isPrimitiveType}} } - {{#items.isPrimitiveType}} - m_{{name}}.insert(std::pair( key, ModelBase::{{items.baseType}}FromJson(item[utility::conversions::to_string_t("value")]))); - {{/items.isPrimitiveType}} - {{^items.isPrimitiveType}} - {{#items.isString}} - m_{{name}}.insert(std::pair( key, ModelBase::stringFromJson(item[utility::conversions::to_string_t("value")]))); - {{/items.isString}} - {{^items.isString}} - {{#items.isDateTime}} - m_{{name}}.insert(std::pair( key, ModelBase::dateFromJson(item[utility::conversions::to_string_t("value")]))); - {{/items.isDateTime}} - {{^items.isDateTime}} - if(item.is_null()) - { - m_{{name}}.insert(std::pair( key, {{{items.datatype}}}(nullptr) )); - } - else - { - {{{items.datatype}}} newItem({{{items.defaultValue}}}); - newItem->fromJson(item[utility::conversions::to_string_t("value")]); - m_{{name}}.insert(std::pair( key, newItem )); - } - {{/items.isDateTime}} - {{/items.isString}} - {{/items.isPrimitiveType}} } {{^required}} } @@ -242,27 +245,28 @@ void {{classname}}::fromJson(web::json::value& val) {{^required}} if(val.has_field(utility::conversions::to_string_t("{{baseName}}"))) { - {{#isString}} - {{setter}}(ModelBase::stringFromJson(val[utility::conversions::to_string_t("{{baseName}}")])); - {{/isString}} - {{#isByteArray}} - {{setter}}(ModelBase::stringFromJson(val[utility::conversions::to_string_t("{{baseName}}")])); - {{/isByteArray}} - {{^isString}} - {{#isDateTime}} - {{setter}}(ModelBase::dateFromJson(val[utility::conversions::to_string_t("{{baseName}}")])); - {{/isDateTime}} - {{^isDateTime}} - {{^isByteArray}} - if(!val[utility::conversions::to_string_t("{{baseName}}")].is_null()) + web::json::value& fieldValue = val[utility::conversions::to_string_t("{{baseName}}")]; + if(!fieldValue.is_null()) { + {{#isString}} + {{setter}}(ModelBase::stringFromJson(fieldValue)); + {{/isString}} + {{#isByteArray}} + {{setter}}(ModelBase::stringFromJson(fieldValue)); + {{/isByteArray}} + {{^isString}} + {{#isDateTime}} + {{setter}}(ModelBase::dateFromJson(fieldValue)); + {{/isDateTime}} + {{^isDateTime}} + {{^isByteArray}} {{{dataType}}} newItem({{{defaultValue}}}); - newItem->fromJson(val[utility::conversions::to_string_t("{{baseName}}")]); + newItem->fromJson(fieldValue); {{setter}}( newItem ); + {{/isByteArray}} + {{/isDateTime}} + {{/isString}} } - {{/isByteArray}} - {{/isDateTime}} - {{/isString}} } {{/required}} {{#required}} diff --git a/modules/openapi-generator/src/main/resources/cpp-restbed-server/api-source.mustache b/modules/openapi-generator/src/main/resources/cpp-restbed-server/api-source.mustache index 35196da731d..ccd81ee02ef 100644 --- a/modules/openapi-generator/src/main/resources/cpp-restbed-server/api-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-restbed-server/api-source.mustache @@ -75,7 +75,7 @@ void {{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource::{{httpMet // Getting the path params {{#pathParams}} {{#isPrimitiveType}} - const {{{dataType}}} {{{paramName}}} = request->get_path_parameter("{{paramName}}", {{#isString}}""{{/isString}}{{#isInteger}}0{{/isInteger}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0f{{/isFloat}}{{#isDouble}}0.0{{/isDouble}}); + const {{{dataType}}} {{{paramName}}} = request->get_path_parameter("{{paramName}}", {{{defaultValue}}}); {{/isPrimitiveType}} {{/pathParams}} {{/hasPathParams}} @@ -84,7 +84,7 @@ void {{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource::{{httpMet // Getting the query params {{#queryParams}} {{#isPrimitiveType}} - const {{{dataType}}} {{{paramName}}} = request->get_query_parameter("{{paramName}}", {{#isString}}""{{/isString}}{{#isInteger}}0{{/isInteger}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0f{{/isFloat}}{{#isDouble}}0.0{{/isDouble}}); + const {{{dataType}}} {{{paramName}}} = request->get_query_parameter("{{paramName}}", {{{defaultValue}}}); {{/isPrimitiveType}} {{/queryParams}} {{/hasQueryParams}} @@ -93,7 +93,7 @@ void {{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource::{{httpMet // Getting the headers {{#headerParams}} {{#isPrimitiveType}} - const {{{dataType}}} {{{paramName}}} = request->get_header("{{paramName}}", {{#isString}}""{{/isString}}{{#isInteger}}0{{/isInteger}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0f{{/isFloat}}{{#isDouble}}0.0{{/isDouble}}); + const {{{dataType}}} {{{paramName}}} = request->get_header("{{paramName}}", {{{defaultValue}}}); {{/isPrimitiveType}} {{/headerParams}} {{/hasHeaderParams}} @@ -140,7 +140,7 @@ void {{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource::{{httpMet // Getting the path params {{#pathParams}} {{#isPrimitiveType}} - const {{dataType}} {{paramName}} = request->get_path_parameter("{{paramName}}", {{#isString}}""{{/isString}}{{#isInteger}}0{{/isInteger}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0f{{/isFloat}}{{#isDouble}}0.0{{/isDouble}}); + const {{{dataType}}} {{{paramName}}} = request->get_path_parameter("{{paramName}}", {{{defaultValue}}}); {{/isPrimitiveType}} {{/pathParams}} {{/hasPathParams}} @@ -149,16 +149,16 @@ void {{classname}}{{vendorExtensions.x-codegen-resourceName}}Resource::{{httpMet // Getting the query params {{#queryParams}} {{#isPrimitiveType}} - const {{dataType}} {{paramName}} = request->get_query_parameter("{{paramName}}", {{#isString}}""{{/isString}}{{#isInteger}}0{{/isInteger}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0f{{/isFloat}}{{#isDouble}}0.0{{/isDouble}}); + const {{{dataType}}} {{{paramName}}} = request->get_query_parameter("{{paramName}}", {{{defaultValue}}}); {{/isPrimitiveType}} {{/queryParams}} {{/hasQueryParams}} - + {{#hasHeaderParams}} // Getting the headers {{#headerParams}} {{#isPrimitiveType}} - const {{dataType}} {{paramName}} = request->get_header("{{paramName}}", {{#isString}}""{{/isString}}{{#isInteger}}0{{/isInteger}}{{#isLong}}0L{{/isLong}}{{#isFloat}}0.0f{{/isFloat}}{{#isDouble}}0.0{{/isDouble}}); + const {{{dataType}}} {{{paramName}}} = request->get_header("{{paramName}}", {{{defaultValue}}}); {{/isPrimitiveType}} {{/headerParams}} {{/hasHeaderParams}} diff --git a/modules/openapi-generator/src/main/resources/csharp/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/csharp/modelGeneric.mustache index 89d35b73ec0..c547d137e18 100644 --- a/modules/openapi-generator/src/main/resources/csharp/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/csharp/modelGeneric.mustache @@ -217,7 +217,7 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; {{/generatePropertyChanged}} {{#validatable}} -{{#discriminator}} +{{#hasChildren}} /// /// To validate all properties of the instance /// @@ -235,8 +235,8 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; /// Validation Result protected IEnumerable BaseValidate(ValidationContext validationContext) { -{{/discriminator}} -{{^discriminator}} +{{/hasChildren}} +{{^hasChildren}} /// /// To validate all properties of the instance /// @@ -244,11 +244,11 @@ this.{{name}} = {{#lambda.camelcase_param}}{{name}}{{/lambda.camelcase_param}}; /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { -{{/discriminator}} +{{/hasChildren}} {{#parent}} {{^isArrayModel}} {{^isMapModel}} - foreach(var x in BaseValidate(validationContext)) yield return x; + foreach(var x in base.BaseValidate(validationContext)) yield return x; {{/isMapModel}} {{/isArrayModel}} {{/parent}} diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/README.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/README.mustache new file mode 100644 index 00000000000..f3e63b485e1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/README.mustache @@ -0,0 +1,142 @@ +# {{pubName}} +{{#appDescription}} +{{{appDescription}}} +{{/appDescription}} + +This Dart package is automatically generated by the [Open API Codegen](https://github.com/OpenAPITools/openapi-generator) project: + +- API version: {{appVersion}} +{{#artifactVersion}} +- Package version: {{artifactVersion}} +{{/artifactVersion}} +{{^hideGenerationTimestamp}} +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} +- Build package: {{generatorClass}} +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +## Requirements + +Dart 2 or later OR Flutter 0.7.0 or later. + +Once your code is generated, you need to run the build_runner command to let Jaguar implement your API: + +```sh +flutter packages pub run build_runner build +or +pub run build_runner build +``` + +## Installation & Usage + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +``` +name: {{pubName}} +version: {{pubVersion}} +description: {{pubDescription}} +dependencies: + {{pubName}}: + git: https://github.com/{{gitUserId}}/{{gitRepoId}}.git + version: 'any' +``` + +### Local +To use the package in your local drive, please include the following in pubspec.yaml +``` +dependencies: + {{pubName}}: + path: /path/to/{{pubName}} +``` + +## Tests + +TODO + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:{{pubName}}/api.dart'; +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +{{#hasAuthMethods}} +{{#authMethods}} +{{#isBasic}} +// TODO Configure HTTP basic authorization: {{{name}}} +//{{pubName}}.api.Configuration.username = 'YOUR_USERNAME'; +//{{pubName}}.api.Configuration.password = 'YOUR_PASSWORD'; +{{/isBasic}} +{{#isApiKey}} +// TODO Configure API key authorization: {{{name}}} +//{{pubName}}.api.Configuration.apiKey{'{{{keyParamName}}}'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//{{pubName}}.api.Configuration.apiKeyPrefix{'{{{keyParamName}}}'} = "Bearer"; +{{/isApiKey}} +{{#isOAuth}} +// TODO Configure OAuth2 access token for authorization: {{{name}}} +//{{pubName}}.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +{{/isOAuth}} +{{/authMethods}} +{{/hasAuthMethods}} + +final jaguarApiGen = JaguarApiGen(); +var api_instance = jaguarApiGen.get{{classname}}(); +{{#allParams}} +var {{paramName}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}}; // {{{dataType}}} | {{{description}}} +{{/allParams}} + +try { + {{#returnType}}var result = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}} + print(result); + {{/returnType}} +} catch (e) { + print("Exception when calling {{classname}}->{{operationId}}: $e\n"); +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation For Models + +{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md) +{{/model}}{{/models}} + +## Documentation For Authorization + +{{^authMethods}} All endpoints do not require authorization. +{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} +{{#authMethods}}## {{{name}}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{{keyParamName}}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasic}}- **Type**: HTTP basic authentication +{{/isBasic}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{{flow}}} +- **Authorization URL**: {{{authorizationUrl}}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - **{{{scope}}}**: {{{description}}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + +## Author + +{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} +{{/hasMore}}{{/apis}}{{/apiInfo}} + diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/analysis_options.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/analysis_options.mustache new file mode 100644 index 00000000000..518eb901a6f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/analysis_options.mustache @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/api.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/api.mustache new file mode 100644 index 00000000000..762cb6a0fb1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/api.mustache @@ -0,0 +1,53 @@ +import 'package:jaguar_retrofit/annotations/annotations.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; +import 'package:jaguar_serializer/jaguar_serializer.dart'; +import 'package:jaguar_serializer/src/repo/repo.dart'; +import 'dart:async'; + +{{#operations}} +{{#modelImports}}import 'package:{{pubName}}/model/{{.}}.dart'; +{{/modelImports}} + + +part '{{classFilename}}.jretro.dart'; + +@GenApiClient() +class {{classname}} extends _${{classname}}Client implements ApiClient { + final Route base; + final SerializerRepo serializers; + + {{classname}}({this.base, this.serializers}); + + {{#operation}} + /// {{summary}} + /// + /// {{notes}} + @{{httpMethod}}Req(path: "{{path}}"{{#hasAuthMethods}}, metadata: {"auth": [{{#authMethods}} {"type": "{{type}}", "name": "{{name}}"{{#isApiKey}}, "keyName": "{{keyParamName}}", "where": "{{#isKeyInQuery}}query{{/isKeyInQuery}}{{#isKeyInHeader}}header{{/isKeyInHeader}}"{{/isApiKey}} }{{#hasMore}}, {{/hasMore}}{{/authMethods}}]}{{/hasAuthMethods}}) + Future<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}void{{/returnType}}> {{nickname}}( + {{#pathParams}} + @PathParam("{{baseName}}") {{dataType}} {{paramName}}{{#hasMore}}, {{/hasMore}} + {{/pathParams}} + {{#headerParams}} + {{#-first}}{{#hasPathParams}},{{/hasPathParams}}{{/-first}} + @Header("{{baseName}}") {{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}} + {{/headerParams}} + {{#queryParams}} + {{#-first}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/-first}} + @QueryParam("{{baseName}}") {{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}} + {{/queryParams}} + {{#vendorExtensions}} + {{#formParams}} + {{#-first}}{{#hasQueryParams}},{{/hasQueryParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{/hasQueryParams}}{{^hasQueryParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/hasQueryParams}}{{/-first}} + {{#isJson}}@AsJson() {{/isJson}}{{#isForm}}@AsFormField() {{/isForm}}{{#isMultipart}}@AsMultipartField() {{/isMultipart}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}} + {{/formParams}} + {{#bodyParam}} + {{#hasFormParams}},{{/hasFormParams}}{{^hasFormParams}}{{#hasQueryParams}},{{/hasQueryParams}}{{/hasFormParams}}{{^hasFormParams}}{{^hasQueryParams}}{{#hasHeaderParams}},{{/hasHeaderParams}}{{/hasQueryParams}}{{/hasFormParams}}{{^hasFormParams}}{{^hasQueryParams}}{{^hasHeaderParams}}{{#hasPathParams}},{{/hasPathParams}}{{/hasHeaderParams}}{{/hasQueryParams}}{{/hasFormParams}} + {{#isJson}}@AsJson() {{/isJson}}{{#isForm}}@AsForm() {{/isForm}}{{#isMultipart}}@AsMultipart() {{/isMultipart}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}} + {{/bodyParam}} + {{/vendorExtensions}} + ); + + {{/operation}} + +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/api_doc.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/api_doc.mustache new file mode 100644 index 00000000000..e723114f18c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/api_doc.mustache @@ -0,0 +1,86 @@ +# {{pubName}}.api.{{classname}}{{#description}} +{{description}}{{/description}} + +## Load the API package +```dart +import 'package:{{pubName}}/api.dart'; +``` + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} +# **{{{operationId}}}** +> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + +{{{summary}}}{{#notes}} + +{{{notes}}}{{/notes}} + +### Example +```dart +import 'package:{{pubName}}/api.dart'; +{{#hasAuthMethods}} +{{#authMethods}} +{{#isBasic}} +// TODO Configure HTTP basic authorization: {{{name}}} +//{{pubName}}.api.Configuration.username = 'YOUR_USERNAME'; +//{{pubName}}.api.Configuration.password = 'YOUR_PASSWORD'; +{{/isBasic}} +{{#isApiKey}} +// TODO Configure API key authorization: {{{name}}} +//{{pubName}}.api.Configuration.apiKey{'{{{keyParamName}}}'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//{{pubName}}.api.Configuration.apiKeyPrefix{'{{{keyParamName}}}'} = "Bearer"; +{{/isApiKey}} +{{#isOAuth}} +// TODO Configure OAuth2 access token for authorization: {{{name}}} +//{{pubName}}.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +{{/isOAuth}} +{{/authMethods}} +{{/hasAuthMethods}} + +var api_instance = new {{classname}}(); +{{#allParams}} +var {{paramName}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}}; // {{{dataType}}} | {{{description}}} +{{/allParams}} + +try { + {{#returnType}}var result = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}} + print(result); + {{/returnType}} +} catch (e) { + print("Exception when calling {{classname}}->{{operationId}}: $e\n"); +} +``` + +### Parameters +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + + - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +{{/operation}} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/apilib.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/apilib.mustache new file mode 100644 index 00000000000..71cfe8618a2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/apilib.mustache @@ -0,0 +1,75 @@ +library {{pubName}}.api; + +import 'package:http/http.dart'; +import 'package:jaguar_serializer/jaguar_serializer.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; +import 'package:{{pubName}}/auth/api_key_auth.dart'; +import 'package:{{pubName}}/auth/basic_auth.dart'; +import 'package:{{pubName}}/auth/oauth.dart'; + +{{#apiInfo}}{{#apis}}import 'package:{{pubName}}/api/{{classFilename}}.dart'; +{{/apis}}{{/apiInfo}} +{{#models}}{{#model}}import 'package:{{pubName}}/model/{{classFilename}}.dart'; +{{/model}}{{/models}} + +final jsonJaguarRepo = JsonRepo() +{{#models}}{{#model}}..add({{classname}}Serializer()) +{{/model}}{{/models}}; + +final _defaultInterceptors = [OAuthInterceptor(), BasicAuthInterceptor(), ApiKeyAuthInterceptor()]; + +class JaguarApiGen { + List interceptors; + String basePath = "{{basePath}}"; + Route _baseRoute; + + /** + * Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added) + */ + JaguarApiGen({List interceptors, bool overrideInterceptors = false, String baseUrl}) { + _baseRoute = Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient()); + if(interceptors == null) { + this.interceptors = _defaultInterceptors; + } + else if(overrideInterceptors){ + this.interceptors = interceptors; + } + else { + this.interceptors = List.from(_defaultInterceptors)..addAll(interceptors); + } + + this.interceptors.forEach((interceptor) { + _baseRoute.before(interceptor.before); + _baseRoute.after(interceptor.after); + }); + } + + void setOAuthToken(String name, String token) { + (_defaultInterceptors[0] as OAuthInterceptor).tokens[name] = token; + } + + void setBasicAuth(String name, String username, String password) { + (_defaultInterceptors[1] as BasicAuthInterceptor).authInfo[name] = BasicAuthInfo(username, password); + } + + void setApiKey(String name, String apiKey) { + (_defaultInterceptors[2] as ApiKeyAuthInterceptor).apiKeys[name] = apiKey; + } + + {{#apiInfo}}{{#apis}} + /** + * Get {{classname}} instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + {{classname}} get{{classname}}({Route base, SerializerRepo serializers}) { + if(base == null) { + base = _baseRoute; + } + if(serializers == null) { + serializers = jsonJaguarRepo; + } + return {{classname}}(base: base, serializers: serializers); + } + + {{/apis}}{{/apiInfo}} +} diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/auth/api_key_auth.mustache new file mode 100644 index 00000000000..feb0ba65712 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/auth/api_key_auth.mustache @@ -0,0 +1,33 @@ +import 'dart:async'; +import 'package:{{pubName}}/auth/auth.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + Map apiKeys = {}; + + @override + FutureOr before(RouteBase route) { + final authInfo = getAuthInfo(route, "apiKey"); + for (var info in authInfo) { + final authName = info["name"]; + final authKeyName = info["keyName"]; + final authWhere = info["where"]; + final apiKey = apiKeys[authName]; + if(apiKey != null) { + if(authWhere == 'query'){ + route.query(authKeyName, apiKey); + } + else { + route.header(authKeyName, apiKey); + } + break; + } + } + return super.before(route); + } + + @override + FutureOr after(StringResponse response) { + return Future.value(response); + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/auth/auth.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/auth/auth.mustache new file mode 100644 index 00000000000..477fbbf8374 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/auth/auth.mustache @@ -0,0 +1,23 @@ +import 'dart:async'; + +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; + +abstract class AuthInterceptor extends Interceptor { + /* + * Get auth information on given route for the given type + * Can return null if type is not present on auth data or if route doesn't need authentication + */ + List> getAuthInfo(RouteBase route, String type) { + if (route.metadataMap.containsKey("auth")) { + final auth = route.metadataMap["auth"]; + List> results = []; + for (var info in auth) { + if(info["type"] == type) { + results.add(info); + } + } + return results; + } + return []; + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/auth/basic_auth.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/auth/basic_auth.mustache new file mode 100644 index 00000000000..962be36d664 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/auth/basic_auth.mustache @@ -0,0 +1,34 @@ +import 'dart:async'; +import 'package:{{pubName}}/auth/auth.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); + +} + +class BasicAuthInterceptor extends AuthInterceptor { + Map authInfo = {}; + + @override + FutureOr before(RouteBase route) { + final metadataAuthInfo = getAuthInfo(route, "basic"); + for (var info in metadataAuthInfo) { + final authName = info["name"]; + final basicAuthInfo = authInfo[authName]; + if(basicAuthInfo != null) { + route.basicAuth(basicAuthInfo.username, basicAuthInfo.password); + break; + } + } + return super.before(route); + } + + @override + FutureOr after(StringResponse response) { + return Future.value(response); + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/auth/oauth.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/auth/oauth.mustache new file mode 100644 index 00000000000..f12a63c45b5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/auth/oauth.mustache @@ -0,0 +1,25 @@ +import 'dart:async'; +import 'package:{{pubName}}/auth/auth.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; + +class OAuthInterceptor extends AuthInterceptor { + Map tokens = {}; + + @override + FutureOr before(RouteBase route) { + final authInfo = getAuthInfo(route, "oauth"); + for (var info in authInfo) { + final token = tokens[info["name"]]; + if(token != null) { + route.header("Authorization", "Bearer ${token}"); + break; + } + } + return super.before(route); + } + + @override + FutureOr after(StringResponse response) { + return Future.value(response); + } +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/class.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/class.mustache new file mode 100644 index 00000000000..f4a1731a5f3 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/class.mustache @@ -0,0 +1,27 @@ +part '{{classFilename}}.jser.dart'; + +class {{classname}} { + {{#vars}}{{#description}} /* {{{description}}} */{{/description}} + @Alias('{{{baseName}}}') + final {{{datatype}}} {{name}}; + {{#allowableValues}}{{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{{/allowableValues}}{{/vars}} + + {{classname}}( + {{#vars}}{{^defaultValue}}{{#required}} this.{{name}}, {{/required}}{{/defaultValue}}{{/vars}} + +{{#vendorExtensions}}{{#hasVars}}{ + {{#vars}}{{^required}} this.{{name}}{{#defaultValue}} = {{{defaultValue}}}{{#hasMore}}, {{/hasMore}} {{/defaultValue}}{{/required}} + {{#required}} {{#defaultValue}}this.{{name}} = {{{defaultValue}}}{{#hasMore}}, {{/hasMore}} {{/defaultValue}}{{/required}}{{/vars}} + }{{/hasVars}}{{/vendorExtensions}} + ); + + @override + String toString() { + return '{{classname}}[{{#vars}}{{name}}=${{name}}, {{/vars}}]'; + } +} + +@GenSerializer() +class {{classname}}Serializer extends Serializer<{{classname}}> with _${{classname}}Serializer { + +} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/enum.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/enum.mustache new file mode 100644 index 00000000000..0698e149412 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/enum.mustache @@ -0,0 +1,38 @@ +part '{{classFilename}}.jser.dart'; + +@Entity() +class {{classname}} { + /// The underlying value of this enum member. + final {{dataType}} value; + + const {{classname}}._internal(this.value); + + {{#allowableValues}} + {{#enumVars}} + {{#description}} + /// {{description}} + {{/description}} + static const {{classname}} {{{name}}}} = const {{classname}}._internal({{{value}}}); + {{/enumVars}} + {{/allowableValues}} +} + +class {{classname}}TypeTransformer extends TypeTransformer<{{classname}}> { + + @override + dynamic encode({{classname}} data) { + return data.value; + } + + @override + {{classname}} decode(dynamic data) { + switch (data) { + {{#allowableValues}} + {{#enumVars}} + case {{{value}}}: return {{classname}}.{{{name}}}}; + {{/enumVars}} + {{/allowableValues}} + default: throw('Unknown enum value to decode: $data'); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/git_push.sh.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/git_push.sh.mustache new file mode 100755 index 00000000000..92d71b84970 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/git_push.sh.mustache @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="{{{gitUserId}}}" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="{{{gitRepoId}}}" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="{{{releaseNote}}}" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/gitignore.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/gitignore.mustache new file mode 100644 index 00000000000..7c280441649 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/gitignore.mustache @@ -0,0 +1,27 @@ +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/model.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/model.mustache new file mode 100644 index 00000000000..d8e5f09b73d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/model.mustache @@ -0,0 +1,9 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +{{#models}} +{{#model}} +{{#imports}}import 'package:{{pubName}}/model/{{.}}.dart'; +{{/imports}} +{{#isEnum}}{{>enum}}{{/isEnum}}{{^isEnum}}{{>class}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/object_doc.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/object_doc.mustache new file mode 100644 index 00000000000..9ad4463997b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/object_doc.mustache @@ -0,0 +1,16 @@ +{{#models}}{{#model}}# {{pubName}}.model.{{classname}} + +## Load the model package +```dart +import 'package:{{pubName}}/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{datatype}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{datatype}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{/vars}} + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/dart-jaguar/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart-jaguar/pubspec.mustache new file mode 100644 index 00000000000..30bdbdc28e5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart-jaguar/pubspec.mustache @@ -0,0 +1,12 @@ +name: {{pubName}} +version: {{pubVersion}} +description: {{pubDescription}} +environment: + sdk: ">=2.0.0 <3.0.0" +dependencies: + jaguar_retrofit: '^2.5.4' + jaguar_serializer: '^2.2.2' +dev_dependencies: + jaguar_retrofit_gen: '^2.5.2' + jaguar_serializer_cli: '^2.2.1' + build_runner: '^0.10.0' \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/dart/enum.mustache b/modules/openapi-generator/src/main/resources/dart/enum.mustache index debb73bbcec..d4a4d2b8d11 100644 --- a/modules/openapi-generator/src/main/resources/dart/enum.mustache +++ b/modules/openapi-generator/src/main/resources/dart/enum.mustache @@ -10,7 +10,7 @@ class {{classname}} { {{#description}} /// {{description}} {{/description}} - static const {{classname}} {{name}} = const {{classname}}._internal({{value}}); + static const {{classname}} {{{name}}} = const {{classname}}._internal({{{value}}}); {{/enumVars}} {{/allowableValues}} } @@ -27,7 +27,7 @@ class {{classname}}TypeTransformer extends TypeTransformer<{{classname}}> { switch (data) { {{#allowableValues}} {{#enumVars}} - case {{value}}: return {{classname}}.{{name}}; + case {{{value}}}: return {{classname}}.{{{name}}}; {{/enumVars}} {{/allowableValues}} default: throw('Unknown enum value to decode: $data'); diff --git a/modules/openapi-generator/src/main/resources/dart2/README.mustache b/modules/openapi-generator/src/main/resources/dart2/README.mustache new file mode 100644 index 00000000000..1766ea72105 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/README.mustache @@ -0,0 +1,133 @@ +# {{pubName}} +{{#appDescription}} +{{{appDescription}}} +{{/appDescription}} + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: {{appVersion}} +{{#artifactVersion}} +- Package version: {{artifactVersion}} +{{/artifactVersion}} +{{^hideGenerationTimestamp}} +- Build date: {{generatedDate}} +{{/hideGenerationTimestamp}} +- Build package: {{generatorClass}} +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +## Requirements + +Dart 1.20.0 or later OR Flutter 0.0.20 or later + +## Installation & Usage + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +``` +name: {{pubName}} +version: {{pubVersion}} +description: {{pubDescription}} +dependencies: + {{pubName}}: + git: https://github.com/{{gitUserId}}/{{gitRepoId}}.git + version: 'any' +``` + +### Local +To use the package in your local drive, please include the following in pubspec.yaml +``` +dependencies: + {{pubName}}: + path: /path/to/{{pubName}} +``` + +## Tests + +TODO + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:{{pubName}}/api.dart'; +{{#apiInfo}}{{#apis}}{{#-first}}{{#operations}}{{#operation}}{{#-first}} +{{#hasAuthMethods}} +{{#authMethods}} +{{#isBasic}} +// TODO Configure HTTP basic authorization: {{{name}}} +//{{pubName}}.api.Configuration.username = 'YOUR_USERNAME'; +//{{pubName}}.api.Configuration.password = 'YOUR_PASSWORD'; +{{/isBasic}} +{{#isApiKey}} +// TODO Configure API key authorization: {{{name}}} +//{{pubName}}.api.Configuration.apiKey{'{{{keyParamName}}}'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//{{pubName}}.api.Configuration.apiKeyPrefix{'{{{keyParamName}}}'} = "Bearer"; +{{/isApiKey}} +{{#isOAuth}} +// TODO Configure OAuth2 access token for authorization: {{{name}}} +//{{pubName}}.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +{{/isOAuth}} +{{/authMethods}} +{{/hasAuthMethods}} + +var api_instance = new {{classname}}(); +{{#allParams}} +var {{paramName}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}}; // {{{dataType}}} | {{{description}}} +{{/allParams}} + +try { + {{#returnType}}var result = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}} + print(result); + {{/returnType}} +} catch (e) { + print("Exception when calling {{classname}}->{{operationId}}: $e\n"); +} +{{/-first}}{{/operation}}{{/operations}}{{/-first}}{{/apis}}{{/apiInfo}} +``` + +## Documentation for API Endpoints + +All URIs are relative to *{{basePath}}* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}}*{{classname}}* | [**{{operationId}}**]({{apiDocPath}}/{{classname}}.md#{{operationIdLowerCase}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} + +## Documentation For Models + +{{#models}}{{#model}} - [{{{classname}}}]({{modelDocPath}}/{{{classname}}}.md) +{{/model}}{{/models}} + +## Documentation For Authorization + +{{^authMethods}} All endpoints do not require authorization. +{{/authMethods}}{{#authMethods}}{{#last}} Authentication schemes defined for the API:{{/last}}{{/authMethods}} +{{#authMethods}}## {{{name}}} + +{{#isApiKey}}- **Type**: API key +- **API key parameter name**: {{{keyParamName}}} +- **Location**: {{#isKeyInQuery}}URL query string{{/isKeyInQuery}}{{#isKeyInHeader}}HTTP header{{/isKeyInHeader}} +{{/isApiKey}} +{{#isBasic}}- **Type**: HTTP basic authentication +{{/isBasic}} +{{#isOAuth}}- **Type**: OAuth +- **Flow**: {{{flow}}} +- **Authorization URL**: {{{authorizationUrl}}} +- **Scopes**: {{^scopes}}N/A{{/scopes}} +{{#scopes}} - **{{{scope}}}**: {{{description}}} +{{/scopes}} +{{/isOAuth}} + +{{/authMethods}} + +## Author + +{{#apiInfo}}{{#apis}}{{^hasMore}}{{infoEmail}} +{{/hasMore}}{{/apis}}{{/apiInfo}} + diff --git a/modules/openapi-generator/src/main/resources/dart2/api.mustache b/modules/openapi-generator/src/main/resources/dart2/api.mustache new file mode 100644 index 00000000000..76797fa2ddc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/api.mustache @@ -0,0 +1,117 @@ +part of {{pubName}}.api; + +{{#operations}} + + +class {{classname}} { + final ApiClient apiClient; + + {{classname}}([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + {{#operation}} + /// {{summary}} + /// + /// {{notes}} + {{#returnType}}Future<{{{returnType}}}> {{/returnType}}{{^returnType}}Future {{/returnType}}{{nickname}}({{#allParams}}{{#required}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}{ {{#allParams}}{{^required}}{{{dataType}}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}} }{{/hasOptionalParams}}) async { + Object postBody{{#bodyParam}} = {{paramName}}{{/bodyParam}}; + + // verify required params are set + {{#allParams}} + {{#required}} + if({{paramName}} == null) { + throw new ApiException(400, "Missing required param: {{paramName}}"); + } + {{/required}} + {{/allParams}} + + // create path and map variables + String path = "{{{path}}}".replaceAll("{format}","json"){{#pathParams}}.replaceAll("{" + "{{baseName}}" + "}", {{{paramName}}}.toString()){{/pathParams}}; + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + {{#queryParams}} + {{^required}} + if({{paramName}} != null) { + {{/required}} + queryParams.addAll(_convertParametersForCollectionFormat("{{collectionFormat}}", "{{baseName}}", {{paramName}})); + {{^required}} + } + {{/required}} + {{/queryParams}} + {{#headerParams}} + headerParams["{{baseName}}"] = {{paramName}}; + {{/headerParams}} + + List contentTypes = [{{#consumes}}"{{{mediaType}}}"{{#hasMore}},{{/hasMore}}{{/consumes}}]; + + String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = [{{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}}]; + + if(contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + {{#formParams}} + {{^isFile}} + if ({{paramName}} != null) { + hasFields = true; + mp.fields['{{baseName}}'] = parameterToString({{paramName}}); + } + {{/isFile}} + {{#isFile}} + if ({{paramName}} != null) { + hasFields = true; + mp.fields['{{baseName}}'] = {{paramName}}.field; + mp.files.add({{paramName}}); + } + {{/isFile}} + {{/formParams}} + if(hasFields) + postBody = mp; + } + else { + {{#formParams}} + {{^isFile}} + if ({{paramName}} != null) + formParams['{{baseName}}'] = parameterToString({{paramName}}); + {{/isFile}} + {{/formParams}} + } + + var response = await apiClient.invokeAPI(path, + '{{httpMethod}}', + queryParams, + postBody, + headerParams, + formParams, + contentType, + authNames); + + if(response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if(response.body != null) { + {{#isListContainer}} + {{#returnType}} + return (apiClient.deserialize(response.body, '{{{returnType}}}') as List).map((item) => item as {{returnBaseType}}).toList(); + {{/returnType}} + {{/isListContainer}} + {{^isListContainer}} + {{#isMapContainer}} + {{#returnType}} + return new {{{returnType}}}.from(apiClient.deserialize(response.body, '{{{returnType}}}')); + {{/returnType}}; + {{/isMapContainer}} + {{^isMapContainer}} + {{#returnType}} + return apiClient.deserialize(response.body, '{{{returnType}}}') as {{{returnType}}}; + {{/returnType}} + {{/isMapContainer}} + {{/isListContainer}} + } else { + return{{#returnType}} null{{/returnType}}; + } + } + {{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart2/api_client.mustache b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache new file mode 100644 index 00000000000..a3cd3c2463b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/api_client.mustache @@ -0,0 +1,164 @@ +part of {{pubName}}.api; + +class QueryParam { + String name; + String value; + + QueryParam(this.name, this.value); +} + +class ApiClient { + + String basePath; + var client = {{#browserClient}}Browser{{/browserClient}}Client(); + + Map _defaultHeaderMap = {}; + Map _authentications = {}; + + final _regList = RegExp(r'^List<(.*)>$'); + final _regMap = RegExp(r'^Map$'); + + ApiClient({this.basePath: "{{{basePath}}}"}) { + // Setup authentications (key: authentication name, value: authentication).{{#authMethods}}{{#isBasic}} + _authentications['{{name}}'] = HttpBasicAuth();{{/isBasic}}{{#isApiKey}} + _authentications['{{name}}'] = ApiKeyAuth({{#isKeyInHeader}}"header"{{/isKeyInHeader}}{{^isKeyInHeader}}"query"{{/isKeyInHeader}}, "{{keyParamName}}");{{/isApiKey}}{{#isOAuth}} + _authentications['{{name}}'] = OAuth();{{/isOAuth}}{{/authMethods}} + } + + void addDefaultHeader(String key, String value) { + _defaultHeaderMap[key] = value; + } + + dynamic _deserialize(dynamic value, String targetType) { + try { + switch (targetType) { + case 'String': + return '$value'; + case 'int': + return value is int ? value : int.parse('$value'); + case 'bool': + return value is bool ? value : '$value'.toLowerCase() == 'true'; + case 'double': + return value is double ? value : double.parse('$value'); + {{#models}} + {{#model}} + case '{{classname}}': + {{#isEnum}} + // Enclose the value in a list so that Dartson can use a transformer + // to decode it. + final listValue = [value]; + final List listResult = dson.map(listValue, []); + return listResult[0]; + {{/isEnum}} + {{^isEnum}} + return {{classname}}.fromJson(value); + {{/isEnum}} + {{/model}} + {{/models}} + default: + { + Match match; + if (value is List && + (match = _regList.firstMatch(targetType)) != null) { + var newTargetType = match[1]; + return value.map((v) => _deserialize(v, newTargetType)).toList(); + } else if (value is Map && + (match = _regMap.firstMatch(targetType)) != null) { + var newTargetType = match[1]; + return Map.fromIterables(value.keys, + value.values.map((v) => _deserialize(v, newTargetType))); + } + } + } + } on Exception catch (e, stack) { + throw ApiException.withInner(500, 'Exception during deserialization.', e, stack); + } + throw ApiException(500, 'Could not find a suitable class for deserialization'); + } + + dynamic deserialize(String json, String targetType) { + // Remove all spaces. Necessary for reg expressions as well. + targetType = targetType.replaceAll(' ', ''); + + if (targetType == 'String') return json; + + var decodedJson = jsonDecode(json); + return _deserialize(decodedJson, targetType); + } + + String serialize(Object obj) { + String serialized = ''; + if (obj == null) { + serialized = ''; + } else { + serialized = json.encode(obj); + } + return serialized; + } + + // We don't use a Map for queryParams. + // If collectionFormat is 'multi' a key might appear multiple times. + Future invokeAPI(String path, + String method, + Iterable queryParams, + Object body, + Map headerParams, + Map formParams, + String contentType, + List authNames) async { + + _updateParamsForAuth(authNames, queryParams, headerParams); + + var ps = queryParams.where((p) => p.value != null).map((p) => '${p.name}=${p.value}'); + String queryString = ps.isNotEmpty ? + '?' + ps.join('&') : + ''; + + String url = basePath + path + queryString; + + headerParams.addAll(_defaultHeaderMap); + headerParams['Content-Type'] = contentType; + + if(body is MultipartRequest) { + var request = MultipartRequest(method, Uri.parse(url)); + request.fields.addAll(body.fields); + request.files.addAll(body.files); + request.headers.addAll(body.headers); + request.headers.addAll(headerParams); + var response = await client.send(request); + return Response.fromStream(response); + } else { + var msgBody = contentType == "application/x-www-form-urlencoded" ? formParams : serialize(body); + switch(method) { + case "POST": + return client.post(url, headers: headerParams, body: msgBody); + case "PUT": + return client.put(url, headers: headerParams, body: msgBody); + case "DELETE": + return client.delete(url, headers: headerParams); + case "PATCH": + return client.patch(url, headers: headerParams, body: msgBody); + default: + return client.get(url, headers: headerParams); + } + } + } + + /// Update query and header parameters based on authentication settings. + /// @param authNames The authentications to apply + void _updateParamsForAuth(List authNames, List queryParams, Map headerParams) { + authNames.forEach((authName) { + Authentication auth = _authentications[authName]; + if (auth == null) throw ArgumentError("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams); + }); + } + + void setAccessToken(String accessToken) { + _authentications.forEach((key, auth) { + if (auth is OAuth) { + auth.setAccessToken(accessToken); + } + }); + } +} diff --git a/modules/openapi-generator/src/main/resources/dart2/api_doc.mustache b/modules/openapi-generator/src/main/resources/dart2/api_doc.mustache new file mode 100644 index 00000000000..c7c10a817a1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/api_doc.mustache @@ -0,0 +1,86 @@ +# {{pubName}}.api.{{classname}}{{#description}} +{{description}}{{/description}} + +## Load the API package +```dart +import 'package:{{pubName}}/api.dart'; +``` + +All URIs are relative to *{{basePath}}* + +Method | HTTP request | Description +------------- | ------------- | ------------- +{{#operations}}{{#operation}}[**{{operationId}}**]({{classname}}.md#{{operationId}}) | **{{httpMethod}}** {{path}} | {{#summary}}{{summary}}{{/summary}} +{{/operation}}{{/operations}} + +{{#operations}} +{{#operation}} +# **{{{operationId}}}** +> {{#returnType}}{{{returnType}}} {{/returnType}}{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) + +{{{summary}}}{{#notes}} + +{{{notes}}}{{/notes}} + +### Example +```dart +import 'package:{{pubName}}/api.dart'; +{{#hasAuthMethods}} +{{#authMethods}} +{{#isBasic}} +// TODO Configure HTTP basic authorization: {{{name}}} +//{{pubName}}.api.Configuration.username = 'YOUR_USERNAME'; +//{{pubName}}.api.Configuration.password = 'YOUR_PASSWORD'; +{{/isBasic}} +{{#isApiKey}} +// TODO Configure API key authorization: {{{name}}} +//{{pubName}}.api.Configuration.apiKey{'{{{keyParamName}}}'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//{{pubName}}.api.Configuration.apiKeyPrefix{'{{{keyParamName}}}'} = "Bearer"; +{{/isApiKey}} +{{#isOAuth}} +// TODO Configure OAuth2 access token for authorization: {{{name}}} +//{{pubName}}.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; +{{/isOAuth}} +{{/authMethods}} +{{/hasAuthMethods}} + +var api_instance = new {{classname}}(); +{{#allParams}} +var {{paramName}} = {{#isListContainer}}[{{/isListContainer}}{{#isBodyParam}}new {{dataType}}(){{/isBodyParam}}{{^isBodyParam}}{{{example}}}{{/isBodyParam}}{{#isListContainer}}]{{/isListContainer}}; // {{{dataType}}} | {{{description}}} +{{/allParams}} + +try { + {{#returnType}}var result = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}); + {{#returnType}} + print(result); + {{/returnType}} +} catch (e) { + print("Exception when calling {{classname}}->{{operationId}}: $e\n"); +} +``` + +### Parameters +{{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} +Name | Type | Description | Notes +------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}} +{{#allParams}} **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{description}} | {{^required}}[optional] {{/required}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{/allParams}} + +### Return type + +{{#returnType}}{{#returnTypeIsPrimitive}}**{{{returnType}}}**{{/returnTypeIsPrimitive}}{{^returnTypeIsPrimitive}}[**{{{returnType}}}**]({{returnBaseType}}.md){{/returnTypeIsPrimitive}}{{/returnType}}{{^returnType}}void (empty response body){{/returnType}} + +### Authorization + +{{^authMethods}}No authorization required{{/authMethods}}{{#authMethods}}[{{{name}}}](../README.md#{{{name}}}){{^-last}}, {{/-last}}{{/authMethods}} + +### HTTP request headers + + - **Content-Type**: {{#consumes}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/consumes}}{{^consumes}}Not defined{{/consumes}} + - **Accept**: {{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}{{^produces}}Not defined{{/produces}} + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +{{/operation}} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/dart2/api_exception.mustache b/modules/openapi-generator/src/main/resources/dart2/api_exception.mustache new file mode 100644 index 00000000000..5964f88f93d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/api_exception.mustache @@ -0,0 +1,23 @@ +part of {{pubName}}.api; + +class ApiException implements Exception { + int code = 0; + String message; + Exception innerException; + StackTrace stackTrace; + + ApiException(this.code, this.message); + + ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); + + String toString() { + if (message == null) return "ApiException"; + + if (innerException == null) { + return "ApiException $code: $message"; + } + + return "ApiException $code: $message (Inner exception: $innerException)\n\n" + + stackTrace.toString(); + } +} diff --git a/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache b/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache new file mode 100644 index 00000000000..1e554bede4b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/api_helper.mustache @@ -0,0 +1,52 @@ +part of {{pubName}}.api; + +const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; + +// port from Java version +Iterable _convertParametersForCollectionFormat( + String collectionFormat, String name, dynamic value) { + var params = []; + + // preconditions + if (name == null || name.isEmpty || value == null) return params; + + if (value is! List) { + params.add(QueryParam(name, parameterToString(value))); + return params; + } + + List values = value as List; + + // get the collection format + collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) + ? "csv" + : collectionFormat; // default: csv + + if (collectionFormat == "multi") { + return values.map((v) => QueryParam(name, parameterToString(v))); + } + + String delimiter = _delimiters[collectionFormat] ?? ","; + + params.add(QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter))); + return params; +} + +/// Format the given parameter object into string. +String parameterToString(dynamic value) { + if (value == null) { + return ''; + } else if (value is DateTime) { + return value.toUtc().toIso8601String(); + {{#models}} + {{#model}} + {{#isEnum}} + } else if (value is {{classname}}) { + return {{classname}}TypeTransformer().encode(value).toString(); + {{/isEnum}} + {{/model}} + {{/models}} + } else { + return value.toString(); + } +} diff --git a/modules/openapi-generator/src/main/resources/dart2/apilib.mustache b/modules/openapi-generator/src/main/resources/dart2/apilib.mustache new file mode 100644 index 00000000000..577330e54cb --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/apilib.mustache @@ -0,0 +1,21 @@ +library {{pubName}}.api; + +import 'dart:async'; +import 'dart:convert';{{#browserClient}} +import 'package:http/browser_client.dart';{{/browserClient}} +import 'package:http/http.dart'; + +part 'api_client.dart'; +part 'api_helper.dart'; +part 'api_exception.dart'; +part 'auth/authentication.dart'; +part 'auth/api_key_auth.dart'; +part 'auth/oauth.dart'; +part 'auth/http_basic_auth.dart'; + +{{#apiInfo}}{{#apis}}part 'api/{{classFilename}}.dart'; +{{/apis}}{{/apiInfo}} +{{#models}}{{#model}}part 'model/{{classFilename}}.dart'; +{{/model}}{{/models}} + +ApiClient defaultApiClient = ApiClient(); diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache new file mode 100644 index 00000000000..1e62a7902e4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/auth/api_key_auth.mustache @@ -0,0 +1,27 @@ +part of {{pubName}}.api; + +class ApiKeyAuth implements Authentication { + + final String location; + final String paramName; + String apiKey; + String apiKeyPrefix; + + ApiKeyAuth(this.location, this.paramName); + + @override + void applyToParams(List queryParams, Map headerParams) { + String value; + if (apiKeyPrefix != null) { + value = '$apiKeyPrefix $apiKey'; + } else { + value = apiKey; + } + + if (location == 'query' && value != null) { + queryParams.add(QueryParam(paramName, value)); + } else if (location == 'header' && value != null) { + headerParams[paramName] = value; + } + } +} diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache new file mode 100644 index 00000000000..00bbbf09746 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/auth/authentication.mustache @@ -0,0 +1,7 @@ +part of {{pubName}}.api; + +abstract class Authentication { + + /// Apply authentication settings to header and query params. + void applyToParams(List queryParams, Map headerParams); +} diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache new file mode 100644 index 00000000000..89b3926ed79 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/auth/http_basic_auth.mustache @@ -0,0 +1,14 @@ +part of {{pubName}}.api; + +class HttpBasicAuth implements Authentication { + + String username; + String password; + + @override + void applyToParams(List queryParams, Map headerParams) { + String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + headerParams["Authorization"] = "Basic " + base64.encode(utf8.encode(str)); + } + +} diff --git a/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache b/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache new file mode 100644 index 00000000000..07a25e5f6dc --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/auth/oauth.mustache @@ -0,0 +1,18 @@ +part of {{pubName}}.api; + +class OAuth implements Authentication { + String accessToken; + + OAuth({this.accessToken}); + + @override + void applyToParams(List queryParams, Map headerParams) { + if (accessToken != null) { + headerParams["Authorization"] = "Bearer " + accessToken; + } + } + + void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } +} diff --git a/modules/openapi-generator/src/main/resources/dart2/class.mustache b/modules/openapi-generator/src/main/resources/dart2/class.mustache new file mode 100644 index 00000000000..b25f3d98a0a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/class.mustache @@ -0,0 +1,82 @@ +class {{classname}} { + {{#vars}} + {{#description}}/* {{{description}}} */{{/description}} + {{{dataType}}} {{name}} = {{{defaultValue}}}; + {{#allowableValues}} + {{#min}} // range from {{min}} to {{max}}{{/min}}//{{^min}}enum {{name}}Enum { {{#values}} {{.}}, {{/values}} };{{/min}}{ + {{/allowableValues}} + {{/vars}} + {{classname}}(); + + @override + String toString() { + return '{{classname}}[{{#vars}}{{name}}=${{name}}, {{/vars}}]'; + } + + {{classname}}.fromJson(Map json) { + if (json == null) return; + {{#vars}} + {{#isDateTime}} + {{name}} = json['{{baseName}}'] == null ? null : DateTime.parse(json['{{baseName}}']); + {{/isDateTime}} + {{#isDate}} + {{name}} = json['{{baseName}}'] == null ? null : DateTime.parse(json['{{baseName}}']); + {{/isDate}} + {{^isDateTime}} + {{^isDate}} + {{#complexType}} + {{#isListContainer}} + {{name}} = {{complexType}}.listFromJson(json['{{baseName}}']); + {{/isListContainer}} + {{^isListContainer}} + {{#isMapContainer}} + {{name}} = {{complexType}}.mapFromJson(json['{{baseName}}']); + {{/isMapContainer}} + {{^isMapContainer}} + {{name}} = new {{complexType}}.fromJson(json['{{baseName}}']); + {{/isMapContainer}} + {{/isListContainer}} + {{/complexType}} + {{^complexType}} + {{#isListContainer}} + {{name}} = ((json['{{baseName}}'] ?? []) as List).map((item) => item as {{items.datatype}}).toList(); + {{/isListContainer}} + {{^isListContainer}} + {{name}} = json['{{baseName}}']; + {{/isListContainer}} + {{/complexType}} + {{/isDate}} + {{/isDateTime}} + {{/vars}} + } + + Map toJson() { + return { + {{#vars}} + {{#isDateTime}} + '{{baseName}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}} + {{/isDateTime}} + {{#isDate}} + '{{baseName}}': {{name}} == null ? '' : {{name}}.toUtc().toIso8601String(){{^-last}},{{/-last}} + {{/isDate}} + {{^isDateTime}} + {{^isDate}} + '{{baseName}}': {{name}}{{^-last}},{{/-last}} + {{/isDate}} + {{/isDateTime}} + {{/vars}} + }; + } + + static List<{{classname}}> listFromJson(List json) { + return json == null ? new List<{{classname}}>() : json.map((value) => new {{classname}}.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach((String key, dynamic value) => map[key] = new {{classname}}.fromJson(value)); + } + return map; + } +} diff --git a/modules/openapi-generator/src/main/resources/dart2/enum.mustache b/modules/openapi-generator/src/main/resources/dart2/enum.mustache new file mode 100644 index 00000000000..d4a4d2b8d11 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/enum.mustache @@ -0,0 +1,36 @@ +@Entity() +class {{classname}} { + /// The underlying value of this enum member. + final {{dataType}} value; + + const {{classname}}._internal(this.value); + + {{#allowableValues}} + {{#enumVars}} + {{#description}} + /// {{description}} + {{/description}} + static const {{classname}} {{{name}}} = const {{classname}}._internal({{{value}}}); + {{/enumVars}} + {{/allowableValues}} +} + +class {{classname}}TypeTransformer extends TypeTransformer<{{classname}}> { + + @override + dynamic encode({{classname}} data) { + return data.value; + } + + @override + {{classname}} decode(dynamic data) { + switch (data) { + {{#allowableValues}} + {{#enumVars}} + case {{{value}}}: return {{classname}}.{{{name}}}; + {{/enumVars}} + {{/allowableValues}} + default: throw('Unknown enum value to decode: $data'); + } + } +} diff --git a/modules/openapi-generator/src/main/resources/dart2/git_push.sh.mustache b/modules/openapi-generator/src/main/resources/dart2/git_push.sh.mustache new file mode 100755 index 00000000000..8a32e53995d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/git_push.sh.mustache @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="{{{gitUserId}}}" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="{{{gitRepoId}}}" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="{{{releaseNote}}}" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/modules/openapi-generator/src/main/resources/dart2/gitignore.mustache b/modules/openapi-generator/src/main/resources/dart2/gitignore.mustache new file mode 100644 index 00000000000..7c280441649 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/gitignore.mustache @@ -0,0 +1,27 @@ +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock diff --git a/modules/openapi-generator/src/main/resources/dart2/model.mustache b/modules/openapi-generator/src/main/resources/dart2/model.mustache new file mode 100644 index 00000000000..37b030ab034 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/model.mustache @@ -0,0 +1,12 @@ +part of {{pubName}}.api; + +{{#models}} +{{#model}} +{{#isEnum}} +{{>enum}} +{{/isEnum}} +{{^isEnum}} +{{>class}} +{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/dart2/object_doc.mustache b/modules/openapi-generator/src/main/resources/dart2/object_doc.mustache new file mode 100644 index 00000000000..657f84d8905 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/object_doc.mustache @@ -0,0 +1,16 @@ +{{#models}}{{#model}}# {{pubName}}.model.{{classname}} + +## Load the model package +```dart +import 'package:{{pubName}}/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#readOnly}}[readonly] {{/readOnly}}{{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}} +{{/vars}} + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + +{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache b/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache new file mode 100644 index 00000000000..388572afe62 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/dart2/pubspec.mustache @@ -0,0 +1,7 @@ +name: {{pubName}} +version: {{pubVersion}} +description: {{pubDescription}} +environment: + sdk: '>=2.0.0 <3.0.0' +dependencies: + http: '>=0.11.1 <0.12.0' diff --git a/modules/openapi-generator/src/main/resources/elm/Byte.mustache b/modules/openapi-generator/src/main/resources/elm/Byte.mustache index 6974f1ed59b..6c80664aba1 100644 --- a/modules/openapi-generator/src/main/resources/elm/Byte.mustache +++ b/modules/openapi-generator/src/main/resources/elm/Byte.mustache @@ -1,4 +1,4 @@ -module Byte exposing (Byte, byteDecoder, byteEncoder) +module Byte exposing (Byte, decoder, encoder) import Json.Decode as Decode exposing (Decoder) import Json.Encode as Encode @@ -8,12 +8,11 @@ type alias Byte = String -byteDecoder : Decoder Byte -byteDecoder = +decoder : Decoder Byte +decoder = Decode.string -byteEncoder : Byte -> Encode.Value -byteEncoder model = +encoder : Byte -> Encode.Value +encoder model = Encode.string model - diff --git a/modules/openapi-generator/src/main/resources/elm/DateOnly.mustache b/modules/openapi-generator/src/main/resources/elm/DateOnly.mustache index 59551c7aa71..acd6cd44eb9 100644 --- a/modules/openapi-generator/src/main/resources/elm/DateOnly.mustache +++ b/modules/openapi-generator/src/main/resources/elm/DateOnly.mustache @@ -1,32 +1,37 @@ -module DateOnly exposing (DateOnly, dateOnlyDecoder, dateOnlyEncoder) +module DateOnly exposing (DateOnly, decoder, encoder, toString) -import Date -import Date.Extra exposing (fromIsoString, toFormattedString) +import Iso8601 import Json.Decode as Decode exposing (Decoder) import Json.Encode as Encode import Result +import Time type alias DateOnly = - Date.Date + Time.Posix -dateOnlyDecoder : Decoder DateOnly -dateOnlyDecoder = +decoder : Decoder DateOnly +decoder = Decode.string |> Decode.andThen decodeIsoString -dateOnlyEncoder : DateOnly -> Encode.Value -dateOnlyEncoder model = - Encode.string <| toFormattedString "yyyy-MM-dd" model +encoder : DateOnly -> Encode.Value +encoder = + Encode.string << toString decodeIsoString : String -> Decoder DateOnly decodeIsoString str = - case fromIsoString str of - Result.Ok date -> - Decode.succeed date + case Iso8601.toTime (str ++ "T00:00:00.000Z") of + Result.Ok posix -> + Decode.succeed posix - Result.Err msg -> - Decode.fail msg + Result.Err _ -> + Decode.fail <| "Invalid date: " ++ str + + +toString : DateOnly -> String +toString = + String.left 10 << Iso8601.fromTime diff --git a/modules/openapi-generator/src/main/resources/elm/DateOnly018.mustache b/modules/openapi-generator/src/main/resources/elm/DateOnly018.mustache new file mode 100644 index 00000000000..29abf6757ef --- /dev/null +++ b/modules/openapi-generator/src/main/resources/elm/DateOnly018.mustache @@ -0,0 +1,37 @@ +module DateOnly exposing (DateOnly, decoder, encoder, toString) + +import Date +import Date.Extra exposing (fromIsoString, toFormattedString) +import Json.Decode as Decode exposing (Decoder) +import Json.Encode as Encode +import Result + + +type alias DateOnly = + Date.Date + + +decoder : Decoder DateOnly +decoder = + Decode.string + |> Decode.andThen decodeIsoString + + +encoder : DateOnly -> Encode.Value +encoder = + Encode.string << toString + + +decodeIsoString : String -> Decoder DateOnly +decodeIsoString str = + case fromIsoString str of + Result.Ok date -> + Decode.succeed date + + Result.Err msg -> + Decode.fail msg + + +toString : DateOnly -> String +toString = + toFormattedString "yyyy-MM-dd" diff --git a/modules/openapi-generator/src/main/resources/elm/DateTime.mustache b/modules/openapi-generator/src/main/resources/elm/DateTime.mustache index d3638500a89..d85fcee5fe3 100644 --- a/modules/openapi-generator/src/main/resources/elm/DateTime.mustache +++ b/modules/openapi-generator/src/main/resources/elm/DateTime.mustache @@ -1,32 +1,37 @@ -module DateTime exposing (DateTime, dateTimeDecoder, dateTimeEncoder) +module DateTime exposing (DateTime, decoder, encoder, toString) -import Date -import Date.Extra exposing (fromIsoString, toIsoString) +import Iso8601 import Json.Decode as Decode exposing (Decoder) import Json.Encode as Encode import Result +import Time type alias DateTime = - Date.Date + Time.Posix -dateTimeDecoder : Decoder DateTime -dateTimeDecoder = +decoder : Decoder DateTime +decoder = Decode.string |> Decode.andThen decodeIsoString -dateTimeEncoder : DateTime -> Encode.Value -dateTimeEncoder model = - Encode.string <| toIsoString model +encoder : DateTime -> Encode.Value +encoder = + Encode.string << toString decodeIsoString : String -> Decoder DateTime decodeIsoString str = - case fromIsoString str of - Result.Ok date -> - Decode.succeed date + case Iso8601.toTime str of + Result.Ok posix -> + Decode.succeed posix - Result.Err msg -> - Decode.fail msg + Result.Err _ -> + Decode.fail <| "Invalid date: " ++ str + + +toString : DateTime -> String +toString = + Iso8601.fromTime \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/elm/DateTime018.mustache b/modules/openapi-generator/src/main/resources/elm/DateTime018.mustache new file mode 100644 index 00000000000..a07c912aecd --- /dev/null +++ b/modules/openapi-generator/src/main/resources/elm/DateTime018.mustache @@ -0,0 +1,37 @@ +module DateTime exposing (DateTime, decoder, encoder, toString) + +import Date +import Date.Extra exposing (fromIsoString, toIsoString) +import Json.Decode as Decode exposing (Decoder) +import Json.Encode as Encode +import Result + + +type alias DateTime = + Date.Date + + +decoder : Decoder DateTime +decoder = + Decode.string + |> Decode.andThen decodeIsoString + + +encoder : DateTime -> Encode.Value +encoder = + Encode.string << toString + + +decodeIsoString : String -> Decoder DateTime +decodeIsoString str = + case fromIsoString str of + Result.Ok date -> + Decode.succeed date + + Result.Err msg -> + Decode.fail msg + + +toString : DateTime -> String +toString = + toIsoString \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/elm/Main.mustache b/modules/openapi-generator/src/main/resources/elm/Main.mustache index b0a2ce0b52c..7c9ddd056d3 100644 --- a/modules/openapi-generator/src/main/resources/elm/Main.mustache +++ b/modules/openapi-generator/src/main/resources/elm/Main.mustache @@ -1,43 +1,61 @@ -module Main exposing (..) +module Main exposing (main) -import Json.Decode as Decode -import Html exposing (Html, button, div, text) -import Html.Events exposing (onClick) -import Http +import Browser +import Html exposing (Html) -main : Program Never Model Msg +main : Program () Model Msg main = - Html.program + Browser.element { init = init , view = view , update = update , subscriptions = subscriptions } + + +-- MODEL + + type alias Model = - { status : Maybe Int + { value : Int } -init : (Model, Cmd Msg) -init = - ( Model Nothing, Cmd.none ) + +init : () -> ( Model, Cmd Msg ) +init _ = + ( Model 0, Cmd.none ) + + + +-- UPDATE + type Msg = NoOp -update : Msg -> Model -> (Model, Cmd Msg) + +update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of NoOp -> ( model, Cmd.none ) -view : Model -> Html Msg -view model = - Html.text "main" + +-- SUBSCRIPTIONS subscriptions : Model -> Sub Msg -subscriptions model = +subscriptions _ = Sub.none + + + +-- VIEW + + +view : Model -> Html Msg +view _ = + Html.text "main" diff --git a/modules/openapi-generator/src/main/resources/elm/Main018.mustache b/modules/openapi-generator/src/main/resources/elm/Main018.mustache new file mode 100644 index 00000000000..23274d541c1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/elm/Main018.mustache @@ -0,0 +1,60 @@ +module Main exposing (main) + +import Html exposing (Html) + + +main : Program Never Model Msg +main = + Html.program + { init = init + , view = view + , update = update + , subscriptions = subscriptions + } + + + +-- MODEL + + +type alias Model = + { value : Int + } + + +init : ( Model, Cmd Msg ) +init = + ( Model 0, Cmd.none ) + + + +-- UPDATE + + +type Msg + = NoOp + + +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + case msg of + NoOp -> + ( model, Cmd.none ) + + + +-- SUBSCRIPTIONS + + +subscriptions : Model -> Sub Msg +subscriptions _ = + Sub.none + + + +-- VIEW + + +view : Model -> Html Msg +view _ = + Html.text "main" diff --git a/modules/openapi-generator/src/main/resources/elm/aliasDecoder.mustache b/modules/openapi-generator/src/main/resources/elm/aliasDecoder.mustache index 8a37eef1084..c03d1c5b74f 100644 --- a/modules/openapi-generator/src/main/resources/elm/aliasDecoder.mustache +++ b/modules/openapi-generator/src/main/resources/elm/aliasDecoder.mustache @@ -1,7 +1,6 @@ -{{classVarName}}Decoder : Decoder {{classname}} -{{classVarName}}Decoder = - decode {{classname}} +decoder : Decoder {{classname}} +decoder = + {{#isElm018}}decode{{/isElm018}}{{#isElm019}}Decode.succeed{{/isElm019}} {{classname}} {{#allVars}} -{{^discriminatorValue}} |> {{>fieldDecoder}} -{{/discriminatorValue}} + |> {{>fieldDecoder}} {{/allVars}} diff --git a/modules/openapi-generator/src/main/resources/elm/aliasEncoder.mustache b/modules/openapi-generator/src/main/resources/elm/aliasEncoder.mustache index 662453c3cec..b4435dfb03d 100644 --- a/modules/openapi-generator/src/main/resources/elm/aliasEncoder.mustache +++ b/modules/openapi-generator/src/main/resources/elm/aliasEncoder.mustache @@ -1,7 +1,7 @@ -{{classVarName}}Encoder : {{classname}} -> Encode.Value -{{classVarName}}Encoder model = +encoder : {{#vendorExtensions.discriminatorName}}String -> {{/vendorExtensions.discriminatorName}}{{classname}} -> Encode.Value +encoder {{#vendorExtensions.discriminatorName}}tag {{/vendorExtensions.discriminatorName}}model = Encode.object {{#allVars}} {{#-first}}[{{/-first}}{{^-first}},{{/-first}} {{>fieldEncoder}} -{{/allVars}} +{{/allVars}}{{#vendorExtensions.discriminatorName}} , ( "{{{vendorExtensions.discriminatorName}}}", Encode.string tag ){{/vendorExtensions.discriminatorName}} ] diff --git a/modules/openapi-generator/src/main/resources/elm/api.mustache b/modules/openapi-generator/src/main/resources/elm/api.mustache index df085dfa437..ebe53eeac93 100644 --- a/modules/openapi-generator/src/main/resources/elm/api.mustache +++ b/modules/openapi-generator/src/main/resources/elm/api.mustache @@ -23,8 +23,8 @@ basePath = { method = "{{httpMethod}}" , url = basePath ++ {{{path}}} , headers = [] - , body = {{#bodyParam}}Http.jsonBody <| {{vendorExtensions.x-encoder}} model{{/bodyParam}}{{^bodyParam}}Http.emptyBody{{/bodyParam}} - , expect = {{^responses}}Http.expectStringResponse (\_ -> Ok ()){{/responses}}{{#responses}}{{#-first}}{{^dataType}}Http.expectStringResponse (\_ -> Ok ()){{/dataType}}{{#dataType}}Http.expectJson {{#isMapContainer}}(Decode.dict {{/isMapContainer}}{{#isListContainer}}(Decode.list {{/isListContainer}}{{#vendorExtensions}}{{x-decoder}}{{/vendorExtensions}}{{#isListContainer}}){{/isListContainer}}{{#isMapContainer}}){{/isMapContainer}}{{/dataType}}{{/-first}}{{/responses}} + , body = {{#bodyParam}}Http.jsonBody <| {{vendorExtensions.elmEncoder}} model{{/bodyParam}}{{^bodyParam}}Http.emptyBody{{/bodyParam}} + , expect = {{^responses}}Http.expectStringResponse (\_ -> Ok ()){{/responses}}{{#responses}}{{#-first}}{{^dataType}}Http.expectStringResponse (\_ -> Ok ()){{/dataType}}{{#dataType}}Http.expectJson {{#isMapContainer}}(Decode.dict {{/isMapContainer}}{{#isListContainer}}(Decode.list {{/isListContainer}}{{#vendorExtensions}}{{elmDecoder}}{{/vendorExtensions}}{{#isListContainer}}){{/isListContainer}}{{#isMapContainer}}){{/isMapContainer}}{{/dataType}}{{/-first}}{{/responses}} , timeout = Just 30000 , withCredentials = False } diff --git a/modules/openapi-generator/src/main/resources/elm/elm-package.mustache b/modules/openapi-generator/src/main/resources/elm/elm-package018.mustache similarity index 100% rename from modules/openapi-generator/src/main/resources/elm/elm-package.mustache rename to modules/openapi-generator/src/main/resources/elm/elm-package018.mustache diff --git a/modules/openapi-generator/src/main/resources/elm/elm.mustache b/modules/openapi-generator/src/main/resources/elm/elm.mustache new file mode 100644 index 00000000000..6028a740feb --- /dev/null +++ b/modules/openapi-generator/src/main/resources/elm/elm.mustache @@ -0,0 +1,28 @@ +{ + "type": "application", + "source-directories": [ + "src" + ], + "elm-version": "0.19.0", + "dependencies": { + "direct": { + "NoRedInk/elm-json-decode-pipeline": "1.0.0", + "elm/browser": "1.0.0", + "elm/core": "1.0.0", + "elm/html": "1.0.0", + "elm/http": "1.0.0", + "elm/json": "1.0.0", + "elm/time": "1.0.0", + "rtfeldman/elm-iso8601-date-strings": "1.0.0" + }, + "indirect": { + "elm/parser": "1.0.0", + "elm/url": "1.0.0", + "elm/virtual-dom": "1.0.0" + } + }, + "test-dependencies": { + "direct": {}, + "indirect": {} + } +} diff --git a/modules/openapi-generator/src/main/resources/elm/fieldDecoder.mustache b/modules/openapi-generator/src/main/resources/elm/fieldDecoder.mustache index 3a63d1895bc..6f7db61ddbd 100644 --- a/modules/openapi-generator/src/main/resources/elm/fieldDecoder.mustache +++ b/modules/openapi-generator/src/main/resources/elm/fieldDecoder.mustache @@ -1 +1 @@ -{{#required}}required{{/required}}{{^required}}optional{{/required}} "{{baseName}}" {{^required}}(Decode.nullable {{/required}}{{#isContainer}}(Decode.list {{/isContainer}}{{vendorExtensions.x-decoder}}{{#isContainer}}){{/isContainer}}{{^required}}){{/required}}{{^required}} {{{defaultValue}}}{{/required}} \ No newline at end of file +{{#required}}required{{/required}}{{^required}}optional{{/required}} "{{baseName}}" {{^required}}(Decode.nullable {{/required}}{{#isContainer}}(Decode.list {{/isContainer}}{{vendorExtensions.elmDecoder}}{{#isContainer}}){{/isContainer}}{{^required}}){{/required}}{{^required}} {{{defaultValue}}}{{/required}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/elm/fieldEncoder.mustache b/modules/openapi-generator/src/main/resources/elm/fieldEncoder.mustache index 64131c7c227..df4dc919d6e 100644 --- a/modules/openapi-generator/src/main/resources/elm/fieldEncoder.mustache +++ b/modules/openapi-generator/src/main/resources/elm/fieldEncoder.mustache @@ -1 +1 @@ -( "{{baseName}}", {{#discriminatorValue}}Encode.string "{{discriminatorValue}}"{{/discriminatorValue}}{{^discriminatorValue}}{{^required}}withDefault Encode.null (map {{/required}}{{#isContainer}}(Encode.list << List.map {{/isContainer}}{{vendorExtensions.x-encoder}}{{#isContainer}}){{/isContainer}} model.{{name}}{{^required}}){{/required}}{{/discriminatorValue}} ) \ No newline at end of file +( "{{baseName}}", {{#discriminatorValue}}Encode.string "{{discriminatorValue}}"{{/discriminatorValue}}{{^discriminatorValue}}{{^required}}Maybe.withDefault Encode.null (Maybe.map {{/required}}{{#isContainer}}(Encode.list {{#isElm018}}<< List.map {{/isElm018}}{{/isContainer}}{{vendorExtensions.elmEncoder}}{{#isContainer}}){{/isContainer}} model.{{name}}{{^required}}){{/required}}{{/discriminatorValue}} ) \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/elm/model.mustache b/modules/openapi-generator/src/main/resources/elm/model.mustache index 5a0f0722605..42fa46711d9 100644 --- a/modules/openapi-generator/src/main/resources/elm/model.mustache +++ b/modules/openapi-generator/src/main/resources/elm/model.mustache @@ -1,11 +1,10 @@ {{>licenseInfo}} -module Data.{{classname}} exposing ({{#models}}{{#model}}{{classname}}{{#hasChildren}}(..){{/hasChildren}}{{#isEnum}}(..){{/isEnum}}{{^isEnum}}{{#vars}}{{#isEnum}}, {{vendorExtensions.x-union-type}}(..){{/isEnum}}{{/vars}}{{/isEnum}}, {{classVarName}}Decoder, {{classVarName}}Encoder{{/model}}{{/models}}) +module Data.{{classname}} exposing ({{#models}}{{#model}}{{classname}}{{#hasChildren}}(..){{/hasChildren}}{{#isEnum}}(..){{/isEnum}}{{^isEnum}}{{#vars}}{{#isEnum}}, {{vendorExtensions.elmUnionType}}(..){{/isEnum}}{{/vars}}{{/isEnum}}, decoder, encoder{{/model}}{{/models}}) {{>imports}}import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Decode.Pipeline exposing ({{#isElm018}}decode, {{/isElm018}}optional, required) import Json.Encode as Encode -import Maybe exposing (map, withDefault) {{#models}} {{#model}} @@ -14,6 +13,6 @@ import Maybe exposing (map, withDefault) {-| {{{description}}} -} {{/description}} -{{#isEnum}}{{>modelTypeUnion}}{{/isEnum}}{{^isEnum}}{{#hasChildren}}{{>modelTypeDiscriminator}}{{/hasChildren}}{{^hasChildren}}{{#isAlias}}{{>modelTypePrimitive}}{{/isAlias}}{{^isAlias}}{{#isArrayModel}}{{>modelTypeArray}}{{/isArrayModel}}{{^isArrayModel}}{{>modelTypeAlias}}{{/isArrayModel}}{{/isAlias}}{{/hasChildren}}{{/isEnum}} +{{#isEnum}}{{>modelTypeUnion}}{{/isEnum}}{{^isEnum}}{{#discriminator}}{{>modelTypeDiscriminator}}{{/discriminator}}{{^discriminator}}{{#isAlias}}{{>modelTypePrimitive}}{{/isAlias}}{{^isAlias}}{{#isArrayModel}}{{>modelTypeArray}}{{/isArrayModel}}{{^isArrayModel}}{{>modelTypeAlias}}{{/isArrayModel}}{{/isAlias}}{{/discriminator}}{{/isEnum}} {{/model}} {{/models}} diff --git a/modules/openapi-generator/src/main/resources/elm/modelTypeAlias.mustache b/modules/openapi-generator/src/main/resources/elm/modelTypeAlias.mustache index fc796b4c23d..6063ffe8f4b 100644 --- a/modules/openapi-generator/src/main/resources/elm/modelTypeAlias.mustache +++ b/modules/openapi-generator/src/main/resources/elm/modelTypeAlias.mustache @@ -1,6 +1,6 @@ type alias {{classname}} = - { {{#vars}}{{^-first}} , {{/-first}}{{name}} : {{^required}}Maybe {{#isContainer}}({{/isContainer}}{{/required}}{{#isContainer}}List {{/isContainer}}{{#isEnum}}{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{dataType}}{{/isEnum}}{{^required}}{{#isContainer}}){{/isContainer}}{{/required}} -{{/vars}} } + { {{#allVars}}{{^-first}} , {{/-first}}{{name}} : {{^required}}Maybe {{#isContainer}}({{/isContainer}}{{/required}}{{#isContainer}}List {{/isContainer}}{{#isEnum}}{{nameInCamelCase}}{{/isEnum}}{{^isEnum}}{{dataType}}{{/isEnum}}{{^required}}{{#isContainer}}){{/isContainer}}{{/required}} +{{/allVars}} } {{#vars}} {{#isEnum}} diff --git a/modules/openapi-generator/src/main/resources/elm/modelTypeArray.mustache b/modules/openapi-generator/src/main/resources/elm/modelTypeArray.mustache index 7d3c6d437a4..a636dcce9f9 100644 --- a/modules/openapi-generator/src/main/resources/elm/modelTypeArray.mustache +++ b/modules/openapi-generator/src/main/resources/elm/modelTypeArray.mustache @@ -2,11 +2,11 @@ type alias {{classname}} = {{parent}} -{{classVarName}}Decoder : Decoder {{classname}} -{{classVarName}}Decoder = - Decode.list {{vendorExtensions.x-decoder}} +decoder : Decoder {{classname}} +decoder = + Decode.list {{vendorExtensions.elmDecoder}} -{{classVarName}}Encoder : {{classname}} -> Encode.Value -{{classVarName}}Encoder model = - Encode.list (List.map {{vendorExtensions.x-encoder}} model) +encoder : {{classname}} -> Encode.Value +encoder items = + Encode.list {{#isElm018}}(List.map {{/isElm018}}{{vendorExtensions.elmEncoder}} items{{#isElm018}}){{/isElm018}} diff --git a/modules/openapi-generator/src/main/resources/elm/modelTypeDiscriminator.mustache b/modules/openapi-generator/src/main/resources/elm/modelTypeDiscriminator.mustache index d00b9de18d4..61c71765842 100644 --- a/modules/openapi-generator/src/main/resources/elm/modelTypeDiscriminator.mustache +++ b/modules/openapi-generator/src/main/resources/elm/modelTypeDiscriminator.mustache @@ -1,34 +1,32 @@ type {{classname}} -{{#children}} - {{#-first}}={{/-first}}{{^-first}}|{{/-first}} {{classname}}Type {{classname}} -{{/children}} +{{#mappedModels}} + {{#-first}}={{/-first}}{{^-first}}|{{/-first}} {{modelName}}Type {{modelName}} +{{/mappedModels}} -{{classVarName}}Decoder : Decoder {{classname}} -{{classVarName}}Decoder = - Decode.field "{{{discriminatorName}}}" Decode.string - |> Decode.andThen {{classVarName}}TypeDecoder +decoder : Decoder {{classname}} +decoder = + Decode.field "{{{discriminator.propertyName}}}" Decode.string + |> Decode.andThen {{classVarName}}Decoder -{{classVarName}}TypeDecoder : String -> Decoder {{classname}} -{{classVarName}}TypeDecoder {{{discriminatorName}}} = - case {{{discriminatorName}}} of -{{#children}} - "{{vendorExtensions.x-discriminator-value}}" -> - Decode.map {{classname}}Type {{classVarName}}Decoder +{{classVarName}}Decoder : String -> Decoder {{classname}} +{{classVarName}}Decoder tag = + case tag of +{{#mappedModels}} + "{{mappingName}}" -> + Decode.map {{modelName}}Type {{modelName}}.decoder -{{/children}} +{{/mappedModels}} _ -> - Decode.fail <| - "Trying to decode {{classname}}, but {{{discriminatorName}}} " - ++ toString {{{discriminatorName}}} ++ " is not supported." + Decode.fail <| "Trying to decode {{classname}}, but {{{discriminatorName}}} " ++ tag ++ " is not supported." -{{classVarName}}Encoder : {{classname}} -> Encode.Value -{{classVarName}}Encoder model = +encoder : {{classname}} -> Encode.Value +encoder model = case model of -{{#children}} - {{classname}}Type subModel -> - {{classVarName}}Encoder subModel +{{#mappedModels}} + {{modelName}}Type subModel -> + {{modelName}}.encoder "{{mappingName}}" subModel -{{/children}} +{{/mappedModels}} diff --git a/modules/openapi-generator/src/main/resources/elm/modelTypePrimitive.mustache b/modules/openapi-generator/src/main/resources/elm/modelTypePrimitive.mustache index a1d872f1451..864bde60fe1 100644 --- a/modules/openapi-generator/src/main/resources/elm/modelTypePrimitive.mustache +++ b/modules/openapi-generator/src/main/resources/elm/modelTypePrimitive.mustache @@ -2,11 +2,11 @@ type alias {{classname}} = {{dataType}} -{{classVarName}}Decoder : Decoder {{classname}} -{{classVarName}}Decoder = - {{vendorExtensions.x-decoder}} +decoder : Decoder {{classname}} +decoder = + {{vendorExtensions.elmDecoder}} -{{classVarName}}Encoder : {{classname}} -> Encode.Value -{{classVarName}}Encoder = - {{vendorExtensions.x-encoder}} +encoder : {{classname}} -> Encode.Value +encoder = + {{vendorExtensions.elmEncoder}} diff --git a/modules/openapi-generator/src/main/resources/elm/union.mustache b/modules/openapi-generator/src/main/resources/elm/union.mustache index b692277835e..25dc6d89cde 100644 --- a/modules/openapi-generator/src/main/resources/elm/union.mustache +++ b/modules/openapi-generator/src/main/resources/elm/union.mustache @@ -1,4 +1,4 @@ -type {{#vendorExtensions}}{{x-union-type}}{{/vendorExtensions}} +type {{#vendorExtensions}}{{elmUnionType}}{{/vendorExtensions}} {{#allowableValues}} {{#enumVars}} {{#-first}}={{/-first}}{{^-first}}|{{/-first}} {{name}} diff --git a/modules/openapi-generator/src/main/resources/elm/unionDecoder.mustache b/modules/openapi-generator/src/main/resources/elm/unionDecoder.mustache index 5cf56193d28..4051dce9f6e 100644 --- a/modules/openapi-generator/src/main/resources/elm/unionDecoder.mustache +++ b/modules/openapi-generator/src/main/resources/elm/unionDecoder.mustache @@ -1,15 +1,16 @@ -{{vendorExtensions.x-decoder}} : Decoder {{vendorExtensions.x-union-type}} -{{vendorExtensions.x-decoder}} = +{{vendorExtensions.elmDecoder}} : Decoder {{vendorExtensions.elmUnionType}} +{{vendorExtensions.elmDecoder}} = Decode.string - |> Decode.andThen (\str -> - case str of + |> Decode.andThen + (\str -> + case str of {{#allowableValues}} {{#enumVars}} - {{{value}}} -> - Decode.succeed {{name}} + {{{value}}} -> + Decode.succeed {{name}} {{/enumVars}} {{/allowableValues}} - other -> - Decode.fail <| "Unknown type: " ++ other - ) \ No newline at end of file + other -> + Decode.fail <| "Unknown type: " ++ other + ) diff --git a/modules/openapi-generator/src/main/resources/elm/unionEncoder.mustache b/modules/openapi-generator/src/main/resources/elm/unionEncoder.mustache index 4432a6b753f..2c286154f07 100644 --- a/modules/openapi-generator/src/main/resources/elm/unionEncoder.mustache +++ b/modules/openapi-generator/src/main/resources/elm/unionEncoder.mustache @@ -1,5 +1,5 @@ -{{vendorExtensions.x-encoder}} : {{vendorExtensions.x-union-type}} -> Encode.Value -{{vendorExtensions.x-encoder}} model = +{{vendorExtensions.elmEncoder}} : {{vendorExtensions.elmUnionType}} -> Encode.Value +{{vendorExtensions.elmEncoder}} model = case model of {{#allowableValues}} {{#enumVars}} diff --git a/modules/openapi-generator/src/main/resources/flaskConnexion/model.mustache b/modules/openapi-generator/src/main/resources/flaskConnexion/model.mustache index 8cf835e5f57..821eaa3a780 100644 --- a/modules/openapi-generator/src/main/resources/flaskConnexion/model.mustache +++ b/modules/openapi-generator/src/main/resources/flaskConnexion/model.mustache @@ -6,8 +6,6 @@ from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from {{modelPackage}}.base_model_ import Model -{{#imports}}{{import}} # noqa: F401,E501 -{{/imports}} from {{packageName}} import util @@ -27,7 +25,7 @@ class {{classname}}(Model): {{/-last}} {{/enumVars}}{{/allowableValues}} - def __init__(self{{#vars}}, {{name}}{{^supportPython2}}: {{dataType}}{{/supportPython2}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}): # noqa: E501 + def __init__(self{{#vars}}, {{name}}={{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}None{{/defaultValue}}{{/vars}}): # noqa: E501 """{{classname}} - a model defined in OpenAPI {{#vars}} @@ -37,7 +35,7 @@ class {{classname}}(Model): """ self.openapi_types = { {{#vars}} - '{{name}}': {{{dataType}}}{{#hasMore}},{{/hasMore}} + '{{name}}': '{{{dataType}}}'{{#hasMore}},{{/hasMore}} {{/vars}} } @@ -64,7 +62,7 @@ class {{classname}}(Model): {{/-first}} @property - def {{name}}(self){{^supportPython2}} -> {{dataType}}{{/supportPython2}}: + def {{name}}(self): """Gets the {{name}} of this {{classname}}. {{#description}} @@ -77,7 +75,7 @@ class {{classname}}(Model): return self._{{name}} @{{name}}.setter - def {{name}}(self, {{name}}{{^supportPython2}}: {{dataType}}{{/supportPython2}}): + def {{name}}(self, {{name}}): """Sets the {{name}} of this {{classname}}. {{#description}} @@ -158,4 +156,4 @@ class {{classname}}(Model): {{/vars}} {{/model}} -{{/models}} \ No newline at end of file +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/flaskConnexion/requirements.mustache b/modules/openapi-generator/src/main/resources/flaskConnexion/requirements.mustache index 04042d4b1d4..3f4f2a782d1 100644 --- a/modules/openapi-generator/src/main/resources/flaskConnexion/requirements.mustache +++ b/modules/openapi-generator/src/main/resources/flaskConnexion/requirements.mustache @@ -1,4 +1,5 @@ -connexion == 1.1.15 +connexion == 2.0.0rc3 +swagger-ui-bundle == 0.0.2 python_dateutil == 2.6.0 {{#supportPython2}} typing == 3.5.2.2 diff --git a/modules/openapi-generator/src/main/resources/go-gin-server/Dockerfile.mustache b/modules/openapi-generator/src/main/resources/go-gin-server/Dockerfile.mustache new file mode 100644 index 00000000000..114243086fa --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-gin-server/Dockerfile.mustache @@ -0,0 +1,14 @@ +FROM golang:1.10 AS build +WORKDIR /go/src +COPY {{apiPath}} ./{{apiPath}} +COPY main.go . + +ENV CGO_ENABLED=0 +RUN go get -d -v ./... + +RUN go build -a -installsuffix cgo -o {{packageName}} . + +FROM scratch AS runtime +COPY --from=build /go/src/{{packageName}} ./ +EXPOSE 8080/tcp +ENTRYPOINT ["./{{packageName}}"] diff --git a/modules/openapi-generator/src/main/resources/go-gin-server/README.mustache b/modules/openapi-generator/src/main/resources/go-gin-server/README.mustache new file mode 100644 index 00000000000..669209a9a84 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-gin-server/README.mustache @@ -0,0 +1,46 @@ +# Go API Server for {{packageName}} + +{{#appDescription}} +{{{appDescription}}} +{{/appDescription}} + +## Overview +This server was generated by the [openapi-generator] +(https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. +- + +To see how to make this your own, look here: + +[README](https://openapi-generator.tech) + +- API version: {{appVersion}}{{^hideGenerationTimestamp}} +- Build date: {{generatedDate}}{{/hideGenerationTimestamp}} +{{#infoUrl}} +For more information, please visit [{{{infoUrl}}}]({{{infoUrl}}}) +{{/infoUrl}} + +### Running the server + +To run the server, follow these simple steps: + +``` +go run main.go +``` + +To run the server in a docker container +``` +docker build --network=host -t {{{packageName}}} . +``` + +Once the image is built, just run +``` +docker run --rm -it {{{packageName}}} +``` + +### Known Issue + +Endpoints sharing a common path may result in issues. For example, `/v2/pet/findByTags` and `/v2/pet/:petId` will result in an issue with the Gin framework. For more information about this known limitation, please refer to [gin-gonic/gin#388](https://github.com/gin-gonic/gin/issues/388) for more information. + +A workaround is to manually update the path and handler. Please refer to [gin-gonic/gin/issues/205#issuecomment-296155497](https://github.com/gin-gonic/gin/issues/205#issuecomment-296155497) for more information. + diff --git a/modules/openapi-generator/src/main/resources/go-gin-server/controller-api.mustache b/modules/openapi-generator/src/main/resources/go-gin-server/controller-api.mustache new file mode 100644 index 00000000000..36eaf59209f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-gin-server/controller-api.mustache @@ -0,0 +1,14 @@ +{{>partial_header}} +package {{packageName}} + +{{#operations}} +import ( + "net/http" + + "github.com/gin-gonic/gin" +){{#operation}} + +// {{nickname}} - {{{summary}}} +func {{nickname}}(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +}{{/operation}}{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/go-gin-server/main.mustache b/modules/openapi-generator/src/main/resources/go-gin-server/main.mustache new file mode 100644 index 00000000000..95f6d3af4b1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-gin-server/main.mustache @@ -0,0 +1,23 @@ +{{>partial_header}} +package main + +import ( + "log" + + // WARNING! + // Change this to a fully-qualified import path + // once you place this file into your project. + // For example, + // + // sw "github.com/myname/myrepo/{{apiPath}}" + // + sw "./{{apiPath}}" +) + +func main() { + log.Printf("Server started") + + router := sw.NewRouter() + + log.Fatal(router.Run(":{{serverPort}}")) +} diff --git a/modules/openapi-generator/src/main/resources/go-gin-server/model.mustache b/modules/openapi-generator/src/main/resources/go-gin-server/model.mustache new file mode 100644 index 00000000000..28ba90cffc6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-gin-server/model.mustache @@ -0,0 +1,24 @@ +{{>partial_header}} +package {{packageName}} +{{#models}}{{#imports}} +import ({{/imports}}{{#imports}} + "{{import}}"{{/imports}}{{#imports}} +) +{{/imports}}{{#model}}{{#isEnum}}{{#description}}// {{{classname}}} : {{{description}}}{{/description}} +type {{{name}}} {{^format}}{{dataType}}{{/format}}{{#format}}{{{format}}}{{/format}} + +// List of {{{name}}} +const ( + {{#allowableValues}} + {{#enumVars}} + {{name}} {{{classname}}} = "{{{value}}}" + {{/enumVars}} + {{/allowableValues}} +){{/isEnum}}{{^isEnum}}{{#description}} +// {{classname}} - {{{description}}}{{/description}} +type {{classname}} struct { +{{#vars}}{{#description}} + // {{{description}}}{{/description}} + {{name}} {{^isEnum}}{{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{/isEnum}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` +{{/vars}} +}{{/isEnum}}{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/go-gin-server/openapi.mustache b/modules/openapi-generator/src/main/resources/go-gin-server/openapi.mustache new file mode 100644 index 00000000000..51ebafb0187 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-gin-server/openapi.mustache @@ -0,0 +1 @@ +{{{openapi-yaml}}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/go-gin-server/partial_header.mustache b/modules/openapi-generator/src/main/resources/go-gin-server/partial_header.mustache new file mode 100644 index 00000000000..23edcdfb691 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-gin-server/partial_header.mustache @@ -0,0 +1,17 @@ +/* + {{#appName}} + * {{{appName}}} + * + {{/appName}} + {{#appDescription}} + * {{{appDescription}}} + * + {{/appDescription}} + {{#version}} + * API version: {{{version}}} + {{/version}} + {{#infoEmail}} + * Contact: {{{infoEmail}}} + {{/infoEmail}} + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ diff --git a/modules/openapi-generator/src/main/resources/go-gin-server/routers.mustache b/modules/openapi-generator/src/main/resources/go-gin-server/routers.mustache new file mode 100644 index 00000000000..babf63dd262 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/go-gin-server/routers.mustache @@ -0,0 +1,64 @@ +{{>partial_header}} +package {{packageName}} + +import ( + "net/http" + "strings" + + "github.com/gin-gonic/gin" +) + +// Route is the information for every URI. +type Route struct { + // Name is the name of this Route. + Name string + // Method is the string for the HTTP method. ex) GET, POST etc.. + Method string + // Pattern is the pattern of the URI. + Pattern string + // HandlerFunc is the handler function of this route. + HandlerFunc gin.HandlerFunc +} + +// Routes is the list of the generated Route. +type Routes []Route + +// NewRouter returns a new router. +func NewRouter() *gin.Engine { + router := gin.Default() + for _, route := range routes { + switch route.Method { + case "GET": + router.GET(route.Pattern, route.HandlerFunc) + case "POST": + router.POST(route.Pattern, route.HandlerFunc) + case "PUT": + router.PUT(route.Pattern, route.HandlerFunc) + case "DELETE": + router.DELETE(route.Pattern, route.HandlerFunc) + } + } + + return router +} + +// Index is the index handler. +func Index(c *gin.Context) { + c.String(http.StatusOK, "Hello World!") +} + +var routes = Routes{ + { + "Index", + "GET", + "{{{basePathWithoutHost}}}/", + Index, + },{{#apiInfo}}{{#apis}}{{#operations}}{{#operation}} + + { + "{{operationId}}", + strings.ToUpper("{{httpMethod}}"), + "{{{basePathWithoutHost}}}{{{path}}}", + {{operationId}}, + },{{/operation}}{{/operations}}{{/apis}}{{/apiInfo}} +} diff --git a/modules/openapi-generator/src/main/resources/go-server/README.mustache b/modules/openapi-generator/src/main/resources/go-server/README.mustache index aedb0a34134..14083f75847 100644 --- a/modules/openapi-generator/src/main/resources/go-server/README.mustache +++ b/modules/openapi-generator/src/main/resources/go-server/README.mustache @@ -12,7 +12,7 @@ By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a To see how to make this your own, look here: -[README]((https://openapi-generator.tech)) +[README](https://openapi-generator.tech) - API version: {{appVersion}}{{^hideGenerationTimestamp}} - Build date: {{generatedDate}}{{/hideGenerationTimestamp}} diff --git a/modules/openapi-generator/src/main/resources/go-server/model.mustache b/modules/openapi-generator/src/main/resources/go-server/model.mustache index d006e1aa050..28ba90cffc6 100644 --- a/modules/openapi-generator/src/main/resources/go-server/model.mustache +++ b/modules/openapi-generator/src/main/resources/go-server/model.mustache @@ -19,6 +19,6 @@ const ( type {{classname}} struct { {{#vars}}{{#description}} // {{{description}}}{{/description}} - {{name}} {{^isEnum}}{{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{/isEnum}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"` + {{name}} {{^isEnum}}{{^isPrimitiveType}}{{^isContainer}}{{^isDateTime}}*{{/isDateTime}}{{/isContainer}}{{/isPrimitiveType}}{{/isEnum}}{{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` {{/vars}} }{{/isEnum}}{{/model}}{{/models}} diff --git a/modules/openapi-generator/src/main/resources/go/api.mustache b/modules/openapi-generator/src/main/resources/go/api.mustache index 8b2943af55f..19cde5b4458 100644 --- a/modules/openapi-generator/src/main/resources/go/api.mustache +++ b/modules/openapi-generator/src/main/resources/go/api.mustache @@ -50,14 +50,14 @@ type {{{nickname}}}Opts struct { {{^required}} {{#isPrimitiveType}} {{^isBinary}} - {{vendorExtensions.x-exportParamName}} optional.{{vendorExtensions.x-optionalDataType}} + {{vendorExtensions.x-exportParamName}} optional.{{vendorExtensions.x-optionalDataType}} {{/isBinary}} {{#isBinary}} - {{vendorExtensions.x-exportParamName}} optional.Interface + {{vendorExtensions.x-exportParamName}} optional.Interface {{/isBinary}} {{/isPrimitiveType}} {{^isPrimitiveType}} - {{vendorExtensions.x-exportParamName}} optional.Interface + {{vendorExtensions.x-exportParamName}} optional.Interface {{/isPrimitiveType}} {{/required}} {{/allParams}} @@ -66,13 +66,13 @@ type {{{nickname}}}Opts struct { {{/hasOptionalParams}} func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams}}, {{/hasParams}}{{#allParams}}{{#required}}{{paramName}} {{{dataType}}}{{#hasMore}}, {{/hasMore}}{{/required}}{{/allParams}}{{#hasOptionalParams}}localVarOptionals *{{{nickname}}}Opts{{/hasOptionalParams}}) ({{#returnType}}{{{returnType}}}, {{/returnType}}*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("{{httpMethod}}") + localVarHttpMethod = strings.ToUpper("{{httpMethod}}") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte {{#returnType}} - localVarReturnValue {{{returnType}}} + localVarReturnValue {{{returnType}}} {{/returnType}} ) @@ -275,7 +275,7 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} {{#returnType}} if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, err } @@ -284,20 +284,20 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} {{/returnType}} if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } {{#responses}} {{#dataType}} if localVarHttpResponse.StatusCode == {{{code}}} { var v {{{dataType}}} - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, newErr + } + newErr.model = v + return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, newErr } {{/dataType}} {{/responses}} @@ -307,4 +307,4 @@ func (a *{{{classname}}}Service) {{{nickname}}}(ctx context.Context{{#hasParams} return {{#returnType}}localVarReturnValue, {{/returnType}}localVarHttpResponse, nil } {{/operation}} -{{/operations}} \ No newline at end of file +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/go/client.mustache b/modules/openapi-generator/src/main/resources/go/client.mustache index a6aec184854..c4ef64ee2e0 100644 --- a/modules/openapi-generator/src/main/resources/go/client.mustache +++ b/modules/openapi-generator/src/main/resources/go/client.mustache @@ -188,7 +188,7 @@ func (c *APIClient) prepareRequest( } // add form parameters and file if available. - if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { if body != nil { return nil, errors.New("Cannot specify postBody and multipart form at the same time.") } @@ -227,6 +227,16 @@ func (c *APIClient) prepareRequest( w.Close() } + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + // Setup path and query parameters url, err := url.Parse(path) if err != nil { @@ -469,4 +479,4 @@ func (e GenericOpenAPIError) Body() []byte { // Model returns the unpacked model of the error func (e GenericOpenAPIError) Model() interface{} { return e.model -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/go/model.mustache b/modules/openapi-generator/src/main/resources/go/model.mustache index 4243daa4e2d..07e5c758516 100644 --- a/modules/openapi-generator/src/main/resources/go/model.mustache +++ b/modules/openapi-generator/src/main/resources/go/model.mustache @@ -35,7 +35,7 @@ type {{classname}} struct { {{#description}} // {{{description}}} {{/description}} - {{name}} {{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}` + {{name}} {{{dataType}}} `json:"{{baseName}}{{^required}},omitempty{{/required}}"{{#withXml}} xml:"{{baseName}}{{#isXmlAttribute}},attr{{/isXmlAttribute}}"{{/withXml}}{{#vendorExtensions.x-go-custom-tag}} {{{.}}}{{/vendorExtensions.x-go-custom-tag}}` {{/vars}} } {{/isEnum}} 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 3e4d9881972..5b853d80943 100644 --- a/modules/openapi-generator/src/main/resources/java-pkmst/pojo.mustache +++ b/modules/openapi-generator/src/main/resources/java-pkmst/pojo.mustache @@ -32,7 +32,7 @@ public class {{classname}} {{#parent}}extends {{{parent}}}{{/parent}} {{#seriali private {{{datatypeWithEnum}}} {{name}}{{#required}} = {{{defaultValue}}}{{/required}}{{^required}} = null{{/required}}; {{/isContainer}} {{^isContainer}} - private {{{datatypeWithEnum}}} {{name}} = {{{defaultValue}}}; + private {{{datatypeWithEnum}}} {{name}}{{#defaultValue}} = {{{.}}}{{/defaultValue}}; {{/isContainer}} {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache new file mode 100644 index 00000000000..d8e69eb72f6 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/api.mustache @@ -0,0 +1,70 @@ +package {{package}} + +{{#imports}}import {{import}} +{{/imports}} +{{#swaggerAnnotations}} +import io.swagger.annotations.* +{{/swaggerAnnotations}} +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity +import org.springframework.stereotype.Controller +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +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 +{{#useBeanValidation}} +import org.springframework.validation.annotation.Validated +{{/useBeanValidation}} +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.web.multipart.MultipartFile +import org.springframework.beans.factory.annotation.Autowired + +{{#useBeanValidation}} +import javax.validation.Valid +import javax.validation.constraints.* +{{/useBeanValidation}} + +import kotlin.collections.List +import kotlin.collections.Map + +@Controller +{{#useBeanValidation}} +@Validated +{{/useBeanValidation}} +{{#swaggerAnnotations}} +@Api(value = "{{{baseName}}}", description = "The {{{baseName}}} API") +{{/swaggerAnnotations}} +{{=<% %>=}} +@RequestMapping("\${api.base-path:<%contextPath%>}") +<%={{ }}=%> +{{#operations}} +class {{classname}}Controller({{#serviceInterface}}@Autowired(required = true) val service: {{classname}}Service{{/serviceInterface}}) { +{{#operation}} + + {{#swaggerAnnotations}} + @ApiOperation( + value = "{{{summary}}}", + nickname = "{{{operationId}}}", + notes = "{{{notes}}}"{{#returnBaseType}}, + response = {{{returnBaseType}}}::class{{/returnBaseType}}{{#returnContainer}}, + responseContainer = "{{{returnContainer}}}"{{/returnContainer}}{{#hasAuthMethods}}, + authorizations = [{{#authMethods}}Authorization(value = "{{name}}"{{#isOAuth}}, scopes = [{{#scopes}}AuthorizationScope(scope = "{{scope}}", description = "{{description}}"){{#hasMore}}, {{/hasMore}}{{/scopes}}]{{/isOAuth}}){{#hasMore}}, {{/hasMore}}{{/authMethods}}]{{/hasAuthMethods}}) + @ApiResponses( + value = [{{#responses}}ApiResponse(code = {{{code}}}, message = "{{{message}}}"{{#baseType}}, response = {{{baseType}}}::class{{/baseType}}{{#containerType}}, responseContainer = "{{{containerType}}}"{{/containerType}}){{#hasMore}},{{/hasMore}}{{/responses}}]){{/swaggerAnnotations}} + @RequestMapping( + value = ["{{#lambda.escapeDoubleQuote}}{{path}}{{/lambda.escapeDoubleQuote}}"],{{#singleContentTypes}}{{#hasProduces}} + produces = "{{{vendorExtensions.x-accepts}}}", {{/hasProduces}}{{#hasConsumes}} + consumes = "{{{vendorExtensions.x-contentType}}}",{{/hasConsumes}}{{/singleContentTypes}}{{^singleContentTypes}}{{#hasProduces}} + produces = [{{#produces}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/produces}}], {{/hasProduces}}{{#hasConsumes}} + consumes = [{{#consumes}}"{{{mediaType}}}"{{#hasMore}}, {{/hasMore}}{{/consumes}}],{{/hasConsumes}}{{/singleContentTypes}} + method = [RequestMethod.{{httpMethod}}]) + fun {{operationId}}({{#allParams}}{{>queryParams}}{{>pathParams}}{{>headerParams}}{{>bodyParams}}{{>formParams}}{{#hasMore}},{{/hasMore}}{{/allParams}}): ResponseEntity<{{>returnTypes}}> { + return {{>returnValue}} + } +{{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationModel.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationModel.mustache new file mode 100644 index 00000000000..0564f1e3630 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationModel.mustache @@ -0,0 +1,20 @@ +{{#pattern}}@get:Pattern(regexp="{{{pattern}}}") {{/pattern}}{{! +minLength && maxLength set +}}{{#minLength}}{{#maxLength}}@get:Size(min={{minLength}},max={{maxLength}}) {{/maxLength}}{{/minLength}}{{! +minLength set, maxLength not +}}{{#minLength}}{{^maxLength}}@get:Size(min={{minLength}}) {{/maxLength}}{{/minLength}}{{! +minLength not set, maxLength set +}}{{^minLength}}{{#maxLength}}@get:Size(max={{maxLength}}) {{/maxLength}}{{/minLength}}{{! +@Size: minItems && maxItems set +}}{{#minItems}}{{#maxItems}}@get:Size(min={{minItems}},max={{maxItems}}) {{/maxItems}}{{/minItems}}{{! +@Size: minItems set, maxItems not +}}{{#minItems}}{{^maxItems}}@get:Size(min={{minItems}}) {{/maxItems}}{{/minItems}}{{! +@Size: minItems not set && maxItems set +}}{{^minItems}}{{#maxItems}}@get:Size(max={{maxItems}}) {{/maxItems}}{{/minItems}}{{! +check for integer or long / all others=decimal type with @Decimal* +isInteger set +}}{{#isInteger}}{{#minimum}}@get:Min({{minimum}}){{/minimum}}{{#maximum}} @get:Max({{maximum}}) {{/maximum}}{{/isInteger}}{{! +isLong set +}}{{#isLong}}{{#minimum}}@get:Min({{minimum}}L){{/minimum}}{{#maximum}} @get:Max({{maximum}}L) {{/maximum}}{{/isLong}}{{! +Not Integer, not Long => we have a decimal value! +}}{{^isInteger}}{{^isLong}}{{#minimum}}@get:DecimalMin("{{minimum}}"){{/minimum}}{{#maximum}} @get:DecimalMax("{{maximum}}") {{/maximum}}{{/isLong}}{{/isInteger}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationPath.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationPath.mustache new file mode 100644 index 00000000000..4b7b561ce70 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationPath.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/kotlin-spring/beanValidationPathParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationPathParams.mustache new file mode 100644 index 00000000000..3c57e76be1a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationPathParams.mustache @@ -0,0 +1 @@ +{{! PathParam is always required, no @NotNull necessary }}{{>beanValidationPath}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationQueryParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationQueryParams.mustache new file mode 100644 index 00000000000..cc53bc96232 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/beanValidationQueryParams.mustache @@ -0,0 +1 @@ +{{#required}}@NotNull {{/required}}{{>beanValidationPath}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache new file mode 100644 index 00000000000..c05599c7b02 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/bodyParams.mustache @@ -0,0 +1 @@ +{{#isBodyParam}}{{#swaggerAnnotations}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}} {{^isContainer}}{{#allowableValues}}, allowableValues="{{{allowableValues}}}"{{/allowableValues}}{{/isContainer}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/swaggerAnnotations}} {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestBody {{paramName}}: {{^reactive}}{{>optionalDataType}}{{/reactive}}{{#reactive}}{{^isListContainer}}Mono{{/isListContainer}}{{#isListContainer}}Flux{{/isListContainer}}<{{{baseType}}}>{{/reactive}}{{/isBodyParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache new file mode 100644 index 00000000000..5a8079786c5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClass.mustache @@ -0,0 +1,34 @@ +/** + * {{{description}}} +{{#vars}} + * @param {{name}} {{{description}}} +{{/vars}} + */{{#discriminator}} +{{>typeInfoAnnotation}}{{/discriminator}} +{{#discriminator}}interface {{classname}}{{/discriminator}}{{^discriminator}}data class {{classname}} ( +{{#requiredVars}} +{{>dataClassReqVar}}{{^-last}}, +{{/-last}}{{/requiredVars}}{{#hasRequired}}{{#hasOptional}}, +{{/hasOptional}}{{/hasRequired}}{{#optionalVars}}{{>dataClassOptVar}}{{^-last}}, +{{/-last}}{{/optionalVars}} +) {{/discriminator}}{{#parent}}: {{{parent}}}{{/parent}}{ +{{#discriminator}} + {{#requiredVars}} + {{>interfaceReqVar}} + {{/requiredVars}} + {{#optionalVars}} + {{>interfaceOptVar}} + {{/optionalVars}} +{{/discriminator}} +{{#hasEnums}}{{#vars}}{{#isEnum}} + /** + * {{{description}}} + * Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} + */ + enum class {{nameInCamelCase}}(val value: {{{dataType}}}) { + {{#allowableValues}}{{#enumVars}} + @JsonProperty({{{value}}}) {{{name}}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} + {{/enumVars}}{{/allowableValues}} + } +{{/isEnum}}{{/vars}}{{/hasEnums}} +} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache new file mode 100644 index 00000000000..767595052b7 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassOptVar.mustache @@ -0,0 +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 diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache new file mode 100644 index 00000000000..f53fadc9b18 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/dataClassReqVar.mustache @@ -0,0 +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 diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/enumClass.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/enumClass.mustache new file mode 100644 index 00000000000..2f24a1de76b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/enumClass.mustache @@ -0,0 +1,9 @@ +/** +* {{{description}}} +* Values: {{#allowableValues}}{{#enumVars}}{{&name}}{{^-last}},{{/-last}}{{/enumVars}}{{/allowableValues}} +*/ +enum class {{classname}}(val value: {{dataType}}) { +{{#allowableValues}}{{#enumVars}} + {{&name}}({{{value}}}){{^-last}},{{/-last}}{{#-last}};{{/-last}} +{{/enumVars}}{{/allowableValues}} +} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/exceptions.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/exceptions.mustache new file mode 100644 index 00000000000..d85b8396fa5 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/exceptions.mustache @@ -0,0 +1,29 @@ +package {{apiPackage}} + +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/modules/openapi-generator/src/main/resources/kotlin-spring/formParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/formParams.mustache new file mode 100644 index 00000000000..f7b992616a2 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/formParams.mustache @@ -0,0 +1 @@ +{{#isFormParam}}{{^isFile}}{{#swaggerAnnotations}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/swaggerAnnotations}} @RequestParam(value="{{baseName}}"{{#required}}, required=true{{/required}}{{^required}}, required=false{{/required}}) {{paramName}}: {{>optionalDataType}} {{/isFile}}{{#isFile}}{{#swaggerAnnotations}}@ApiParam(value = "file detail"){{/swaggerAnnotations}} {{#useBeanValidation}}@Valid{{/useBeanValidation}} @RequestPart("file") {{baseName}}: MultipartFile{{/isFile}}{{/isFormParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache new file mode 100644 index 00000000000..aa702dc4546 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/headerParams.mustache @@ -0,0 +1 @@ +{{#isHeaderParam}}{{#swaggerAnnotations}}@ApiParam(value = "{{{description}}}" {{#required}},required=true{{/required}}{{#allowableValues}}, allowableValues="{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/swaggerAnnotations}} @RequestHeader(value="{{baseName}}", required={{#required}}true{{/required}}{{^required}}false{{/required}}) {{paramName}}: {{>optionalDataType}}{{/isHeaderParam}} \ 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 new file mode 100644 index 00000000000..8db4ba7698f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceOptVar.mustache @@ -0,0 +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 diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache new file mode 100644 index 00000000000..5f6eea31139 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/interfaceReqVar.mustache @@ -0,0 +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 diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/README.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/README.mustache new file mode 100644 index 00000000000..c25481e376b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/README.mustache @@ -0,0 +1,21 @@ +# {{#title}}{{title}}{{/title}}{{^title}}Generated Kotlin Spring Boot App{{/title}} + +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/{{artifactId}}-{{artifactVersion}}.jar +``` + +To build the project using gradle, run: +```bash +gradle build && java -jar build/libs/{{artifactId}}-{{artifactVersion}}.jar +``` + +If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:{{serverPort}}/) diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/application.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/application.mustache new file mode 100644 index 00000000000..9bc4fb4c27c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/application.mustache @@ -0,0 +1,10 @@ +spring: + application: + name: {{title}} + + jackson: + serialization: + WRITE_DATES_AS_TIMESTAMPS: false + +server: + port: {{serverPort}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache new file mode 100644 index 00000000000..a36b054d633 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/buildGradleKts.mustache @@ -0,0 +1,48 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +buildscript { + repositories { + jcenter() + mavenCentral() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + } +} + +group = "{{groupId}}" +version = "{{artifactVersion}}" + +repositories { + jcenter() + mavenCentral() +} + +tasks.withType { + kotlinOptions.jvmTarget = "1.8" +} + +plugins { + val kotlinVersion = "1.2.60" + id("org.jetbrains.kotlin.jvm") version kotlinVersion + id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion + id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion + id("org.springframework.boot") version "2.0.3.RELEASE" + id("io.spring.dependency-management") version "1.0.5.RELEASE" +} + +dependencies { + compile("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + compile("org.jetbrains.kotlin:kotlin-reflect") + compile("org.springframework.boot:spring-boot-starter-web") +{{#swaggerAnnotations}} + compile("io.swagger:swagger-annotations:1.5.21") +{{/swaggerAnnotations}} + compile("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml") + compile("com.fasterxml.jackson.dataformat:jackson-dataformat-xml") + compile("com.fasterxml.jackson.module:jackson-module-kotlin") + + testCompile("org.springframework.boot:spring-boot-starter-test") { + exclude(module = "junit") + } +} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache new file mode 100644 index 00000000000..bc74aa267d9 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/pom.mustache @@ -0,0 +1,113 @@ + + 4.0.0 + {{groupId}} + {{artifactId}} + jar + {{artifactId}} + {{artifactVersion}} + + 1.2.60 + + + org.springframework.boot + spring-boot-starter-parent + 2.0.3.RELEASE + + + ${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 + + {{#swaggerAnnotations}} + + io.swagger + swagger-annotations + 1.5.21 + + {{/swaggerAnnotations}} + + 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 + + {{#useBeanValidation}} + + + javax.validation + validation-api + + {{/useBeanValidation}} + + diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/settingsGradle.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/settingsGradle.mustache new file mode 100644 index 00000000000..b8fd6c4c41f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/settingsGradle.mustache @@ -0,0 +1 @@ +rootProject.name = "{{artifactId}}" \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/springBootApplication.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/springBootApplication.mustache new file mode 100644 index 00000000000..5b0d62ebf0a --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/libraries/spring-boot/springBootApplication.mustache @@ -0,0 +1,14 @@ +package {{basePackage}} + +import org.springframework.boot.runApplication +import org.springframework.context.annotation.ComponentScan +import org.springframework.boot.autoconfigure.SpringBootApplication + + +@SpringBootApplication +@ComponentScan(basePackages = ["{{basePackage}}", "{{apiPackage}}", "{{modelPackage}}"]) +class Application + +fun main(args: Array) { + runApplication(*args) +} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/model.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/model.mustache new file mode 100644 index 00000000000..37e21201cff --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/model.mustache @@ -0,0 +1,18 @@ +package {{package}} + +import java.util.Objects +{{#imports}}import {{import}} +{{/imports}} +{{#useBeanValidation}} +import javax.validation.Valid +import javax.validation.constraints.* +{{/useBeanValidation}} +{{#swaggerAnnotations}} +import io.swagger.annotations.ApiModelProperty +{{/swaggerAnnotations}} + +{{#models}} +{{#model}} +{{#isEnum}}{{>enumClass}}{{/isEnum}}{{^isEnum}}{{>dataClass}}{{/isEnum}} +{{/model}} +{{/models}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/optionalDataType.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/optionalDataType.mustache new file mode 100644 index 00000000000..7c026fa826f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/optionalDataType.mustache @@ -0,0 +1 @@ +{{#required}}{{{dataType}}}{{/required}}{{^required}}{{#defaultValue}}{{{dataType}}}{{/defaultValue}}{{^defaultValue}}{{{dataType}}}?{{/defaultValue}}{{/required}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/pathParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/pathParams.mustache new file mode 100644 index 00000000000..d83b2d0469e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/pathParams.mustache @@ -0,0 +1 @@ +{{#isPathParam}}{{#useBeanValidation}}{{>beanValidationPathParams}}{{/useBeanValidation}}{{#swaggerAnnotations}}@ApiParam(value = "{{{description}}}"{{#required}}, required=true{{/required}}{{#allowableValues}}, allowableValues = "{{#enumVars}}{{#lambda.escapeDoubleQuote}}{{{value}}}{{/lambda.escapeDoubleQuote}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/enumVars}}"{{/allowableValues}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}){{/swaggerAnnotations}} @PathVariable("{{baseName}}") {{paramName}}: {{>optionalDataType}}{{/isPathParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache new file mode 100644 index 00000000000..ecceefb0856 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/queryParams.mustache @@ -0,0 +1 @@ +{{#isQueryParam}}{{#useBeanValidation}}{{>beanValidationQueryParams}}{{/useBeanValidation}}{{#swaggerAnnotations}}@ApiParam(value = "{{{description}}}"{{#required}}, required = true{{/required}}{{#allowableValues}}, allowableValues = "{{#values}}{{{.}}}{{^-last}}, {{/-last}}{{#-last}}{{/-last}}{{/values}}"{{/allowableValues}}{{#defaultValue}}, defaultValue = "{{{defaultValue}}}"{{/defaultValue}}) {{#useBeanValidation}}@Valid{{/useBeanValidation}}{{/swaggerAnnotations}} @RequestParam(value = "{{baseName}}"{{#required}}, required = true{{/required}}{{^required}}, required = false{{/required}}{{#defaultValue}}, defaultValue="{{{defaultValue}}}"{{/defaultValue}}) {{paramName}}: {{>optionalDataType}}{{/isQueryParam}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/returnTypes.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/returnTypes.mustache new file mode 100644 index 00000000000..67d79cc198c --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/returnTypes.mustache @@ -0,0 +1 @@ +{{#isMapContainer}}{{#reactive}}Mono<{{/reactive}}Map{{/reactive}}>{{/isMapContainer}}{{#isListContainer}}{{#reactive}}Flux{{/reactive}}{{^reactive}}List{{/reactive}}<{{{returnType}}}>{{/isListContainer}}{{^returnContainer}}{{#reactive}}Mono<{{{returnType}}}>{{/reactive}}{{^reactive}}{{{returnType}}}{{/reactive}}{{/returnContainer}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/returnValue.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/returnValue.mustache new file mode 100644 index 00000000000..4973c83431d --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/returnValue.mustache @@ -0,0 +1 @@ +{{#serviceInterface}}ResponseEntity(service.{{operationId}}({{#allParams}}{{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}}), HttpStatus.OK){{/serviceInterface}}{{^serviceInterface}}ResponseEntity(HttpStatus.NOT_IMPLEMENTED){{/serviceInterface}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache new file mode 100644 index 00000000000..32bb190ea6b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/service.mustache @@ -0,0 +1,13 @@ +package {{package}} + +{{#imports}}import {{import}} +{{/imports}} + +{{#operations}} +interface {{classname}}Service { +{{#operation}} + + fun {{operationId}}({{#allParams}}{{paramName}}: {{^isFile}}{{>optionalDataType}}{{/isFile}}{{#isFile}}org.springframework.web.multipart.MultipartFile{{/isFile}}{{#hasMore}},{{/hasMore}}{{/allParams}}): {{>returnTypes}} +{{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache new file mode 100644 index 00000000000..d3dcedb061e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/serviceImpl.mustache @@ -0,0 +1,17 @@ +package {{package}} + +{{#imports}}import {{import}} +{{/imports}} +import org.springframework.stereotype.Service + +@Service +{{#operations}} +class {{classname}}ServiceImpl : {{classname}}Service { +{{#operation}} + + override fun {{operationId}}({{#allParams}}{{paramName}}: {{^isFile}}{{>optionalDataType}}{{/isFile}}{{#isFile}}org.springframework.web.multipart.MultipartFile{{/isFile}}{{#hasMore}},{{/hasMore}}{{/allParams}}): {{>returnTypes}} { + TODO("Implement me") + } +{{/operation}} +} +{{/operations}} diff --git a/modules/openapi-generator/src/main/resources/kotlin-spring/typeInfoAnnotation.mustache b/modules/openapi-generator/src/main/resources/kotlin-spring/typeInfoAnnotation.mustache new file mode 100644 index 00000000000..a110d9ea9cf --- /dev/null +++ b/modules/openapi-generator/src/main/resources/kotlin-spring/typeInfoAnnotation.mustache @@ -0,0 +1,8 @@ +{{#jackson}} + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "{{{discriminatorName}}}", visible = true) +@JsonSubTypes( + {{#discriminator.mappedModels}} + JsonSubTypes.Type(value = {{modelName}}::class, name = "{{^vendorExtensions.x-discriminator-value}}{{mappingName}}{{/vendorExtensions.x-discriminator-value}}{{#vendorExtensions.x-discriminator-value}}{{{vendorExtensions.x-discriminator-value}}}{{/vendorExtensions.x-discriminator-value}}"){{^-last}},{{/-last}} + {{/discriminator.mappedModels}} +){{/jackson}} diff --git a/modules/openapi-generator/src/main/resources/lumen/readme.md b/modules/openapi-generator/src/main/resources/lumen/readme.md index cd61e963163..e0dba8a2f5c 100644 --- a/modules/openapi-generator/src/main/resources/lumen/readme.md +++ b/modules/openapi-generator/src/main/resources/lumen/readme.md @@ -20,3 +20,8 @@ Using `composer update` to install the framework and dependencies via [Composer] The `composer update` should be the first thing to do right after generating Lumen server stub. The autoload.php will be generated only after excuting `composer update`. Or there would be errors during service or model migration. +### Running the generated server stub + +```bash +php -S localhost:8080 public/index.php +``` diff --git a/modules/openapi-generator/src/main/resources/mysql-schema/README.mustache b/modules/openapi-generator/src/main/resources/mysql-schema/README.mustache new file mode 100644 index 00000000000..54bda8398ac --- /dev/null +++ b/modules/openapi-generator/src/main/resources/mysql-schema/README.mustache @@ -0,0 +1,48 @@ +# MySQL Schema Codegen + +Main goal of this generator is to provide database structure file almost identical you usually generate with: +- PHPMyAdmin (Export structure only, SQL syntax) +- Adminer +- `mysqldump` function + +[MySQL documentation](https://dev.mysql.com/doc/) + +## Requirements +- MySQL Server ^5.7.8 (`JSON` column type added) + +## Openapi Data Type to MySQL Data Type mapping + +| Openapi Data Type | Openapi Data Format | Dependent properties | MySQL Data Types | Default MySQL Data Type | +| --- | --- | --- | --- | --- | +| `integer` | `int32` | `minimum` / `maximum` / `minimumExclusive` / `maximumExclusive` | `TINYINT` / `SMALLINT` / `MEDIUMINT`/ `INT` / `BIGINT` | `INT` | +| `integer` | `int64` | `minimum` / `maximum` / `minimumExclusive` / `maximumExclusive` | `TINYINT` / `SMALLINT` / `MEDIUMINT` / `INT` / `BIGINT` | `BIGINT` | +| `boolean` | | | `TINYINT` | `TINYINT` | +| `number` | `float` | | `DECIMAL` | `DECIMAL` | +| `number` | `double` | | `DECIMAL` | `DECIMAL` | +| `string` | | `minLength` / `maxLength` | `CHAR` / `VARCHAR` / `TEXT` / `MEDIUMTEXT` / `LONGTEXT` | `TEXT` | +| `string` | `byte` | | `TEXT` | `TEXT` | +| `string` | `binary` | | `MEDIUMBLOB` | `MEDIUMBLOB` | +| `file` | | | `MEDIUMBLOB` | `MEDIUMBLOB` | +| `string` | `date` | | `DATE` | `DATE` | +| `string` | `date-time` | | `DATETIME` | `DATETIME` | +| `string` | `enum` | | `ENUM` | `ENUM` | +| `array` | | | `JSON` | `JSON` | +| `object` | | | `JSON` | `JSON` | +| `\Model\User` (referenced definition) | | | `TEXT` | `TEXT` | + +## How to use + +Produced file(`mysql_schema.sql`) contains every table definition. Current implementation doesn't drop or modify existed tables, if you want rewrite whole schema make sure they're not presented. + +### PHPMyAdmin + +1. Choose **Import** tab from the home screen +2. In section **File to import** click to **Choose File** and find generated `mysql_schema.sql` +3. Make sure **Format** selector set to **SQL** +4. Push **Go** button + +### Adminer + +1. Click **Import** link in left sidebar +2. In **File upload** fieldset click to **Choose Files** and find generated `mysql_schema.sql` +3. Push **Execute** button diff --git a/modules/openapi-generator/src/main/resources/mysql-schema/mysql_schema.mustache b/modules/openapi-generator/src/main/resources/mysql-schema/mysql_schema.mustache new file mode 100644 index 00000000000..180e2c853f1 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/mysql-schema/mysql_schema.mustache @@ -0,0 +1,45 @@ +/* SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; */ +/* SET AUTOCOMMIT = 0; */ +/* START TRANSACTION; */ +/* SET time_zone = "+00:00"; */ +{{#defaultDatabaseName}} +-- +-- Database: `{{{defaultDatabaseName}}}` +-- +CREATE DATABASE IF NOT EXISTS `{{{defaultDatabaseName}}}` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; +{{/defaultDatabaseName}} + +-- -------------------------------------------------------- + +{{#models}}{{#model}}{{#hasVars}}{{^isArrayModel}}-- +-- Table structure{{#vendorExtensions}}{{#x-mysqlSchema}}{{#tableDefinition}} for table `{{tblName}}`{{/tableDefinition}}{{/x-mysqlSchema}}{{/vendorExtensions}} generated from model '{{classVarName}}' +{{#description}} +-- {{description}} +{{/description}} +-- + +{{#vendorExtensions}} +{{#x-mysqlSchema}} +{{#tableDefinition}} +CREATE TABLE IF NOT EXISTS {{#defaultDatabaseName}}`{{{defaultDatabaseName}}}`.{{/defaultDatabaseName}}`{{tblName}}` ( +{{/tableDefinition}} +{{/x-mysqlSchema}} +{{/vendorExtensions}} + {{#vars}} + {{#vendorExtensions}} + {{#x-mysqlSchema}} + {{#columnDefinition}} + `{{colName}}` {{colDataType}}{{#colDataTypeArguments}}{{#-first}}({{/-first}}{{#isString}}'{{/isString}}{{argumentValue}}{{#isString}}'{{/isString}}{{^-last}}, {{/-last}}{{#-last}}){{/-last}}{{/colDataTypeArguments}}{{#colUnsigned}} UNSIGNED{{/colUnsigned}}{{#colNotNull}} NOT NULL{{/colNotNull}}{{#colDefault}} DEFAULT {{#isString}}'{{defaultValue}}'{{/isString}}{{^isString}}{{defaultValue}}{{/isString}}{{/colDefault}}{{#colComment}} COMMENT '{{colComment}}'{{/colComment}}{{^-last}},{{/-last}} + {{/columnDefinition}} + {{/x-mysqlSchema}} + {{/vendorExtensions}} + {{/vars}} +{{#vendorExtensions}} +{{#x-mysqlSchema}} +{{#tableDefinition}} +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci{{#tblComment}} COMMENT='{{tblComment}}'{{/tblComment}}; +{{/tableDefinition}} +{{/x-mysqlSchema}} +{{/vendorExtensions}} + +{{/isArrayModel}}{{/hasVars}}{{/model}}{{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/AbstractApiController.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/AbstractApiController.mustache index c058491dd4e..ab214f671fa 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/AbstractApiController.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/AbstractApiController.mustache @@ -44,7 +44,8 @@ namespace {{invokerPackage}}; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -abstract class AbstractApiController { +abstract class {{abstractNamePrefix}}ApiController{{abstractNameSuffix}} +{ /** * @var \Interop\Container\ContainerInterface Slim app container instance @@ -56,8 +57,8 @@ abstract class AbstractApiController { * * @param \Interop\Container\ContainerInterface $container Slim app container instance */ - public function __construct($container) { + public function __construct($container) + { $this->container = $container; } - } diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/README.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/README.mustache index c8375231584..dfb808782b0 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/README.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/README.mustache @@ -5,7 +5,7 @@ ## Requirements * Web server with URL rewriting -* PHP 5.5 or newer +* PHP 5.5.9 or newer This package contains `.htaccess` for Apache configuration. If you use another server(Nginx, HHVM, IIS, lighttpd) check out [Web Servers](https://www.slimframework.com/docs/v3/start/web-servers.html) doc. @@ -30,15 +30,20 @@ $ php -S localhost:8888 -t php-slim-server ## Run tests -This package uses PHPUnit 4.8 for unit testing. +This package uses PHPUnit 4.8 for unit testing and PHP Codesniffer to check source code against user defined coding standard(`phpcsStandard` generator config option). [Test folder]({{testBasePath}}) contains templates which you can fill with real test assertions. How to write tests read at [PHPUnit Manual - Chapter 2. Writing Tests for PHPUnit](https://phpunit.de/manual/4.8/en/writing-tests-for-phpunit.html). +How to configure PHP CodeSniffer read at [PHP CodeSniffer Documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki). +There is [phplint](https://github.com/overtrue/phplint) tool to check php syntax automatically. Command | Tool | Target ---- | ---- | ---- `$ composer test` | PHPUnit | All tests `$ composer run test-apis` | PHPUnit | Apis tests `$ composer run test-models` | PHPUnit | Models tests +`$ composer run phpcs` | PHP CodeSniffer | All files +`$ composer run phplint` | phplint | All files + {{#generateApiDocs}} ## API Endpoints diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache index 11eb61d5ac8..18ee144e6d5 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/SlimRouter.mustache @@ -10,7 +10,7 @@ * @link https://github.com/openapitools/openapi-generator */ -/**{{#apiInfo}}{{#appName}} +/**{{#apiInfo}}{{#appName}} * {{{appName}}} * {{/appName}} @@ -51,7 +51,8 @@ use Tuupola\Middleware\HttpBasicAuthentication; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -class SlimRouter { +class SlimRouter +{ /** * @var $slimApp Slim\App instance @@ -64,7 +65,8 @@ class SlimRouter { * @param ContainerInterface|array $container Either a ContainerInterface or an associative array of app settings * @throws InvalidArgumentException when no container is provided that implements ContainerInterface */ - public function __construct($container = []) { + public function __construct($container = []) + { $app = new App($container); $basicAuth = new HttpBasicAuthentication([ @@ -80,7 +82,8 @@ class SlimRouter { {{#operations}} {{#operation}} $app->{{httpMethod}}( - '{{{basePathWithoutHost}}}{{{path}}}', {{classname}}::class . ':{{operationId}}' + '{{{basePathWithoutHost}}}{{{path}}}', + {{classname}}::class . ':{{operationId}}' {{#hasAuthMethods}} {{#authMethods}} {{#isBasic}} @@ -101,7 +104,8 @@ class SlimRouter { * Returns Slim Framework instance * @return App */ - public function getSlimApp() { + public function getSlimApp() + { return $this->slimApp; } } diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/api.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/api.mustache index 84e2b6a1acd..832374d761b 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/api.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/api.mustache @@ -34,7 +34,7 @@ */ namespace {{apiPackage}}; -use {{invokerPackage}}\AbstractApiController; +use {{invokerPackage}}\{{abstractNamePrefix}}ApiController{{abstractNameSuffix}}; /** * {{classname}} Class Doc Comment @@ -46,14 +46,19 @@ use {{invokerPackage}}\AbstractApiController; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -class {{classname}} extends AbstractApiController { - +class {{classname}} extends {{abstractNamePrefix}}ApiController{{abstractNameSuffix}} +{ {{#operations}} {{#operation}} + /** * {{httpMethod}} {{operationId}} + {{#summary}} * Summary: {{summary}} + {{/summary}} + {{#notes}} * Notes: {{notes}} + {{/notes}} {{#hasProduces}} * Output-Formats: [{{#produces}}{{{mediaType}}}{{#hasMore}}, {{/hasMore}}{{/produces}}] {{/hasProduces}} @@ -62,7 +67,8 @@ class {{classname}} extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function {{operationId}}($request, $response, $args) { + public function {{operationId}}($request, $response, $args) + { {{#hasHeaderParams}} $headers = $request->getHeaders(); {{#headerParams}} @@ -96,7 +102,6 @@ class {{classname}} extends AbstractApiController { $response->write('How about implementing {{nickname}} as a {{httpMethod}} method ?'); return $response; } - {{#hasMore}}{{/hasMore}} {{/operation}} {{/operations}} } diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/api_test.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/api_test.mustache index ecc80a622c7..234cbb5a636 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/api_test.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/api_test.mustache @@ -45,34 +45,35 @@ use {{apiPackage}}\{{classname}}; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \{{modelPackage}}\{{classname}} */ -{{#operations}}class {{classname}}Test extends \PHPUnit_Framework_TestCase { +{{#operations}}class {{classname}}Test extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } {{#operation}} @@ -82,8 +83,8 @@ use {{apiPackage}}\{{classname}}; * {{{summary}}}. * @covers ::{{{operationId}}} */ - public function test{{operationIdCamelCase}}() { - + public function test{{operationIdCamelCase}}() + { } {{/operation}} } diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/composer.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/composer.mustache index a27e79ec42f..90e61d50f0f 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/composer.mustache @@ -1,12 +1,14 @@ { "minimum-stability": "RC", "require": { - "php": ">=5.5", + "php": ">=5.5.9", "slim/slim": "3.*", "tuupola/slim-basic-auth": "^3.0.0" }, "require-dev": { - "phpunit/phpunit": "^4.8" + "phpunit/phpunit": "^4.8", + "overtrue/phplint": "^1.0", + "squizlabs/php_codesniffer": "^3.0" }, "autoload": { "psr-4": { "{{escapedInvokerPackage}}\\": "{{srcBasePath}}/" } @@ -20,6 +22,8 @@ "@test-models" ], "test-apis": "phpunit --testsuite Apis", - "test-models": "phpunit --testsuite Models" + "test-models": "phpunit --testsuite Models", + "phpcs": "phpcs ./ --ignore=vendor --warning-severity=0 --standard={{phpcsStandard}}", + "phplint": "phplint ./ --exclude=vendor" } -} \ No newline at end of file +} diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/model.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/model.mustache index 94fd28ef53f..a1f40f818fb 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/model.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/model.mustache @@ -7,12 +7,12 @@ namespace {{modelPackage}}; /** * {{classname}} */ -class {{classname}} { - +class {{classname}} +{ {{#vars}} + /** @var {{dataType}} ${{name}} {{#description}}{{description}}{{/description}}*/ private ${{name}}; - {{/vars}} } {{/model}}{{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/php-slim-server/model_test.mustache b/modules/openapi-generator/src/main/resources/php-slim-server/model_test.mustache index cc559bd1c6b..ea2518ef742 100644 --- a/modules/openapi-generator/src/main/resources/php-slim-server/model_test.mustache +++ b/modules/openapi-generator/src/main/resources/php-slim-server/model_test.mustache @@ -47,40 +47,42 @@ use {{modelPackage}}\{{classname}}; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \{{modelPackage}}\{{classname}} */ -class {{classname}}Test extends \PHPUnit_Framework_TestCase { +class {{classname}}Test extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "{{classname}}" */ - public function test{{classname}}() { + public function test{{classname}}() + { $test{{classname}} = new {{classname}}(); } {{#vars}} @@ -88,9 +90,9 @@ class {{classname}}Test extends \PHPUnit_Framework_TestCase { /** * Test attribute "{{name}}" */ - public function testProperty{{nameInCamelCase}}() { - + public function testProperty{{nameInCamelCase}}() + { } {{/vars}} } -{{/model}}{{/models}} +{{/model}}{{/models}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/php-symfony/api_controller.mustache b/modules/openapi-generator/src/main/resources/php-symfony/api_controller.mustache index 6da34c82b68..3ab32095ec5 100644 --- a/modules/openapi-generator/src/main/resources/php-symfony/api_controller.mustache +++ b/modules/openapi-generator/src/main/resources/php-symfony/api_controller.mustache @@ -87,6 +87,10 @@ class {{controllerName}} extends Controller // Set key with prefix in query string $security{{name}} = $request->query->get('{{keyParamName}}'); {{/isKeyInQuery}} + {{#isKeyInCookie}} + // Set key with prefix in cookies + $security{{name}} = $request->cookies->get('{{keyParamName}}'); + {{/isKeyInCookie}} {{/isApiKey}} {{#isBasic}} // HTTP basic authentication required diff --git a/modules/openapi-generator/src/main/resources/php/.php_cs b/modules/openapi-generator/src/main/resources/php/.php_cs index 6b8e23c818a..4fbe53ec5ff 100644 --- a/modules/openapi-generator/src/main/resources/php/.php_cs +++ b/modules/openapi-generator/src/main/resources/php/.php_cs @@ -1,18 +1,23 @@ level(Symfony\CS\FixerInterface::PSR2_LEVEL) +return PhpCsFixer\Config::create() ->setUsingCache(true) - ->fixers( - [ - 'ordered_use', - 'phpdoc_order', - 'short_array_syntax', - 'strict', - 'strict_param' - ] - ) - ->finder( - Symfony\CS\Finder\DefaultFinder::create() - ->in(__DIR__) + ->setRules([ + '@PSR2' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('test') + ->exclude('tests') + ->in(__DIR__) ); diff --git a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache index 3b526da5fec..3ab026909ec 100644 --- a/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache +++ b/modules/openapi-generator/src/main/resources/php/ObjectSerializer.mustache @@ -19,6 +19,8 @@ namespace {{invokerPackage}}; +use {{modelPackage}}\ModelInterface; + /** * ObjectSerializer Class Doc Comment * @@ -51,19 +53,25 @@ class ObjectSerializer return $data; } elseif (is_object($data)) { $values = []; - $formats = $data::openAPIFormats(); - foreach ($data::openAPITypes() as $property => $openAPIType) { - $getter = $data::getters()[$property]; - $value = $data->$getter(); - if ($value !== null - && !in_array($openAPIType, [{{&primitives}}], true) - && method_exists($openAPIType, 'getAllowableEnumValues') - && !in_array($value, $openAPIType::getAllowableEnumValues())) { - $imploded = implode("', '", $openAPIType::getAllowableEnumValues()); - throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null + && !in_array($openAPIType, [{{&primitives}}], true) + && method_exists($openAPIType, 'getAllowableEnumValues') + && !in_array($value, $openAPIType::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $openAPIType::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + if ($value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } } - if ($value !== null) { - $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); } } return (object)$values; @@ -220,6 +228,8 @@ class ObjectSerializer if (null === $data) { return null; } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); $inner = substr($class, 4, -1); $deserialized = []; if (strrpos($inner, ",") !== false) { @@ -231,6 +241,7 @@ class ObjectSerializer } return $deserialized; } elseif (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; $subClass = substr($class, 0, -2); $values = []; foreach ($data as $key => $value) { @@ -274,12 +285,13 @@ class ObjectSerializer return new \SplFileObject($filename, 'r'); } elseif (method_exists($class, 'getAllowableEnumValues')) { - if (!in_array($data, $class::getAllowableEnumValues())) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { $imploded = implode("', '", $class::getAllowableEnumValues()); throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); } return $data; } else { + $data = is_string($data) ? json_decode($data) : $data; // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { diff --git a/modules/openapi-generator/src/main/resources/php/api.mustache b/modules/openapi-generator/src/main/resources/php/api.mustache index 776ebc14207..4f1fc87045e 100644 --- a/modules/openapi-generator/src/main/resources/php/api.mustache +++ b/modules/openapi-generator/src/main/resources/php/api.mustache @@ -166,9 +166,6 @@ use {{invokerPackage}}\ObjectSerializer; $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('{{dataType}}' !== 'string') { - $content = json_decode($content); - } } return [ @@ -188,9 +185,6 @@ use {{invokerPackage}}\ObjectSerializer; $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -280,9 +274,6 @@ use {{invokerPackage}}\ObjectSerializer; $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -453,10 +444,10 @@ use {{invokerPackage}}\ObjectSerializer; // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { diff --git a/modules/openapi-generator/src/main/resources/php/composer.mustache b/modules/openapi-generator/src/main/resources/php/composer.mustache index 8d9b8f4674d..e4860c99bf1 100644 --- a/modules/openapi-generator/src/main/resources/php/composer.mustache +++ b/modules/openapi-generator/src/main/resources/php/composer.mustache @@ -21,7 +21,7 @@ } ], "require": { - "php": ">=5.5", + "php": ">=5.6", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", @@ -30,7 +30,7 @@ "require-dev": { "phpunit/phpunit": "^4.8", "squizlabs/php_codesniffer": "~2.6", - "friendsofphp/php-cs-fixer": "~1.12" + "friendsofphp/php-cs-fixer": "~2.12" }, "autoload": { "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" } diff --git a/modules/openapi-generator/src/main/resources/php/model_generic.mustache b/modules/openapi-generator/src/main/resources/php/model_generic.mustache index 57f557e75a0..85610c2f572 100644 --- a/modules/openapi-generator/src/main/resources/php/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/php/model_generic.mustache @@ -166,7 +166,7 @@ class {{classname}} {{#parentSchema}}extends {{{parent}}} {{/parentSchema}}{{^pa {{#discriminator}} // Initialize discriminator property with the model name. - $discriminator = array_search('{{discriminatorName}}', self::$attributeMap); + $discriminator = array_search('{{discriminatorName}}', self::$attributeMap, true); $this->container[$discriminator] = static::$openAPIModelName; {{/discriminator}} } diff --git a/modules/openapi-generator/src/main/resources/python/api.mustache b/modules/openapi-generator/src/main/resources/python/api.mustache index ff4835b3b19..cfdf88cf094 100644 --- a/modules/openapi-generator/src/main/resources/python/api.mustache +++ b/modules/openapi-generator/src/main/resources/python/api.mustache @@ -99,12 +99,14 @@ class {{classname}}(object): local_var_params[key] = val del local_var_params['kwargs'] {{#allParams}} +{{^isNullable}} {{#required}} # verify the required parameter '{{paramName}}' is set if ('{{paramName}}' not in local_var_params or local_var_params['{{paramName}}'] is None): raise ValueError("Missing the required parameter `{{paramName}}` when calling `{{operationId}}`") # noqa: E501 {{/required}} +{{/isNullable}} {{/allParams}} {{#allParams}} diff --git a/modules/openapi-generator/src/main/resources/python/api_doc.mustache b/modules/openapi-generator/src/main/resources/python/api_doc.mustache index 32c26d929d1..c16779a5f96 100644 --- a/modules/openapi-generator/src/main/resources/python/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_doc.mustache @@ -18,47 +18,14 @@ Method | HTTP request | Description {{{notes}}}{{/notes}} ### Example -```python -from __future__ import print_function -import time -import {{{packageName}}} -from {{{packageName}}}.rest import ApiException -from pprint import pprint -{{#hasAuthMethods}}{{#authMethods}}{{#isBasic}} -# Configure HTTP basic authorization: {{{name}}} -configuration = {{{packageName}}}.Configuration() -configuration.username = 'YOUR_USERNAME' -configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}} -# Configure API key authorization: {{{name}}} -configuration = {{{packageName}}}.Configuration() -configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY' -# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed -# configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} -# Configure OAuth2 access token for authorization: {{{name}}} -configuration = {{{packageName}}}.Configuration() -configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}}{{/authMethods}} - -# create an instance of the API class -api_instance = {{{packageName}}}.{{{classname}}}({{{packageName}}}.ApiClient(configuration)) -{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} -{{/allParams}} +{{#hasAuthMethods}}{{#authMethods}} +{{#isBasic}}* Basic Authentication ({{name}}): {{/isBasic }}{{#isApiKey}}* Api Key Authentication ({{name}}): {{/isApiKey }}{{#isOAuth}}* OAuth Authentication ({{name}}): {{/isOAuth }} +{{> api_doc_example }} +{{/authMethods}} {{/hasAuthMethods}} {{^hasAuthMethods}} - -# create an instance of the API class -api_instance = {{{packageName}}}.{{{classname}}}() -{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} -{{/allParams}} +{{> api_doc_example }} {{/hasAuthMethods}} - -try: -{{#summary}} # {{{.}}} -{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}} - pprint(api_response){{/returnType}} -except ApiException as e: - print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) -``` - ### Parameters {{^allParams}}This endpoint does not need any parameter.{{/allParams}}{{#allParams}}{{#-last}} Name | Type | Description | Notes diff --git a/modules/openapi-generator/src/main/resources/python/api_doc_example.mustache b/modules/openapi-generator/src/main/resources/python/api_doc_example.mustache new file mode 100644 index 00000000000..42e0f32bf73 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/python/api_doc_example.mustache @@ -0,0 +1,40 @@ +```python +from __future__ import print_function +import time +import {{{packageName}}} +from {{{packageName}}}.rest import ApiException +from pprint import pprint +{{#hasAuthMethods}}{{#isBasic}} +# Configure HTTP basic authorization: {{{name}}} +configuration = {{{packageName}}}.Configuration() +configuration.username = 'YOUR_USERNAME' +configuration.password = 'YOUR_PASSWORD'{{/isBasic}}{{#isApiKey}} +# Configure API key authorization: {{{name}}} +configuration = {{{packageName}}}.Configuration() +configuration.api_key['{{{keyParamName}}}'] = 'YOUR_API_KEY' +# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +# configuration.api_key_prefix['{{{keyParamName}}}'] = 'Bearer'{{/isApiKey}}{{#isOAuth}} +# Configure OAuth2 access token for authorization: {{{name}}} +configuration = {{{packageName}}}.Configuration() +configuration.access_token = 'YOUR_ACCESS_TOKEN'{{/isOAuth}} + +# create an instance of the API class +api_instance = {{{packageName}}}.{{{classname}}}({{{packageName}}}.ApiClient(configuration)) +{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} +{{/allParams}} +{{/hasAuthMethods}} +{{^hasAuthMethods}} + +# create an instance of the API class +api_instance = {{{packageName}}}.{{{classname}}}() +{{#allParams}}{{paramName}} = {{{example}}} # {{{dataType}}} | {{{description}}}{{^required}} (optional){{/required}}{{#defaultValue}} (default to {{{.}}}){{/defaultValue}} +{{/allParams}} +{{/hasAuthMethods}} + +try: +{{#summary}} # {{{.}}} +{{/summary}} {{#returnType}}api_response = {{/returnType}}api_instance.{{{operationId}}}({{#allParams}}{{#required}}{{paramName}}{{/required}}{{^required}}{{paramName}}={{paramName}}{{/required}}{{#hasMore}}, {{/hasMore}}{{/allParams}}){{#returnType}} + pprint(api_response){{/returnType}} +except ApiException as e: + print("Exception when calling {{classname}}->{{operationId}}: %s\n" % e) +``` diff --git a/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache b/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache index 8c9d49dc14f..9c1a0cc81db 100644 --- a/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache +++ b/modules/openapi-generator/src/main/resources/python/asyncio/rest.mustache @@ -38,8 +38,6 @@ class RESTClientObject(object): def __init__(self, configuration, pools_size=4, maxsize=4): # maxsize is number of requests to host that are allowed in parallel - # ca_certs vs cert_file vs key_file - # http://stackoverflow.com/a/23957365/2985775 # ca_certs if configuration.ssl_ca_cert: @@ -54,10 +52,13 @@ class RESTClientObject(object): configuration.cert_file, keyfile=configuration.key_file ) + if not configuration.verify_ssl: + ssl_context.check_hostname = False + ssl_context.verify_mode = ssl.CERT_NONE + connector = aiohttp.TCPConnector( limit=maxsize, - ssl_context=ssl_context, - verify_ssl=configuration.verify_ssl + ssl_context=ssl_context ) # https pool manager diff --git a/modules/openapi-generator/src/main/resources/python/model.mustache b/modules/openapi-generator/src/main/resources/python/model.mustache index 123577adb86..2652a3090eb 100644 --- a/modules/openapi-generator/src/main/resources/python/model.mustache +++ b/modules/openapi-generator/src/main/resources/python/model.mustache @@ -64,8 +64,13 @@ class {{classname}}(object): self.{{name}} = {{name}} {{/required}} {{^required}} +{{#isNullable}} + self.{{name}} = {{name}} +{{/isNullable}} +{{^isNullable}} if {{name}} is not None: self.{{name}} = {{name}} +{{/isNullable}} {{/required}} {{/vars}} @@ -94,10 +99,12 @@ class {{classname}}(object): :param {{name}}: The {{name}} of this {{classname}}. # noqa: E501 :type: {{dataType}} """ +{{^isNullable}} {{#required}} if {{name}} is None: raise ValueError("Invalid value for `{{name}}`, must not be `None`") # noqa: E501 {{/required}} +{{/isNullable}} {{#isEnum}} {{#isContainer}} allowed_values = [{{#allowableValues}}{{#values}}{{#items.isString}}"{{/items.isString}}{{{this}}}{{#items.isString}}"{{/items.isString}}{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}] # noqa: E501 diff --git a/modules/openapi-generator/src/main/resources/ruby-client/Gemfile.lock.mustache b/modules/openapi-generator/src/main/resources/ruby-client/Gemfile.lock.mustache new file mode 100644 index 00000000000..bb7eb9d3f79 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/ruby-client/Gemfile.lock.mustache @@ -0,0 +1,79 @@ +PATH + remote: . + specs: + {{gemName}}{{^gemName}}{{{appName}}}{{/gemName}} ({{gemVersion}}) + json (~> 2.1, >= 2.1.0) + typhoeus (~> 1.0, >= 1.0.1) + +GEM + remote: https://rubygems.org/ + specs: + ZenTest (4.11.1) + addressable (2.5.2) + public_suffix (>= 2.0.2, < 4.0) + autotest (4.4.6) + ZenTest (>= 4.4.1) + autotest-fsevent (0.2.13) + sys-uname + autotest-growl (0.2.16) + autotest-rails-pure (4.1.2) + byebug (10.0.2) + coderay (1.1.2) + crack (0.4.3) + safe_yaml (~> 1.0.0) + diff-lcs (1.3) + ethon (0.11.0) + ffi (>= 1.3.0) + ffi (1.9.25) + hashdiff (0.3.7) + json (2.1.0) + method_source (0.9.0) + pry (0.11.3) + coderay (~> 1.1.0) + method_source (~> 0.9.0) + pry-byebug (3.6.0) + byebug (~> 10.0) + pry (~> 0.10) + public_suffix (3.0.3) + rake (12.0.0) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.1) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) + safe_yaml (1.0.4) + sys-uname (1.0.3) + ffi (>= 1.0.0) + typhoeus (1.3.0) + ethon (>= 0.9.0) + vcr (3.0.3) + webmock (1.24.6) + addressable (>= 2.3.6) + crack (>= 0.3.2) + hashdiff + +PLATFORMS + ruby + +DEPENDENCIES + autotest (~> 4.4, >= 4.4.6) + autotest-fsevent (~> 0.2, >= 0.2.12) + autotest-growl (~> 0.2, >= 0.2.16) + autotest-rails-pure (~> 4.1, >= 4.1.2) + {{gemName}}{{^gemName}}{{{appName}}}{{/gemName}}! + pry-byebug + rake (~> 12.0.0) + rspec (~> 3.6, >= 3.6.0) + vcr (~> 3.0, >= 3.0.1) + webmock (~> 1.24, >= 1.24.3) + +BUNDLED WITH + 1.16.1 diff --git a/modules/openapi-generator/src/main/resources/ruby-client/Gemfile.mustache b/modules/openapi-generator/src/main/resources/ruby-client/Gemfile.mustache index d255a3ab238..01ba313fe12 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/Gemfile.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/Gemfile.mustache @@ -4,4 +4,5 @@ gemspec group :development, :test do gem 'rake', '~> 12.0.0' + gem 'pry-byebug' end diff --git a/modules/openapi-generator/src/main/resources/ruby-client/api.mustache b/modules/openapi-generator/src/main/resources/ruby-client/api.mustache index b65c0578a17..568f9c1903c 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/api.mustache @@ -43,6 +43,7 @@ module {{moduleName}} @api_client.config.logger.debug 'Calling API: {{classname}}.{{operationId}} ...' end {{#allParams}} + {{^isNullable}} {{#required}} # verify the required parameter '{{paramName}}' is set if @api_client.config.client_side_validation && {{{paramName}}}.nil? @@ -57,6 +58,7 @@ module {{moduleName}} {{/isContainer}} {{/isEnum}} {{/required}} + {{/isNullable}} {{^required}} {{#isEnum}} {{#collectionFormat}} diff --git a/modules/openapi-generator/src/main/resources/ruby-client/partial_model_generic.mustache b/modules/openapi-generator/src/main/resources/ruby-client/partial_model_generic.mustache index eb91155ed06..576a8444f02 100644 --- a/modules/openapi-generator/src/main/resources/ruby-client/partial_model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/ruby-client/partial_model_generic.mustache @@ -87,12 +87,14 @@ def list_invalid_properties invalid_properties = Array.new {{#vars}} + {{^isNullable}} {{#required}} if @{{{name}}}.nil? invalid_properties.push('invalid value for "{{{name}}}", {{{name}}} cannot be nil.') end {{/required}} + {{/isNullable}} {{#hasValidation}} {{#maxLength}} if {{^required}}!@{{{name}}}.nil? && {{/required}}@{{{name}}}.to_s.length > {{{maxLength}}} @@ -145,9 +147,11 @@ # @return true if the model is valid def valid? {{#vars}} + {{^isNullable}} {{#required}} return false if @{{{name}}}.nil? {{/required}} + {{/isNullable}} {{#isEnum}} {{^isContainer}} {{{name}}}_validator = EnumAttributeValidator.new('{{{dataType}}}', [{{#allowableValues}}{{#values}}'{{{this}}}'{{^-last}}, {{/-last}}{{/values}}{{/allowableValues}}]) @@ -201,12 +205,14 @@ # Custom attribute writer method with validation # @param [Object] {{{name}}} Value to be assigned def {{{name}}}=({{{name}}}) + {{^isNullable}} {{#required}} if {{{name}}}.nil? fail ArgumentError, '{{{name}}} cannot be nil' end {{/required}} + {{/isNullable}} {{#maxLength}} if {{^required}}!{{{name}}}.nil? && {{/required}}{{{name}}}.to_s.length > {{{maxLength}}} fail ArgumentError, 'invalid value for "{{{name}}}", the character length must be smaller than or equal to {{{maxLength}}}.' diff --git a/modules/openapi-generator/src/main/resources/rust-server/models.mustache b/modules/openapi-generator/src/main/resources/rust-server/models.mustache index 5d83eb9bf46..aa106c2b700 100644 --- a/modules/openapi-generator/src/main/resources/rust-server/models.mustache +++ b/modules/openapi-generator/src/main/resources/rust-server/models.mustache @@ -145,19 +145,19 @@ pub struct {{{classname}}} { {{/description}}{{#isEnum}} // Note: inline enums are not fully supported by openapi-generator {{/isEnum}} #[serde(rename = "{{{baseName}}}")]{{#vendorExtensions}}{{#itemXmlName}} #[serde(serialize_with = "wrap_in_{{{itemXmlName}}}")]{{/itemXmlName}}{{/vendorExtensions}}{{#required}} - pub {{{name}}}: {{#vendorExtensions}}{{#x-nullable}}swagger::Nullable<{{/x-nullable}}{{/vendorExtensions}}{{{dataType}}}{{#vendorExtensions}}{{#x-nullable}}>{{/x-nullable}}{{/vendorExtensions}}, -{{/required}}{{^required}}{{#vendorExtensions}}{{#x-nullable}} #[serde(deserialize_with = "swagger::nullable_format::deserialize_optional_nullable")] - #[serde(default = "swagger::nullable_format::default_optional_nullable")] -{{/x-nullable}}{{/vendorExtensions}} + pub {{{name}}}: {{#isNullable}}swagger::Nullable<{{/isNullable}}{{{dataType}}}{{#isNullable}}>{{/isNullable}}, +{{/required}}{{^required}}{{#isNullable}} + #[serde(deserialize_with = "swagger::nullable_format::deserialize_optional_nullable")] + #[serde(default = "swagger::nullable_format::default_optional_nullable")]{{/isNullable}} #[serde(skip_serializing_if="Option::is_none")] - pub {{{name}}}: Option<{{#vendorExtensions}}{{#x-nullable}}swagger::Nullable<{{/x-nullable}}{{/vendorExtensions}}{{#isListContainer}}Vec<{{#items}}{{{dataType}}}{{/items}}>{{/isListContainer}}{{^isListContainer}}{{{dataType}}}{{/isListContainer}}{{#vendorExtensions}}{{#x-nullable}}>{{/x-nullable}}{{/vendorExtensions}}>, + pub {{{name}}}: Option<{{#isNullable}}swagger::Nullable<{{/isNullable}}{{#isListContainer}}Vec<{{#items}}{{{dataType}}}{{/items}}>{{/isListContainer}}{{^isListContainer}}{{{dataType}}}{{/isListContainer}}{{#isNullable}}>{{/isNullable}}>, {{/required}} {{/vars}} } impl {{{classname}}} { - pub fn new({{#vars}}{{^defaultValue}}{{{name}}}: {{#vendorExtensions}}{{#x-nullable}}swagger::Nullable<{{/x-nullable}}{{/vendorExtensions}}{{{dataType}}}{{#vendorExtensions}}{{#x-nullable}}>{{/x-nullable}}{{/vendorExtensions}}, {{/defaultValue}}{{/vars}}) -> {{{classname}}} { + pub fn new({{#vars}}{{^defaultValue}}{{{name}}}: {{#isNullable}}swagger::Nullable<{{/isNullable}}{{{dataType}}}{{#isNullable}}>{{/isNullable}}, {{/defaultValue}}{{/vars}}) -> {{{classname}}} { {{{classname}}} { {{#vars}} {{{name}}}: {{#defaultValue}}{{{defaultValue}}}{{/defaultValue}}{{^defaultValue}}{{{name}}}{{/defaultValue}}, {{/vars}} diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/api.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/api.mustache index f0aa718d9b2..b73e259d5a9 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/api.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/api.mustache @@ -36,7 +36,7 @@ object {{classname}} { {{/operation}} {{#unknownStatusCodes}} - ApiInvoker.addCustomStatusCode({{value}}, isSuccess = false) + ApiInvoker.addCustomStatusCode({{{value}}}, isSuccess = false) {{/unknownStatusCodes}} } diff --git a/modules/openapi-generator/src/main/resources/scala-akka-client/model.mustache b/modules/openapi-generator/src/main/resources/scala-akka-client/model.mustache index d234919c33e..f4c9eb919fe 100644 --- a/modules/openapi-generator/src/main/resources/scala-akka-client/model.mustache +++ b/modules/openapi-generator/src/main/resources/scala-akka-client/model.mustache @@ -12,7 +12,7 @@ case class {{classname}} ( {{#description}} /* {{{description}}} */ {{/description}} - {{{name}}}: {{^required}}Option[{{/required}}{{^isEnum}}{{dataType}}{{/isEnum}}{{#isEnum}}{{classname}}Enums.{{datatypeWithEnum}}{{/isEnum}}{{^required}}]{{/required}}{{#hasMore}},{{/hasMore}} + {{{name}}}: {{^required}}Option[{{/required}}{{^isEnum}}{{dataType}}{{/isEnum}}{{#isEnum}}{{classname}}Enums.{{datatypeWithEnum}}{{/isEnum}}{{^required}}] = None{{/required}}{{#hasMore}},{{/hasMore}} {{/vars}} ) extends ApiModel diff --git a/modules/openapi-generator/src/main/resources/swift3/Podspec.mustache b/modules/openapi-generator/src/main/resources/swift3/Podspec.mustache index e92e9f47ae0..958c6459daf 100644 --- a/modules/openapi-generator/src/main/resources/swift3/Podspec.mustache +++ b/modules/openapi-generator/src/main/resources/swift3/Podspec.mustache @@ -5,18 +5,34 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.version = '{{#podVersion}}{{podVersion}}{{/podVersion}}{{^podVersion}}0.0.1{{/podVersion}}' - s.source = {{#podSource}}{{& podSource}}{{/podSource}}{{^podSource}}{ :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.0.0' }{{/podSource}}{{#podAuthors}} - s.authors = '{{podAuthors}}'{{/podAuthors}}{{#podSocialMediaURL}} - s.social_media_url = '{{podSocialMediaURL}}'{{/podSocialMediaURL}}{{#podDocsetURL}} - s.docset_url = '{{podDocsetURL}}'{{/podDocsetURL}} - s.license = {{#podLicense}}{{& podLicense}}{{/podLicense}}{{^podLicense}}'Proprietary'{{/podLicense}}{{#podHomepage}} - s.homepage = '{{podHomepage}}'{{/podHomepage}}{{#podSummary}} - s.summary = '{{podSummary}}'{{/podSummary}}{{#podDescription}} - s.description = '{{podDescription}}'{{/podDescription}}{{#podScreenshots}} - s.screenshots = {{& podScreenshots}}{{/podScreenshots}}{{#podDocumentationURL}} - s.documentation_url = '{{podDocumentationURL}}'{{/podDocumentationURL}} - s.source_files = '{{projectName}}/Classes/**/*.swift'{{#usePromiseKit}} - s.dependency 'PromiseKit/CorePromise', '~> 4.4.0'{{/usePromiseKit}}{{#useRxSwift}} - s.dependency 'RxSwift', '3.6.1'{{/useRxSwift}} + s.source = {{#podSource}}{{& podSource}}{{/podSource}}{{^podSource}}{ :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' }{{/podSource}} + {{#podAuthors}} + s.authors = '{{podAuthors}}' + {{/podAuthors}} + {{#podSocialMediaURL}} + s.social_media_url = '{{podSocialMediaURL}}' + {{/podSocialMediaURL}} + {{#podDocsetURL}} + s.docset_url = '{{podDocsetURL}}' + {{/podDocsetURL}} + s.license = {{#podLicense}}{{& podLicense}}{{/podLicense}}{{^podLicense}}'Proprietary'{{/podLicense}} + s.homepage = '{{podHomepage}}{{^podHomepage}}https://github.com/OpenAPITools/openapi-generator{{/podHomepage}}' + s.summary = '{{podSummary}}{{^podSummary}}{{projectName}} Swift SDK{{/podSummary}}' + {{#podDescription}} + s.description = '{{podDescription}}' + {{/podDescription}} + {{#podScreenshots}} + s.screenshots = {{& podScreenshots}} + {{/podScreenshots}} + {{#podDocumentationURL}} + s.documentation_url = '{{podDocumentationURL}}' + {{/podDocumentationURL}} + s.source_files = '{{projectName}}/Classes/**/*.swift' + {{#usePromiseKit}} + s.dependency 'PromiseKit/CorePromise', '~> 4.4.0' + {{/usePromiseKit}} + {{#useRxSwift}} + s.dependency 'RxSwift', '3.6.1' + {{/useRxSwift}} s.dependency 'Alamofire', '~> 4.5.0' end diff --git a/modules/openapi-generator/src/main/resources/swift4/CodableHelper.mustache b/modules/openapi-generator/src/main/resources/swift4/CodableHelper.mustache index 2d50e463ae1..bd72d81846d 100644 --- a/modules/openapi-generator/src/main/resources/swift4/CodableHelper.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/CodableHelper.mustache @@ -47,13 +47,17 @@ open class CodableHelper { if prettyPrint { encoder.outputFormatting = .prettyPrinted } - 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 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" - encoder.dateEncodingStrategy = .formatted(formatter) + 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 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" + encoder.dateEncodingStrategy = .formatted(formatter) + } do { returnedData = try encoder.encode(value) diff --git a/modules/openapi-generator/src/main/resources/swift4/Podspec.mustache b/modules/openapi-generator/src/main/resources/swift4/Podspec.mustache index cbb15384222..24ffd62bc15 100644 --- a/modules/openapi-generator/src/main/resources/swift4/Podspec.mustache +++ b/modules/openapi-generator/src/main/resources/swift4/Podspec.mustache @@ -5,18 +5,34 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.version = '{{#podVersion}}{{podVersion}}{{/podVersion}}{{^podVersion}}0.0.1{{/podVersion}}' - s.source = {{#podSource}}{{& podSource}}{{/podSource}}{{^podSource}}{ :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.0.0' }{{/podSource}}{{#podAuthors}} - s.authors = '{{podAuthors}}'{{/podAuthors}}{{#podSocialMediaURL}} - s.social_media_url = '{{podSocialMediaURL}}'{{/podSocialMediaURL}}{{#podDocsetURL}} - s.docset_url = '{{podDocsetURL}}'{{/podDocsetURL}} - s.license = {{#podLicense}}{{& podLicense}}{{/podLicense}}{{^podLicense}}'Proprietary'{{/podLicense}}{{#podHomepage}} - s.homepage = '{{podHomepage}}'{{/podHomepage}}{{#podSummary}} - s.summary = '{{podSummary}}'{{/podSummary}}{{#podDescription}} - s.description = '{{podDescription}}'{{/podDescription}}{{#podScreenshots}} - s.screenshots = {{& podScreenshots}}{{/podScreenshots}}{{#podDocumentationURL}} - s.documentation_url = '{{podDocumentationURL}}'{{/podDocumentationURL}} - s.source_files = '{{projectName}}/Classes/**/*.swift'{{#usePromiseKit}} - s.dependency 'PromiseKit/CorePromise', '~> 4.4.0'{{/usePromiseKit}}{{#useRxSwift}} - s.dependency 'RxSwift', '~> 4.0'{{/useRxSwift}} + s.source = {{#podSource}}{{& podSource}}{{/podSource}}{{^podSource}}{ :git => 'git@github.com:OpenAPITools/openapi-generator.git', :tag => 'v1.0.0' }{{/podSource}} + {{#podAuthors}} + s.authors = '{{podAuthors}}' + {{/podAuthors}} + {{#podSocialMediaURL}} + s.social_media_url = '{{podSocialMediaURL}}' + {{/podSocialMediaURL}} + {{#podDocsetURL}} + s.docset_url = '{{podDocsetURL}}' + {{/podDocsetURL}} + s.license = {{#podLicense}}{{& podLicense}}{{/podLicense}}{{^podLicense}}'Proprietary'{{/podLicense}} + s.homepage = '{{podHomepage}}{{^podHomepage}}https://github.com/OpenAPITools/openapi-generator{{/podHomepage}}' + s.summary = '{{podSummary}}{{^podSummary}}{{projectName}} Swift SDK{{/podSummary}}' + {{#podDescription}} + s.description = '{{podDescription}}' + {{/podDescription}} + {{#podScreenshots}} + s.screenshots = {{& podScreenshots}} + {{/podScreenshots}} + {{#podDocumentationURL}} + s.documentation_url = '{{podDocumentationURL}}' + {{/podDocumentationURL}} + s.source_files = '{{projectName}}/Classes/**/*.swift' + {{#usePromiseKit}} + s.dependency 'PromiseKit/CorePromise', '~> 4.4.0' + {{/usePromiseKit}} + {{#useRxSwift}} + s.dependency 'RxSwift', '~> 4.0' + {{/useRxSwift}} s.dependency 'Alamofire', '~> 4.5.0' end diff --git a/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache index c9da208072e..9ec6e67dde9 100644 --- a/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-angular/modelGeneric.mustache @@ -5,6 +5,6 @@ export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ {{>m * {{{description}}} */ {{/description}} - {{#isReadOnly}}readonly {{/isReadOnly}}{{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}; + {{#isReadOnly}}readonly {{/isReadOnly}}{{{name}}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}; {{/vars}} }{{>modelGenericEnums}} \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/README.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/README.mustache new file mode 100644 index 00000000000..21e49aeafc4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/README.mustache @@ -0,0 +1,45 @@ +## {{npmName}}@{{npmVersion}} + +This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments: + +Environment +* Node.js +* Webpack +* Browserify + +Language level +* ES5 - you must have a Promises/A+ library installed +* ES6 + +Module system +* CommonJS +* ES6 module system + +It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) + +### Building + +To build and compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### Publishing + +First build the package then run ```npm publish``` + +### Consuming + +navigate to the folder of your consuming project and run one of the following commands. + +_published:_ + +``` +npm install {{npmName}}@{{npmVersion}} --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache new file mode 100644 index 00000000000..7d11e17ea03 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/api.mustache @@ -0,0 +1,354 @@ +// tslint:disable +/// +{{>licenseInfo}} + +import * as url from "url"; +import { Configuration } from "./configuration"; +import axios, { AxiosPromise } from 'axios'; + +const BASE_PATH = "{{{basePath}}}".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} + +{{#models}} +{{#model}}{{#isEnum}}{{>modelEnum}}{{/isEnum}}{{^isEnum}}{{>modelGeneric}}{{/isEnum}}{{/model}} +{{/models}} +{{#apiInfo}}{{#apis}}{{#operations}} +/** + * {{classname}} - axios parameter creator{{#description}} + * {{&description}}{{/description}} + * @export + */ +export const {{classname}}AxiosParamCreator = function (configuration?: Configuration) { + return { + {{#operation}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options: any = {}): RequestArgs { + {{#allParams}} + {{#required}} + // verify required parameter '{{paramName}}' is not null or undefined + if ({{paramName}} === null || {{paramName}} === undefined) { + throw new RequiredError('{{paramName}}','Required parameter {{paramName}} was null or undefined when calling {{nickname}}.'); + } + {{/required}} + {{/allParams}} + const localVarPath = `{{{path}}}`{{#pathParams}} + .replace(`{${"{{baseName}}"}}`, encodeURIComponent(String({{paramName}}))){{/pathParams}}; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: '{{httpMethod}}' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + {{#hasFormParams}} + const localVarFormParams = new url.URLSearchParams(); + {{/hasFormParams}} + + {{#authMethods}} + // authentication {{name}} required + {{#isApiKey}} + {{#isKeyInHeader}} + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("{{keyParamName}}") + : configuration.apiKey; + localVarHeaderParameter["{{keyParamName}}"] = localVarApiKeyValue; + } + {{/isKeyInHeader}} + {{#isKeyInQuery}} + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("{{keyParamName}}") + : configuration.apiKey; + localVarQueryParameter["{{keyParamName}}"] = localVarApiKeyValue; + } + {{/isKeyInQuery}} + {{/isApiKey}} + {{#isBasic}} + // http basic authentication required + if (configuration && (configuration.username || configuration.password)) { + localVarHeaderParameter["Authorization"] = "Basic " + btoa(configuration.username + ":" + configuration.password); + } + {{/isBasic}} + {{#isOAuth}} + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("{{name}}", [{{#scopes}}"{{{scope}}}"{{^-last}}, {{/-last}}{{/scopes}}]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + {{/isOAuth}} + + {{/authMethods}} + {{#queryParams}} + {{#isListContainer}} + if ({{paramName}}) { + {{#isCollectionFormatMulti}} + localVarQueryParameter['{{baseName}}'] = {{paramName}}; + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + localVarQueryParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS["{{collectionFormat}}"]); + {{/isCollectionFormatMulti}} + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined) { + {{#isDateTime}} + localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any).toISOString(); + {{/isDateTime}} + {{^isDateTime}} + {{#isDate}} + localVarQueryParameter['{{baseName}}'] = ({{paramName}} as any).toISOString(); + {{/isDate}} + {{^isDate}} + localVarQueryParameter['{{baseName}}'] = {{paramName}}; + {{/isDate}} + {{/isDateTime}} + } + {{/isListContainer}} + + {{/queryParams}} + {{#headerParams}} + {{#isListContainer}} + if ({{paramName}}) { + localVarHeaderParameter['{{baseName}}'] = {{paramName}}.join(COLLECTION_FORMATS["{{collectionFormat}}"])); + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined && {{paramName}} !== null) { + localVarHeaderParameter['{{baseName}}'] = String({{paramName}}); + } + {{/isListContainer}} + + {{/headerParams}} + {{#formParams}} + {{#isListContainer}} + if ({{paramName}}) { + {{#isCollectionFormatMulti}} + {{paramName}}.forEach((element) => { + localVarFormParams.append('{{baseName}}', element as any); + }) + {{/isCollectionFormatMulti}} + {{^isCollectionFormatMulti}} + localVarFormParams.set('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS["{{collectionFormat}}"])); + {{/isCollectionFormatMulti}} + } + {{/isListContainer}} + {{^isListContainer}} + if ({{paramName}} !== undefined) { + localVarFormParams.set('{{baseName}}', {{paramName}} as any); + } + {{/isListContainer}} + + {{/formParams}} + {{#hasFormParams}} + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + {{/hasFormParams}} + {{#bodyParam}} + {{^consumes}} + localVarHeaderParameter['Content-Type'] = 'application/json'; + {{/consumes}} + {{#consumes.0}} + localVarHeaderParameter['Content-Type'] = '{{{mediaType}}}'; + {{/consumes.0}} + + {{/bodyParam}} + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + {{#hasFormParams}} + localVarRequestOptions.data = localVarFormParams.toString(); + {{/hasFormParams}} + {{#bodyParam}} + const needsSerialization = ("{{dataType}}" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify({{paramName}} || {}) : ({{paramName}} || ""); + {{/bodyParam}} + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + {{/operation}} + } +}; + +/** + * {{classname}} - functional programming interface{{#description}} + * {{{description}}}{{/description}} + * @export + */ +export const {{classname}}Fp = function(configuration?: Configuration) { + return { + {{#operation}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): (basePath?: string) => AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}Response{{/returnType}}> { + const localVarAxiosArgs = {{classname}}AxiosParamCreator(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + {{/operation}} + } +}; + +/** + * {{classname}} - factory interface{{#description}} + * {{&description}}{{/description}} + * @export + */ +export const {{classname}}Factory = function (configuration?: Configuration, basePath?: string) { + return { + {{#operation}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any) { + return {{classname}}Fp(configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(basePath); + }, + {{/operation}} + }; +}; + +{{#withInterfaces}} +/** + * {{classname}} - interface{{#description}} + * {{&description}}{{/description}} + * @export + * @interface {{classname}} + */ +export interface {{classname}}Interface { +{{#operation}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof {{classname}}Interface + */ + {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any): AxiosPromise<{{#returnType}}{{{returnType}}}{{/returnType}}{{^returnType}}{}{{/returnType}}>; + +{{/operation}} +} + +{{/withInterfaces}} +/** + * {{classname}} - object-oriented interface{{#description}} + * {{{description}}}{{/description}} + * @export + * @class {{classname}} + * @extends {BaseAPI} + */ +{{#withInterfaces}} +export class {{classname}} extends BaseAPI implements {{classname}}Interface { +{{/withInterfaces}} +{{^withInterfaces}} +export class {{classname}} extends BaseAPI { +{{/withInterfaces}} + {{#operation}} + /** + * {{¬es}} + {{#summary}} + * @summary {{&summary}} + {{/summary}} + {{#allParams}} + * @param {{=<% %>=}}{<%&dataType%>}<%={{ }}=%> {{^required}}[{{/required}}{{paramName}}{{^required}}]{{/required}} {{description}} + {{/allParams}} + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof {{classname}} + */ + public {{nickname}}({{#allParams}}{{paramName}}{{^required}}?{{/required}}: {{{dataType}}}, {{/allParams}}options?: any) { + return {{classname}}Fp(this.configuration).{{nickname}}({{#allParams}}{{paramName}}, {{/allParams}}options)(this.basePath); + } + + {{/operation}} +} +{{/operations}}{{/apis}}{{/apiInfo}} diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/configuration.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/configuration.mustache new file mode 100644 index 00000000000..98585d783f4 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/configuration.mustache @@ -0,0 +1,63 @@ +// tslint:disable +{{>licenseInfo}} + +export interface ConfigurationParameters { + apiKey?: string | ((name: string) => string); + username?: string; + password?: string; + accessToken?: string | ((name: string, scopes?: string[]) => string); + basePath?: string; + baseOptions?: any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | ((name: string) => string); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | ((name: string, scopes?: string[]) => string); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + } +} diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/custom.d.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/custom.d.mustache new file mode 100644 index 00000000000..32534cb1663 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/custom.d.mustache @@ -0,0 +1 @@ +declare module 'url'; \ No newline at end of file diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/git_push.sh.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/git_push.sh.mustache new file mode 100644 index 00000000000..4db97099b75 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/git_push.sh.mustache @@ -0,0 +1,51 @@ +#!/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" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +if [ "$git_user_id" = "" ]; then + git_user_id="{{{gitUserId}}}" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="{{{gitRepoId}}}" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="{{{releaseNote}}}" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/gitignore b/modules/openapi-generator/src/main/resources/typescript-axios/gitignore new file mode 100644 index 00000000000..35e2fb2b02e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/gitignore @@ -0,0 +1,3 @@ +wwwroot/*.js +node_modules +typings diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/index.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/index.mustache new file mode 100644 index 00000000000..9c8794b3f28 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/index.mustache @@ -0,0 +1,5 @@ +// tslint:disable +{{>licenseInfo}} + +export * from "./api"; +export * from "./configuration"; diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/licenseInfo.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/licenseInfo.mustache new file mode 100644 index 00000000000..469fb03940f --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/licenseInfo.mustache @@ -0,0 +1,11 @@ +/** + * {{{appName}}} + * {{{appDescription}}} + * + * {{#version}}OpenAPI spec version: {{{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. + */ diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/modelEnum.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/modelEnum.mustache new file mode 100644 index 00000000000..dc04cb0bd63 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/modelEnum.mustache @@ -0,0 +1,12 @@ +/** + * {{{description}}} + * @export + * @enum {string} + */ +export enum {{classname}} { +{{#allowableValues}} +{{#enumVars}} + {{{name}}} = {{{value}}}{{^-last}},{{/-last}} +{{/enumVars}} +{{/allowableValues}} +} diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/modelGeneric.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/modelGeneric.mustache new file mode 100644 index 00000000000..3aa462ea3a8 --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/modelGeneric.mustache @@ -0,0 +1,41 @@ +/** + * {{{description}}} + * @export + * @interface {{classname}} + */ +export interface {{classname}} {{#parent}}extends {{{parent}}} {{/parent}}{ +{{#additionalPropertiesType}} + [key: string]: {{{additionalPropertiesType}}}{{#hasVars}} | any{{/hasVars}}; + +{{/additionalPropertiesType}} +{{#vars}} + /** + * {{{description}}} + * @type {{=<% %>=}}{<%&datatype%>}<%={{ }}=%> + * @memberof {{classname}} + */ + {{name}}{{^required}}?{{/required}}: {{#isEnum}}{{{datatypeWithEnum}}}{{/isEnum}}{{^isEnum}}{{{dataType}}}{{/isEnum}}; +{{/vars}} +}{{#hasEnums}} + +/** + * @export + * @namespace {{classname}} + */ +export namespace {{classname}} { +{{#vars}} + {{#isEnum}} + /** + * @export + * @enum {string} + */ + export enum {{enumName}} { + {{#allowableValues}} + {{#enumVars}} + {{{name}}} = {{{value}}}{{^-last}},{{/-last}} + {{/enumVars}} + {{/allowableValues}} + } + {{/isEnum}} +{{/vars}} +}{{/hasEnums}} diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache new file mode 100644 index 00000000000..4446d2dc08e --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/package.mustache @@ -0,0 +1,34 @@ +{ + "name": "{{npmName}}", + "version": "{{npmVersion}}", + "description": "OpenAPI client for {{npmName}}", + "author": "OpenAPI-Generator Contributors", + "keywords": [ + "axios", + "typescript", + "openapi-client", + "openapi-generator", + "{{npmName}}" + ], + "license": "Unlicense", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts" : { + "build": "tsc --outDir dist/", + "prepublishOnly": "npm run build" + }, + "dependencies": { + "axios": "^0.18.0" + }, + "peerDependencies": { + }, + "devDependencies": { + "@types/node": "^8.0.9", + "typescript": "^2.4" + }{{#npmRepository}},{{/npmRepository}} +{{#npmRepository}} + "publishConfig":{ + "registry":"{{npmRepository}}" + } +{{/npmRepository}} +} diff --git a/modules/openapi-generator/src/main/resources/typescript-axios/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript-axios/tsconfig.mustache new file mode 100644 index 00000000000..6e59886490b --- /dev/null +++ b/modules/openapi-generator/src/main/resources/typescript-axios/tsconfig.mustache @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "declaration": true, + "target": "{{#supportsES6}}es6{{/supportsES6}}{{^supportsES6}}es5{{/supportsES6}}", + "module": "commonjs", + "noImplicitAny": true, + "outDir": "dist", + "rootDir": "."{{^supportsES6}}, + "lib": [ + "es6", + "dom" + ] + {{/supportsES6}} + }, + "exclude": [ + "dist", + "node_modules" + ] +} diff --git a/modules/openapi-generator/src/main/resources/typescript-node/package.mustache b/modules/openapi-generator/src/main/resources/typescript-node/package.mustache index 0bd3ae01df0..9c2274c8467 100644 --- a/modules/openapi-generator/src/main/resources/typescript-node/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript-node/package.mustache @@ -20,7 +20,8 @@ "rewire": "^3.0.2" }, "devDependencies": { - "typescript": "^2.4.2" + "typescript": "^2.4.2", + "@types/node": "8.10.34" }{{#npmRepository}}, "publishConfig": { "registry": "{{npmRepository}}" 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 2666cc2c6dd..2dfe69565e2 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 @@ -21,6 +21,7 @@ import io.swagger.parser.OpenAPIParser; import io.swagger.v3.oas.models.Components; import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.PathItem; import io.swagger.v3.oas.models.media.ArraySchema; import io.swagger.v3.oas.models.media.Content; import io.swagger.v3.oas.models.media.MediaType; @@ -37,34 +38,19 @@ import org.openapitools.codegen.utils.ModelUtils; import org.testng.Assert; import org.testng.annotations.Test; -import java.lang.reflect.Method; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Locale; import java.util.Map; import java.util.Set; import java.util.stream.Collectors; + public class DefaultCodegenTest { - @Test - public void testCamelize() throws Exception { - Assert.assertEquals(DefaultCodegen.camelize("abcd"), "Abcd"); - Assert.assertEquals(DefaultCodegen.camelize("some-value"), "SomeValue"); - Assert.assertEquals(DefaultCodegen.camelize("some_value"), "SomeValue"); - Assert.assertEquals(DefaultCodegen.camelize("$type"), "$Type"); - - Assert.assertEquals(DefaultCodegen.camelize("abcd", true), "abcd"); - Assert.assertEquals(DefaultCodegen.camelize("some-value", true), "someValue"); - Assert.assertEquals(DefaultCodegen.camelize("some_value", true), "someValue"); - Assert.assertEquals(DefaultCodegen.camelize("Abcd", true), "abcd"); - Assert.assertEquals(DefaultCodegen.camelize("$type", true), "$type"); - - Assert.assertEquals(DefaultCodegen.camelize("123", true), "123"); - Assert.assertEquals(DefaultCodegen.camelize("$123", true), "$123"); - } - @Test public void testHasBodyParameter() throws Exception { final Schema refSchema = new Schema<>().$ref("#/components/schemas/Pet"); @@ -245,8 +231,8 @@ public class DefaultCodegenTest { .responses(new ApiResponses().addApiResponse("200", new ApiResponse().description("OK"))); DefaultCodegen codegen = new DefaultCodegen(); - CodegenOperation co = codegen.fromOperation("p/", "get", operation, Collections.emptyMap()); - Assert.assertEquals(co.path, "p/"); + CodegenOperation co = codegen.fromOperation("/some/path", "get", operation, Collections.emptyMap()); + Assert.assertEquals(co.path, "/some/path"); Assert.assertEquals(co.allParams.size(), 2); List allParamsNames = co.allParams.stream().map(p -> p.paramName).collect(Collectors.toList()); Assert.assertTrue(allParamsNames.contains("myparam")); @@ -311,6 +297,66 @@ public class DefaultCodegenTest { Assert.assertEquals(testedEnumVar.getOrDefault("isString", ""), false); } + @Test + public void updateCodegenPropertyEnumWithExtention() { + { + CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("dog", "cat"), Arrays.asList("DOGVAR", "CATVAR")); + (new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty); + List> enumVars = (List>) enumProperty.getAllowableValues().get("enumVars"); + Assert.assertNotNull(enumVars); + Assert.assertNotNull(enumVars.get(0)); + Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOGVAR"); + Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"dog\""); + Assert.assertNotNull(enumVars.get(1)); + Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CATVAR"); + Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"cat\""); + } + { + CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("1", "2"), Arrays.asList("ONE", "TWO")); + (new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty); + List> enumVars = (List>) enumProperty.getAllowableValues().get("enumVars"); + Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "ONE"); + Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"1\""); + Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "TWO"); + Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"2\""); + } + { + CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("a", "b", "c", "d"), Arrays.asList("FOO", "BAR")); + (new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty); + List> enumVars = (List>) enumProperty.getAllowableValues().get("enumVars"); + Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "FOO"); + Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "BAR"); + Assert.assertEquals(enumVars.get(2).getOrDefault("name", ""), "C"); + Assert.assertEquals(enumVars.get(3).getOrDefault("name", ""), "D"); + } + { + CodegenProperty enumProperty = codegenPropertyWithXEnumVarName(Arrays.asList("a", "b"), Arrays.asList("FOO", "BAR", "BAZ")); + (new DefaultCodegen()).updateCodegenPropertyEnum(enumProperty); + List> enumVars = (List>) enumProperty.getAllowableValues().get("enumVars"); + Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "FOO"); + Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "BAR"); + Assert.assertEquals(enumVars.size(), 2); + } + } + + @Test + public void postProcessModelsEnumWithExtention() { + final DefaultCodegen codegen = new DefaultCodegen(); + Map objs = codegenModelWithXEnumVarName(); + CodegenModel cm = (CodegenModel) ((Map) ((List) objs.get("models")).get(0)).get("model"); + + codegen.postProcessModelsEnum(objs); + + List> enumVars = (List>) cm.getAllowableValues().get("enumVars"); + Assert.assertNotNull(enumVars); + Assert.assertNotNull(enumVars.get(0)); + Assert.assertEquals(enumVars.get(0).getOrDefault("name", ""), "DOGVAR"); + Assert.assertEquals(enumVars.get(0).getOrDefault("value", ""), "\"dog\""); + Assert.assertNotNull(enumVars.get(1)); + Assert.assertEquals(enumVars.get(1).getOrDefault("name", ""), "CATVAR"); + Assert.assertEquals(enumVars.get(1).getOrDefault("value", ""), "\"cat\""); + } + @Test public void testExample1() { final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/3_0/examples.yaml", null, new ParseOptions()).getOpenAPI(); @@ -407,6 +453,85 @@ public class DefaultCodegenTest { verifyPersonDiscriminator(personModel.discriminator); } + @Test + public void testParentName() { + final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/3_0/allOf.yaml", null, new ParseOptions()).getOpenAPI(); + DefaultCodegen codegen = new DefaultCodegen(); + + Schema child = openAPI.getComponents().getSchemas().get("Child"); + CodegenModel childModel = codegen.fromModel("Child", child, openAPI.getComponents().getSchemas()); + Assert.assertEquals(childModel.parentSchema, "Person"); + } + + @Test + public void testCallbacks() { + final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/3_0/callbacks.yaml", null, new ParseOptions()).getOpenAPI(); + final CodegenConfig codegen = new DefaultCodegen(); + + final String path = "/streams"; + Operation subscriptionOperation = openAPI.getPaths().get("/streams").getPost(); + CodegenOperation op = codegen.fromOperation(path, "post", subscriptionOperation, openAPI.getComponents().getSchemas(), openAPI); + + Assert.assertFalse(op.isCallbackRequest); + Assert.assertNotNull(op.operationId); + Assert.assertEquals(op.callbacks.size(), 2); + + CodegenCallback cbB = op.callbacks.get(1); + Assert.assertEquals(cbB.name, "dummy"); + Assert.assertFalse(cbB.hasMore); + Assert.assertEquals(cbB.urls.size(), 0); + + CodegenCallback cbA = op.callbacks.get(0); + Assert.assertEquals(cbA.name, "onData"); + Assert.assertTrue(cbA.hasMore); + + Assert.assertEquals(cbA.urls.size(), 2); + + CodegenCallback.Url urlB = cbA.urls.get(1); + Assert.assertEquals(urlB.expression, "{$request.query.callbackUrl}/test"); + Assert.assertFalse(urlB.hasMore); + Assert.assertEquals(urlB.requests.size(), 0); + + CodegenCallback.Url urlA = cbA.urls.get(0); + Assert.assertEquals(urlA.expression, "{$request.query.callbackUrl}/data"); + Assert.assertTrue(urlA.hasMore); + Assert.assertEquals(urlA.requests.size(), 2); + + urlA.requests.forEach(req -> { + Assert.assertTrue(req.isCallbackRequest); + Assert.assertNotNull(req.bodyParam); + Assert.assertEquals(req.responses.size(), 2); + + switch (req.httpMethod.toLowerCase(Locale.getDefault())) { + case "post": + Assert.assertEquals(req.operationId, "onDataDataPost"); + Assert.assertEquals(req.bodyParam.dataType, "NewNotificationData"); + break; + case "delete": + Assert.assertEquals(req.operationId, "onDataDataDelete"); + Assert.assertEquals(req.bodyParam.dataType, "DeleteNotificationData"); + break; + default: + Assert.fail(String.format(Locale.getDefault(), "invalid callback request http method '%s'", req.httpMethod)); + } + }); + } + + @Test + public void testLeadingSlashIsAddedIfMissing() { + OpenAPI openAPI = TestUtils.createOpenAPI(); + Operation operation1 = new Operation().operationId("op1").responses(new ApiResponses().addApiResponse("201", new ApiResponse().description("OK"))); + openAPI.path("/here", new PathItem().get(operation1)); + Operation operation2 = new Operation().operationId("op2").responses(new ApiResponses().addApiResponse("201", new ApiResponse().description("OK"))); + openAPI.path("some/path", new PathItem().get(operation2)); + final DefaultCodegen codegen = new DefaultCodegen(); + + CodegenOperation co1 = codegen.fromOperation("/here", "get", operation2, ModelUtils.getSchemas(openAPI), openAPI); + Assert.assertEquals(co1.path, "/here"); + CodegenOperation co2 = codegen.fromOperation("some/path", "get", operation2, ModelUtils.getSchemas(openAPI), openAPI); + Assert.assertEquals(co2.path, "/some/path"); + } + private void verifyPersonDiscriminator(CodegenDiscriminator discriminator) { CodegenDiscriminator test = new CodegenDiscriminator(); test.setPropertyName("$_type"); @@ -429,4 +554,30 @@ public class DefaultCodegenTest { array.dataType = "Array"; return array; } + + private CodegenProperty codegenPropertyWithXEnumVarName(List values, List aliases) { + final CodegenProperty var = new CodegenProperty(); + final HashMap allowableValues = new HashMap<>(); + allowableValues.put("values", values); + var.setAllowableValues(allowableValues); + var.dataType = "String"; + Map extentions = Collections.singletonMap("x-enum-varnames", aliases); + var.setVendorExtensions(extentions); + return var; + } + + private Map codegenModelWithXEnumVarName() { + final CodegenModel cm = new CodegenModel(); + cm.isEnum = true; + final HashMap allowableValues = new HashMap<>(); + allowableValues.put("values", Arrays.asList("dog", "cat")); + cm.setAllowableValues(allowableValues); + cm.dataType = "String"; + final List aliases = Arrays.asList("DOGVAR", "CATVAR"); + Map extentions = Collections.singletonMap("x-enum-varnames", aliases); + cm.setVendorExtensions(extentions); + cm.setVars(Collections.emptyList()); + Map objs = Collections.singletonMap("models", Collections.singletonList(Collections.singletonMap("model", cm))); + return objs; + } } 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 47dbcffd9df..261149c4022 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 @@ -22,10 +22,10 @@ public class DefaultGeneratorTest { public void testProcessPaths() throws Exception { OpenAPI openAPI = TestUtils.createOpenAPI(); openAPI.setPaths(new Paths()); - openAPI.getPaths().addPathItem("path1/", new PathItem().get(new Operation().operationId("op1").responses(new ApiResponses().addApiResponse("201", new ApiResponse().description("OK"))))); - openAPI.getPaths().addPathItem("path2/", new PathItem().get(new Operation().operationId("op2").addParametersItem(new QueryParameter().name("p1").schema(new StringSchema())).responses(new ApiResponses().addApiResponse("201", new ApiResponse().description("OK"))))); - openAPI.getPaths().addPathItem("path3/", new PathItem().addParametersItem(new QueryParameter().name("p1").schema(new StringSchema())).get(new Operation().operationId("op3").addParametersItem(new QueryParameter().name("p2").schema(new IntegerSchema())).responses(new ApiResponses().addApiResponse("201", new ApiResponse().description("OK"))))); - openAPI.getPaths().addPathItem("path4/", new PathItem().addParametersItem(new QueryParameter().name("p1").schema(new StringSchema())).get(new Operation().operationId("op4").responses(new ApiResponses().addApiResponse("201", new ApiResponse().description("OK"))))); + openAPI.getPaths().addPathItem("/path1", new PathItem().get(new Operation().operationId("op1").responses(new ApiResponses().addApiResponse("201", new ApiResponse().description("OK"))))); + openAPI.getPaths().addPathItem("/path2", new PathItem().get(new Operation().operationId("op2").addParametersItem(new QueryParameter().name("p1").schema(new StringSchema())).responses(new ApiResponses().addApiResponse("201", new ApiResponse().description("OK"))))); + openAPI.getPaths().addPathItem("/path3", new PathItem().addParametersItem(new QueryParameter().name("p1").schema(new StringSchema())).get(new Operation().operationId("op3").addParametersItem(new QueryParameter().name("p2").schema(new IntegerSchema())).responses(new ApiResponses().addApiResponse("201", new ApiResponse().description("OK"))))); + openAPI.getPaths().addPathItem("/path4", new PathItem().addParametersItem(new QueryParameter().name("p1").schema(new StringSchema())).get(new Operation().operationId("op4").responses(new ApiResponses().addApiResponse("201", new ApiResponse().description("OK"))))); ClientOptInput opts = new ClientOptInput(); opts.setOpenAPI(openAPI); @@ -38,13 +38,13 @@ public class DefaultGeneratorTest { Assert.assertEquals(result.size(), 1); List defaultList = result.get("Default"); Assert.assertEquals(defaultList.size(), 4); - Assert.assertEquals(defaultList.get(0).path, "path1/"); + Assert.assertEquals(defaultList.get(0).path, "/path1"); Assert.assertEquals(defaultList.get(0).allParams.size(), 0); - Assert.assertEquals(defaultList.get(1).path, "path2/"); + Assert.assertEquals(defaultList.get(1).path, "/path2"); Assert.assertEquals(defaultList.get(1).allParams.size(), 1); - Assert.assertEquals(defaultList.get(2).path, "path3/"); + Assert.assertEquals(defaultList.get(2).path, "/path3"); Assert.assertEquals(defaultList.get(2).allParams.size(), 2); - Assert.assertEquals(defaultList.get(3).path, "path4/"); + Assert.assertEquals(defaultList.get(3).path, "/path4"); Assert.assertEquals(defaultList.get(3).allParams.size(), 1); } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java new file mode 100644 index 00000000000..18f88f2f323 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/dart/DartModelTest.java @@ -0,0 +1,316 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.dart; + +import io.swagger.parser.OpenAPIParser; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.Operation; +import io.swagger.v3.oas.models.media.*; +import io.swagger.v3.parser.core.models.ParseOptions; +import org.openapitools.codegen.CodegenModel; +import org.openapitools.codegen.CodegenOperation; +import org.openapitools.codegen.CodegenProperty; +import org.openapitools.codegen.DefaultCodegen; +import org.openapitools.codegen.languages.DartClientCodegen; +import org.testng.Assert; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + +@SuppressWarnings("static-method") +public class DartModelTest { + + @Test(description = "convert a simple php model") + public void simpleModelTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("id", new IntegerSchema()) + .addProperties("name", new StringSchema()) + .addProperties("createdAt", new DateTimeSchema()) + .addRequiredItem("id") + .addRequiredItem("name"); + final DefaultCodegen codegen = new DartClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model, Collections.singletonMap("sample", model)); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 3); + // {{imports}} is not used in template + //Assert.assertEquals(cm.imports.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.dataType, "int"); + Assert.assertEquals(property1.name, "id"); + Assert.assertEquals(property1.defaultValue, "null"); + Assert.assertEquals(property1.baseType, "int"); + Assert.assertTrue(property1.hasMore); + Assert.assertTrue(property1.required); + Assert.assertTrue(property1.isPrimitiveType); + Assert.assertTrue(property1.isNotContainer); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "name"); + Assert.assertEquals(property2.dataType, "String"); + Assert.assertEquals(property2.name, "name"); + Assert.assertEquals(property2.defaultValue, "null"); + Assert.assertEquals(property2.baseType, "String"); + Assert.assertTrue(property2.hasMore); + Assert.assertTrue(property2.required); + Assert.assertTrue(property2.isPrimitiveType); + Assert.assertTrue(property2.isNotContainer); + + final CodegenProperty property3 = cm.vars.get(2); + Assert.assertEquals(property3.baseName, "createdAt"); + Assert.assertEquals(property3.complexType, "DateTime"); + Assert.assertEquals(property3.dataType, "DateTime"); + Assert.assertEquals(property3.name, "createdAt"); + Assert.assertEquals(property3.defaultValue, "null"); + Assert.assertEquals(property3.baseType, "DateTime"); + Assert.assertFalse(property3.hasMore); + Assert.assertFalse(property3.required); + Assert.assertTrue(property3.isNotContainer); + } + + @Test(description = "convert a model with list property") + public void listPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("id", new IntegerSchema()) + .addProperties("urls", new ArraySchema() + .items(new StringSchema())) + .addRequiredItem("id"); + final DefaultCodegen codegen = new DartClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model, Collections.singletonMap("sample", model)); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 2); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "id"); + Assert.assertEquals(property1.dataType, "int"); + Assert.assertEquals(property1.name, "id"); + Assert.assertEquals(property1.defaultValue, "null"); + Assert.assertEquals(property1.baseType, "int"); + Assert.assertTrue(property1.hasMore); + Assert.assertTrue(property1.required); + Assert.assertTrue(property1.isPrimitiveType); + Assert.assertTrue(property1.isNotContainer); + + final CodegenProperty property2 = cm.vars.get(1); + Assert.assertEquals(property2.baseName, "urls"); + Assert.assertEquals(property2.dataType, "List"); + Assert.assertEquals(property2.name, "urls"); + Assert.assertEquals(property2.baseType, "List"); + Assert.assertFalse(property2.hasMore); + Assert.assertEquals(property2.containerType, "array"); + Assert.assertFalse(property2.required); + Assert.assertTrue(property2.isPrimitiveType); + Assert.assertTrue(property2.isContainer); + } + + @Test(description = "convert a model with a map property") + public void mapPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("translations", new MapSchema() + .additionalProperties(new StringSchema())) + .addRequiredItem("id"); + final DefaultCodegen codegen = new DartClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model, Collections.singletonMap("sample", model)); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "translations"); + Assert.assertEquals(property1.dataType, "Map"); + Assert.assertEquals(property1.name, "translations"); + Assert.assertEquals(property1.baseType, "Map"); + Assert.assertEquals(property1.containerType, "map"); + Assert.assertFalse(property1.required); + Assert.assertTrue(property1.isContainer); + Assert.assertTrue(property1.isPrimitiveType); + } + + @Test(description = "convert a model with complex property") + public void complexPropertyTest() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("children", new Schema().$ref("#/definitions/Children")); + final DefaultCodegen codegen = new DartClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model, Collections.singletonMap("sample", model)); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.dataType, "Children"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.baseType, "Children"); + Assert.assertFalse(property1.required); + Assert.assertTrue(property1.isNotContainer); + } + + @Test(description = "convert a model with complex list property") + public void complexListProperty() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("children", new ArraySchema() + .items(new Schema().$ref("#/definitions/Children"))); + final DefaultCodegen codegen = new DartClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model, Collections.singletonMap("sample", model)); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.dataType, "List"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.baseType, "List"); + Assert.assertEquals(property1.containerType, "array"); + Assert.assertFalse(property1.required); + Assert.assertTrue(property1.isContainer); + } + + @Test(description = "convert a model with complex map property") + public void complexMapSchema() { + final Schema model = new Schema() + .description("a sample model") + .addProperties("children", new MapSchema() + .additionalProperties(new Schema().$ref("#/definitions/Children"))); + final DefaultCodegen codegen = new DartClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model, Collections.singletonMap("sample", model)); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a sample model"); + Assert.assertEquals(cm.vars.size(), 1); + // {{imports}} is not used in template + //Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); + + final CodegenProperty property1 = cm.vars.get(0); + Assert.assertEquals(property1.baseName, "children"); + Assert.assertEquals(property1.complexType, "Children"); + Assert.assertEquals(property1.dataType, "Map"); + Assert.assertEquals(property1.name, "children"); + Assert.assertEquals(property1.baseType, "Map"); + Assert.assertEquals(property1.containerType, "map"); + Assert.assertFalse(property1.required); + Assert.assertTrue(property1.isContainer); + Assert.assertFalse(property1.isNotContainer); + } + + @Test(description = "convert an array model") + public void arrayModelTest() { + final Schema model = new ArraySchema() + .items(new Schema().$ref("#/definitions/Children")) + .description("an array model"); + final DefaultCodegen codegen = new DartClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model, Collections.singletonMap("sample", model)); + + Assert.assertEquals(model.getDescription(), "an array model"); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertTrue(cm.isArrayModel); + Assert.assertEquals(cm.description, "an array model"); + Assert.assertEquals(cm.vars.size(), 0); + // skip import test as import is not used by PHP codegen + } + + @Test(description = "convert a map model") + public void mapModelTest() { + final Schema model = new Schema() + .description("a map model") + .additionalProperties(new Schema().$ref("#/definitions/Children")); + final DefaultCodegen codegen = new DartClientCodegen(); + final CodegenModel cm = codegen.fromModel("sample", model, Collections.singletonMap("sample", model)); + + Assert.assertEquals(cm.name, "sample"); + Assert.assertEquals(cm.classname, "Sample"); + Assert.assertEquals(cm.description, "a map model"); + Assert.assertEquals(cm.vars.size(), 0); + // {{imports}} is not used in template + //Assert.assertEquals(cm.imports.size(), 2); + //Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("Children")).size(), 1); + } + + @DataProvider(name = "modelNames") + public static Object[][] primeNumbers() { + return new Object[][] { + {"sample", "Sample"}, + {"sample_name", "SampleName"}, + {"sample__name", "SampleName"}, + {"/sample", "Sample"}, + {"\\sample", "\\Sample"}, + {"sample.name", "SampleName"}, + {"_sample", "Sample"}, + }; + } + + @Test(dataProvider = "modelNames", description = "avoid inner class") + public void modelNameTest(String name, String expectedName) { + final Schema model = new Schema(); + final DefaultCodegen codegen = new DartClientCodegen(); + final CodegenModel cm = codegen.fromModel(name, model, Collections.singletonMap(name, model)); + + Assert.assertEquals(cm.name, name); + Assert.assertEquals(cm.classname, expectedName); + } + + @Test(description = "test enum variable names for reserved words") + public void testReservedWord() throws Exception { + final DefaultCodegen codegen = new DartClientCodegen(); + Assert.assertEquals(codegen.toEnumVarName("public", null), "public_"); + Assert.assertEquals(codegen.toEnumVarName("Private", null), "private_"); + Assert.assertEquals(codegen.toEnumVarName("IF", null), "iF_"); + // should not escape non-reserved + Assert.assertEquals(codegen.toEnumVarName("hello", null), "hello_"); + } + + // datetime (or primitive type) not yet supported in HTTP request body + @Test(description = "returns DateTime when using `--model-name-prefix`") + public void dateTest() { + final OpenAPI model = new OpenAPIParser().readLocation("src/test/resources/2_0/datePropertyTest.json", null, new ParseOptions()).getOpenAPI(); + final DefaultCodegen codegen = new DartClientCodegen(); + codegen.setModelNamePrefix("foo"); + + final String path = "/tests/dateResponse"; + final Operation p = model.getPaths().get(path).getPost(); + final CodegenOperation op = codegen.fromOperation(path, "post", p, model.getComponents().getSchemas()); + + Assert.assertEquals(op.returnType, "DateTime"); + Assert.assertEquals(op.bodyParam.dataType, "DateTime"); + } +} 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 ac37ef22731..6de0f911562 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 @@ -252,7 +252,7 @@ public class JavaClientCodegenTest { generator.opts(clientOptInput).generate(); Map generatedFiles = generator.getFiles(); - Assert.assertEquals(generatedFiles.size(), 35); + Assert.assertEquals(generatedFiles.size(), 37); ensureContainsFile(generatedFiles, output, ".gitignore"); ensureContainsFile(generatedFiles, output, ".openapi-generator-ignore"); ensureContainsFile(generatedFiles, output, ".openapi-generator/VERSION"); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelEnumTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelEnumTest.java index 8a39fece124..2244bfd208d 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelEnumTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelEnumTest.java @@ -51,7 +51,7 @@ public class JavaModelEnumTest { Assert.assertEquals(enumVar.dataType, "String"); Assert.assertEquals(enumVar.datatypeWithEnum, "NameEnum"); Assert.assertEquals(enumVar.name, "name"); - Assert.assertEquals(enumVar.defaultValue, "null"); + Assert.assertEquals(enumVar.defaultValue, null); Assert.assertEquals(enumVar.baseType, "String"); Assert.assertTrue(enumVar.isEnum); } @@ -80,7 +80,7 @@ public class JavaModelEnumTest { Assert.assertEquals(enumVar.mostInnerItems.dataType, "String"); Assert.assertEquals(enumVar.mostInnerItems.datatypeWithEnum, "NameEnum"); Assert.assertEquals(enumVar.mostInnerItems.name, "name"); - Assert.assertEquals(enumVar.mostInnerItems.defaultValue, "null"); + Assert.assertEquals(enumVar.mostInnerItems.defaultValue, null); Assert.assertEquals(enumVar.mostInnerItems.baseType, "String"); Assert.assertEquals(enumVar.mostInnerItems.baseType, enumVar.items.baseType); @@ -111,7 +111,7 @@ public class JavaModelEnumTest { Assert.assertEquals(enumVar.mostInnerItems.dataType, "String"); Assert.assertEquals(enumVar.mostInnerItems.datatypeWithEnum, "NameEnum"); Assert.assertEquals(enumVar.mostInnerItems.name, "name"); - Assert.assertEquals(enumVar.mostInnerItems.defaultValue, "null"); + Assert.assertEquals(enumVar.mostInnerItems.defaultValue, null); Assert.assertEquals(enumVar.mostInnerItems.baseType, "String"); Assert.assertEquals(enumVar.mostInnerItems.baseType, enumVar.items.items.baseType); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java index 54dc3b0cd63..03325e04f72 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/java/JavaModelTest.java @@ -97,7 +97,7 @@ public class JavaModelTest { Assert.assertEquals(property1.setter, "setId"); Assert.assertEquals(property1.dataType, "Long"); Assert.assertEquals(property1.name, "id"); - Assert.assertEquals(property1.defaultValue, "null"); + Assert.assertEquals(property1.defaultValue, null); Assert.assertEquals(property1.baseType, "Long"); Assert.assertTrue(property1.hasMore); Assert.assertTrue(property1.required); @@ -111,7 +111,7 @@ public class JavaModelTest { Assert.assertEquals(property2.setter, "setName"); Assert.assertEquals(property2.dataType, "String"); Assert.assertEquals(property2.name, "name"); - Assert.assertEquals(property2.defaultValue, "null"); + Assert.assertEquals(property2.defaultValue, null); Assert.assertEquals(property2.baseType, "String"); Assert.assertEquals(property2.example, "Tony"); Assert.assertTrue(property2.hasMore); @@ -126,7 +126,7 @@ public class JavaModelTest { Assert.assertEquals(property3.setter, "setCreatedAt"); Assert.assertEquals(property3.dataType, "Date"); Assert.assertEquals(property3.name, "createdAt"); - Assert.assertEquals(property3.defaultValue, "null"); + Assert.assertEquals(property3.defaultValue, null); Assert.assertEquals(property3.baseType, "Date"); Assert.assertFalse(property3.hasMore); Assert.assertFalse(property3.required); @@ -261,7 +261,7 @@ public class JavaModelTest { Assert.assertEquals(property.setter, "setAtSomeColonRestrictedPercentCharactersHashToExclamationHandlePlus"); Assert.assertEquals(property.dataType, "Boolean"); Assert.assertEquals(property.name, "atSomeColonRestrictedPercentCharactersHashToExclamationHandlePlus"); - Assert.assertEquals(property.defaultValue, "null"); + Assert.assertEquals(property.defaultValue, null); Assert.assertEquals(property.baseType, "Boolean"); Assert.assertFalse(property.required); Assert.assertTrue(property.isNotContainer); @@ -286,6 +286,7 @@ public class JavaModelTest { Assert.assertEquals(property.setter, "setChildren"); Assert.assertEquals(property.dataType, "Children"); Assert.assertEquals(property.name, "children"); + // "null" as default value for model Assert.assertEquals(property.defaultValue, "null"); Assert.assertEquals(property.baseType, "Children"); Assert.assertFalse(property.required); @@ -445,7 +446,7 @@ public class JavaModelTest { Assert.assertEquals(property.setter, "setNAME"); Assert.assertEquals(property.dataType, "String"); Assert.assertEquals(property.name, "NAME"); - Assert.assertEquals(property.defaultValue, "null"); + Assert.assertEquals(property.defaultValue, null); Assert.assertEquals(property.baseType, "String"); Assert.assertFalse(property.hasMore); Assert.assertTrue(property.required); @@ -471,7 +472,7 @@ public class JavaModelTest { Assert.assertEquals(property.setter, "setPId"); Assert.assertEquals(property.dataType, "String"); Assert.assertEquals(property.name, "pId"); - Assert.assertEquals(property.defaultValue, "null"); + Assert.assertEquals(property.defaultValue, null); Assert.assertEquals(property.baseType, "String"); Assert.assertFalse(property.hasMore); Assert.assertTrue(property.required); @@ -497,7 +498,7 @@ public class JavaModelTest { Assert.assertEquals(property.setter, "setAtTName"); Assert.assertEquals(property.dataType, "String"); Assert.assertEquals(property.name, "atTName"); - Assert.assertEquals(property.defaultValue, "null"); + Assert.assertEquals(property.defaultValue, null); Assert.assertEquals(property.baseType, "String"); Assert.assertFalse(property.hasMore); Assert.assertTrue(property.required); @@ -559,7 +560,7 @@ public class JavaModelTest { Assert.assertEquals(property.setter, "setInputBinaryData"); Assert.assertEquals(property.dataType, "byte[]"); Assert.assertEquals(property.name, "inputBinaryData"); - Assert.assertEquals(property.defaultValue, "null"); + Assert.assertEquals(property.defaultValue, null); Assert.assertEquals(property.baseType, "byte[]"); Assert.assertFalse(property.hasMore); Assert.assertFalse(property.required); @@ -584,7 +585,7 @@ public class JavaModelTest { Assert.assertEquals(property.setter, "setU"); Assert.assertEquals(property.dataType, "String"); Assert.assertEquals(property.name, "u"); - Assert.assertEquals(property.defaultValue, "null"); + Assert.assertEquals(property.defaultValue, null); Assert.assertEquals(property.baseType, "String"); Assert.assertFalse(property.hasMore); Assert.assertTrue(property.isNotContainer); @@ -713,7 +714,7 @@ public class JavaModelTest { Assert.assertEquals(property2.setter, "setName"); Assert.assertEquals(property2.dataType, "String"); Assert.assertEquals(property2.name, "name"); - Assert.assertEquals(property2.defaultValue, "null"); + Assert.assertEquals(property2.defaultValue, null); Assert.assertEquals(property2.baseType, "String"); Assert.assertEquals(property2.example, "Tony"); Assert.assertTrue(property2.hasMore); @@ -729,7 +730,7 @@ public class JavaModelTest { Assert.assertEquals(property3.setter, "setCreatedAt"); Assert.assertEquals(property3.dataType, "Date"); Assert.assertEquals(property3.name, "createdAt"); - Assert.assertEquals(property3.defaultValue, "null"); + Assert.assertEquals(property3.defaultValue, null); Assert.assertEquals(property3.baseType, "Date"); Assert.assertFalse(property3.hasMore); Assert.assertFalse(property3.required); diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java new file mode 100644 index 00000000000..87847e16cf7 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/kotlin/spring/KotlinSpringServerCodegenTest.java @@ -0,0 +1,126 @@ +package org.openapitools.codegen.kotlin.spring; + +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import io.swagger.v3.oas.models.servers.Server; +import org.openapitools.codegen.CodegenConstants; +import org.openapitools.codegen.languages.KotlinSpringServerCodegen; +import org.testng.Assert; +import org.testng.annotations.Test; + +public class KotlinSpringServerCodegenTest { + + @Test + public void testInitialConfigValues() throws Exception { + final KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.processOpts(); + + final OpenAPI openAPI = new OpenAPI(); + openAPI.addServersItem(new Server().url("https://api.abcde.xy:8082/v2")); + openAPI.setInfo(new Info()); + codegen.preprocessOpenAPI(openAPI); + + Assert.assertEquals(codegen.getLibrary(), KotlinSpringServerCodegen.SPRING_BOOT); + Assert.assertTrue(codegen.supportedLibraries().containsKey(KotlinSpringServerCodegen.SPRING_BOOT)); + + Assert.assertEquals(codegen.modelPackage(), "org.openapitools.model"); + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE), "org.openapitools.model"); + Assert.assertEquals(codegen.apiPackage(), "org.openapitools.api"); + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.API_PACKAGE), "org.openapitools.api"); + Assert.assertEquals(codegen.getBasePackage(), "org.openapitools"); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.BASE_PACKAGE), "org.openapitools"); + Assert.assertEquals(codegen.getInvokerPackage(), "org.openapitools"); + Assert.assertEquals(codegen.getServerPort(), "8080"); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVER_PORT), "8080"); + } + + @Test + public void testSettersForConfigValues() throws Exception { + final KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.setModelPackage("xx.yyyyyyyy.model"); + codegen.setApiPackage("xx.yyyyyyyy.api"); + codegen.setBasePackage("xx.yyyyyyyy.base"); + codegen.setServerPort("8181"); + codegen.setExceptionHandler(false); + codegen.setGradleBuildFile(false); + codegen.setSwaggerAnnotations(true); + codegen.setServiceInterface(true); + codegen.setServiceImplementation(true); + codegen.setUseBeanValidation(false); + codegen.processOpts(); + + Assert.assertEquals(codegen.modelPackage(), "xx.yyyyyyyy.model"); + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE), "xx.yyyyyyyy.model"); + Assert.assertEquals(codegen.apiPackage(), "xx.yyyyyyyy.api"); + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.API_PACKAGE), "xx.yyyyyyyy.api"); + Assert.assertEquals(codegen.getBasePackage(), "xx.yyyyyyyy.base"); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.BASE_PACKAGE), "xx.yyyyyyyy.base"); + Assert.assertEquals(codegen.getServerPort(), "8181"); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVER_PORT), "8181"); + Assert.assertFalse(codegen.getExceptionHandler()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.EXCEPTION_HANDLER), false); + Assert.assertFalse(codegen.getGradleBuildFile()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.GRADLE_BUILD_FILE), false); + Assert.assertTrue(codegen.getSwaggerAnnotations()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SWAGGER_ANNOTATIONS), true); + Assert.assertTrue(codegen.getServiceInterface()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVICE_INTERFACE), true); + Assert.assertTrue(codegen.getServiceImplementation()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVICE_IMPLEMENTATION), true); + Assert.assertFalse(codegen.getUseBeanValidation()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.USE_BEANVALIDATION), false); + } + + @Test + public void testAdditionalPropertiesPutForConfigValues() throws Exception { + final KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.additionalProperties().put(CodegenConstants.MODEL_PACKAGE, "xyz.yyyyy.mmmmm.model"); + codegen.additionalProperties().put(CodegenConstants.API_PACKAGE, "xyz.yyyyy.aaaaa.api"); + codegen.additionalProperties().put(KotlinSpringServerCodegen.BASE_PACKAGE, "xyz.yyyyy.bbbb.base"); + codegen.additionalProperties().put(KotlinSpringServerCodegen.SERVER_PORT, "8088"); + codegen.additionalProperties().put(KotlinSpringServerCodegen.EXCEPTION_HANDLER, false); + codegen.additionalProperties().put(KotlinSpringServerCodegen.GRADLE_BUILD_FILE, false); + codegen.additionalProperties().put(KotlinSpringServerCodegen.SWAGGER_ANNOTATIONS, true); + codegen.additionalProperties().put(KotlinSpringServerCodegen.SERVICE_INTERFACE, true); + codegen.additionalProperties().put(KotlinSpringServerCodegen.SERVICE_IMPLEMENTATION, true); + codegen.additionalProperties().put(KotlinSpringServerCodegen.USE_BEANVALIDATION, false); + codegen.processOpts(); + + final OpenAPI openAPI = new OpenAPI(); + openAPI.addServersItem(new Server().url("https://api.abcde.xy:8082/v2")); + openAPI.setInfo(new Info()); + openAPI.getInfo().setTitle("Some test API"); + codegen.preprocessOpenAPI(openAPI); + + Assert.assertEquals(codegen.modelPackage(), "xyz.yyyyy.mmmmm.model"); + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.MODEL_PACKAGE), "xyz.yyyyy.mmmmm.model"); + Assert.assertEquals(codegen.apiPackage(), "xyz.yyyyy.aaaaa.api"); + Assert.assertEquals(codegen.additionalProperties().get(CodegenConstants.API_PACKAGE), "xyz.yyyyy.aaaaa.api"); + Assert.assertEquals(codegen.getBasePackage(), "xyz.yyyyy.bbbb.base"); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.BASE_PACKAGE), "xyz.yyyyy.bbbb.base"); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.TITLE), "someTest"); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVER_PORT), "8088"); + Assert.assertFalse(codegen.getExceptionHandler()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.EXCEPTION_HANDLER), false); + Assert.assertFalse(codegen.getGradleBuildFile()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.GRADLE_BUILD_FILE), false); + Assert.assertTrue(codegen.getSwaggerAnnotations()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SWAGGER_ANNOTATIONS), true); + Assert.assertTrue(codegen.getServiceInterface()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVICE_INTERFACE), true); + Assert.assertTrue(codegen.getServiceImplementation()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.SERVICE_IMPLEMENTATION), true); + Assert.assertFalse(codegen.getUseBeanValidation()); + Assert.assertEquals(codegen.additionalProperties().get(KotlinSpringServerCodegen.USE_BEANVALIDATION), false); + } + + @Test + public void testSettingInvokerPackageToBasePackage() throws Exception { + final KotlinSpringServerCodegen codegen = new KotlinSpringServerCodegen(); + codegen.additionalProperties().put(CodegenConstants.INVOKER_PACKAGE, "xyz.yyyyy.bbbb.invoker"); + codegen.processOpts(); + + Assert.assertEquals(codegen.getInvokerPackage(), "xyz.yyyyy.bbbb.invoker"); + Assert.assertEquals(codegen.getBasePackage(), "xyz.yyyyy.bbbb.invoker"); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaCodegenTest.java new file mode 100644 index 00000000000..1d9153933cb --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaCodegenTest.java @@ -0,0 +1,278 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.mysql; + +import org.testng.Assert; +import org.testng.annotations.Test; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Set; +import java.util.ArrayList; +import java.util.Arrays; + +import org.openapitools.codegen.languages.MysqlSchemaCodegen; + +public class MysqlSchemaCodegenTest { + + @Test + public void testGetMysqlMatchedIntegerDataType() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(null, null, null), "INT"); + + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(-128L, 127L, false), "TINYINT"); + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(0L, 255L, true), "TINYINT"); + + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(500L, 100L, null), "SMALLINT"); + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(500L, 100L, true), "SMALLINT"); + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(500L, 100L, false), "SMALLINT"); + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(-32768L, 32767L, false), "SMALLINT"); + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(0L, 65535L, true), "SMALLINT"); + + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(-8388608L, 8388607L, false), "MEDIUMINT"); + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(0L, 16777215L, true), "MEDIUMINT"); + + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(-2147483648L, 2147483647L, false), "INT"); + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(Long.parseLong(String.valueOf(Integer.MIN_VALUE)), Long.parseLong(String.valueOf(Integer.MAX_VALUE)), false), "INT"); + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(0L, 4294967295L, true), "INT"); + + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(-2147483649L, 2147483648L, false), "BIGINT"); + Assert.assertSame(codegen.getMysqlMatchedIntegerDataType(0L, 4294967296L, true), "BIGINT"); + } + + @Test + public void testGetMysqlMatchedStringDataType() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(6, 6), "CHAR"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(0, 0), "CHAR"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(255, 255), "CHAR"); + + Assert.assertSame(codegen.getMysqlMatchedStringDataType(null, 100), "VARCHAR"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(null, 255), "VARCHAR"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(50, 255), "VARCHAR"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(100, 20), "VARCHAR"); + + Assert.assertSame(codegen.getMysqlMatchedStringDataType(null, null), "TEXT"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(100, null), "TEXT"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(255, null), "TEXT"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(null, 256), "TEXT"); + + Assert.assertSame(codegen.getMysqlMatchedStringDataType(16777215, null), "MEDIUMTEXT"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(16777215, 100), "MEDIUMTEXT"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(null, 16777215), "MEDIUMTEXT"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(100, 16777215), "MEDIUMTEXT"); + + Assert.assertSame(codegen.getMysqlMatchedStringDataType(16777216, null), "LONGTEXT"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(null, 16777216), "LONGTEXT"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(16777216, 16777216), "LONGTEXT"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(100, 16777216), "LONGTEXT"); + Assert.assertSame(codegen.getMysqlMatchedStringDataType(100, Integer.MAX_VALUE), "LONGTEXT"); + } + + @Test + public void testToCodegenMysqlDataTypeArgument() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + String strArgument = "HelloWorld"; + HashMap strProp = codegen.toCodegenMysqlDataTypeArgument(strArgument, true); + Assert.assertTrue((Boolean) strProp.get("isString")); + Assert.assertTrue((Boolean) strProp.get("hasMore")); + Assert.assertFalse((Boolean) strProp.get("isFloat")); + Assert.assertFalse((Boolean) strProp.get("isInteger")); + Assert.assertFalse((Boolean) strProp.get("isNumeric")); + Assert.assertSame((String) strProp.get("argumentValue"), strArgument); + + Integer intArgument = 10; + HashMap intProp = codegen.toCodegenMysqlDataTypeArgument(intArgument, true); + Assert.assertFalse((Boolean) intProp.get("isString")); + Assert.assertTrue((Boolean) intProp.get("hasMore")); + Assert.assertFalse((Boolean) intProp.get("isFloat")); + Assert.assertTrue((Boolean) intProp.get("isInteger")); + Assert.assertTrue((Boolean) intProp.get("isNumeric")); + Assert.assertSame((Integer) intProp.get("argumentValue"), intArgument); + + Double floatArgument = 3.14; + HashMap floatProp = codegen.toCodegenMysqlDataTypeArgument(floatArgument, false); + Assert.assertFalse((Boolean) floatProp.get("isString")); + Assert.assertFalse((Boolean) floatProp.get("hasMore")); + Assert.assertTrue((Boolean) floatProp.get("isFloat")); + Assert.assertFalse((Boolean) floatProp.get("isInteger")); + Assert.assertTrue((Boolean) floatProp.get("isNumeric")); + Assert.assertSame((Double) floatProp.get("argumentValue"), floatArgument); + } + + @Test + public void testToCodegenMysqlDataTypeDefault() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + HashMap defaultMap = null; + ArrayList intFixture = new ArrayList(Arrays.asList( + "TINYINT", "SmallInt", "Mediumint", "INT", "bigint" + )); + for(String intType : intFixture) { + defaultMap = codegen.toCodegenMysqlDataTypeDefault("150", intType); + Assert.assertTrue((Boolean) defaultMap.get("isNumeric")); + Assert.assertFalse((Boolean) defaultMap.get("isString")); + Assert.assertFalse((Boolean) defaultMap.get("isKeyword")); + Assert.assertSame(defaultMap.get("defaultValue"), "150"); + } + defaultMap = codegen.toCodegenMysqlDataTypeDefault("SERIAL DEFAULT VALUE", "TINYINT"); + Assert.assertFalse((Boolean) defaultMap.get("isNumeric")); + Assert.assertFalse((Boolean) defaultMap.get("isString")); + Assert.assertTrue((Boolean) defaultMap.get("isKeyword")); + Assert.assertSame(defaultMap.get("defaultValue"), "SERIAL DEFAULT VALUE"); + + ArrayList dateFixture = new ArrayList(Arrays.asList( + "Timestamp", "DateTime" + )); + for(String dateType : dateFixture) { + defaultMap = codegen.toCodegenMysqlDataTypeDefault("2018-08-12", dateType); + Assert.assertFalse((Boolean) defaultMap.get("isNumeric")); + Assert.assertTrue((Boolean) defaultMap.get("isString")); + Assert.assertFalse((Boolean) defaultMap.get("isKeyword")); + Assert.assertSame(defaultMap.get("defaultValue"), "2018-08-12"); + } + defaultMap = codegen.toCodegenMysqlDataTypeDefault("CURRENT_TIMESTAMP", "Timestamp"); + Assert.assertFalse((Boolean) defaultMap.get("isNumeric")); + Assert.assertFalse((Boolean) defaultMap.get("isString")); + Assert.assertTrue((Boolean) defaultMap.get("isKeyword")); + Assert.assertSame(defaultMap.get("defaultValue"), "CURRENT_TIMESTAMP"); + + ArrayList restFixture = new ArrayList(Arrays.asList( + "VARCHAR", "CHAR", "ENUM", "UNKNOWN" + )); + for(String restType : restFixture) { + defaultMap = codegen.toCodegenMysqlDataTypeDefault("sometext", restType); + Assert.assertFalse((Boolean) defaultMap.get("isNumeric")); + Assert.assertTrue((Boolean) defaultMap.get("isString")); + Assert.assertFalse((Boolean) defaultMap.get("isKeyword")); + Assert.assertSame(defaultMap.get("defaultValue"), "sometext"); + } + } + + @Test(expectedExceptions = RuntimeException.class) + public void testToCodegenMysqlDataTypeDefaultWithExceptionalColumnType() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + HashMap defaultMap = null; + ArrayList specialFixture = new ArrayList(Arrays.asList( + "TINYBLOB", "Blob", "MEDIUMBLOB", "LONGBLOB", "TINYTEXT", "TEXT", "MEDIUMTEXT", "LONGTEXT", "GEOMETRY", "JSON" + )); + for(String specialType : specialFixture) { + defaultMap = codegen.toCodegenMysqlDataTypeDefault("2018-08-12", specialType); + Assert.assertNull(defaultMap); + } + } + + @Test + public void testIsMysqlDataType() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + ArrayList trueFixture = new ArrayList(Arrays.asList( + "INTEGER", "integer", "Integer", "DATETIME", "datetime", "DateTime", "VARCHAR", "varchar", "VarChar", "POINT", "Point", "point", "JSON", "json", "Json" + )); + ArrayList falseFixture = new ArrayList(Arrays.asList( + "unknown", "HashMap", "HASHMAP", "hashmap" + )); + for(String trueValue : trueFixture) { + Assert.assertTrue(codegen.isMysqlDataType(trueValue), "'" + trueValue + "' isn't MySQL data type"); + } + for(String falseValue : falseFixture) { + Assert.assertFalse(codegen.isMysqlDataType(falseValue), "'" + falseValue + "' is MySQL data type"); + } + } + + @Test + public void testToMysqlIdentifier() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + Assert.assertEquals(codegen.toMysqlIdentifier("table_name", "tbl_", ""), "table_name"); + Assert.assertEquals(codegen.toMysqlIdentifier("table_name ", "tbl_", ""), "table_name"); + Assert.assertEquals(codegen.toMysqlIdentifier("12345678", "tbl_", ""), "tbl_12345678"); + } + + @Test(expectedExceptions = RuntimeException.class) + public void testToMysqlIdentifierWithEmptyString() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + codegen.toMysqlIdentifier(" ", "tbl_", ""); + } + + @Test + public void testEscapeMysqlUnquotedIdentifier() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + Assert.assertEquals(codegen.escapeMysqlUnquotedIdentifier("table1Z$_"), "table1Z$_"); + Assert.assertEquals(codegen.escapeMysqlUnquotedIdentifier("table1Z$_!#%~&?()*+-./"), "table1Z$_"); + Assert.assertEquals(codegen.escapeMysqlUnquotedIdentifier("table1Z$_русскийтекст"), "table1Z$_русскийтекст"); + Assert.assertEquals(codegen.escapeMysqlQuotedIdentifier("table𐀀"), "table"); + Assert.assertEquals(codegen.escapeMysqlQuotedIdentifier("table_name!'()�"), "table_name!'()�"); + Assert.assertEquals(codegen.escapeMysqlQuotedIdentifier("table_name𐌅𐌌"), "table_name"); + } + + @Test + public void testEscapeMysqlQuotedIdentifier() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + Assert.assertEquals(codegen.escapeMysqlQuotedIdentifier("table"), "table"); + Assert.assertEquals(codegen.escapeMysqlQuotedIdentifier("table𐀀"), "table"); + Assert.assertEquals(codegen.escapeMysqlQuotedIdentifier("table_name!'()�"), "table_name!'()�"); + Assert.assertEquals(codegen.escapeMysqlQuotedIdentifier("table_name𐌅𐌌"), "table_name"); + } + + @Test + public void testIsReservedWord() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + Set reservedWords = codegen.reservedWords(); + ArrayList trueFixture = new ArrayList(Arrays.asList( + "accessible", "asc", "between", "blob", "change", "column", "day_hour", "distinct", "enclosed", "except", "explain", "float", "for", "function", "grant", "grouping", "high_priority", "groups", "hour_minute", "insensitive", "interval", "json_table", "keys", "kill", "leave", "left", "mediumblob", "modifies", "not", "null", "numeric", "optimize", "outer", "precision", "primary", "references", "replace", "select", "sql", "then", "tinytext", "unique", "unlock", "varchar", "virtual", "when", "where", "xor", "year_month", "zerofill" + )); + ArrayList falseFixture = new ArrayList(Arrays.asList( + "after", "boolean", "charset", "cpu", "current", "delay_key_write", "end", "format", "global", "host", "install", "json", "key_block_size", "local", "max_size", "none", "offset", "partial", "quarter", "relay", "second", "status", "timestamp", "until", "variables", "without", "xml", "year" + )); + for(String trueValue : trueFixture) { + Assert.assertTrue(reservedWords.contains(trueValue), "'" + trueValue + "' isn't MySQL reserved word"); + } + for(String falseValue : falseFixture) { + Assert.assertFalse(reservedWords.contains(falseValue), "'" + falseValue + "' is MySQL reserved word"); + } + } + + @Test + public void testSetDefaultDatabaseName() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + codegen.setDefaultDatabaseName("valid_db_name"); + Assert.assertSame(codegen.getDefaultDatabaseName(), "valid_db_name"); + codegen.setDefaultDatabaseName("12345"); + Assert.assertNotSame(codegen.getDefaultDatabaseName(), "12345"); + } + + @Test + public void testGetDefaultDatabaseName() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + Assert.assertSame(codegen.getDefaultDatabaseName(), ""); + } + + @Test + public void testSetJsonDataTypeEnabled() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + codegen.setJsonDataTypeEnabled(true); + Assert.assertTrue(codegen.getJsonDataTypeEnabled()); + codegen.setJsonDataTypeEnabled(false); + Assert.assertFalse(codegen.getJsonDataTypeEnabled()); + } + + @Test + public void testGetJsonDataTypeEnabled() { + final MysqlSchemaCodegen codegen = new MysqlSchemaCodegen(); + Assert.assertTrue(codegen.getJsonDataTypeEnabled()); + codegen.setJsonDataTypeEnabled(false); + Assert.assertFalse(codegen.getJsonDataTypeEnabled()); + } + +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaOptionsTest.java new file mode 100644 index 00000000000..d7afd576d9c --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/mysql/MysqlSchemaOptionsTest.java @@ -0,0 +1,51 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.mysql; + +import org.openapitools.codegen.AbstractOptionsTest; +import org.openapitools.codegen.CodegenConfig; +import org.openapitools.codegen.languages.MysqlSchemaCodegen; +import org.openapitools.codegen.options.MysqlSchemaOptionsProvider; + +import mockit.Expectations; +import mockit.Tested; + +public class MysqlSchemaOptionsTest extends AbstractOptionsTest { + + @Tested + private MysqlSchemaCodegen clientCodegen; + + public MysqlSchemaOptionsTest() { + super(new MysqlSchemaOptionsProvider()); + } + + @Override + protected CodegenConfig getCodegenConfig() { + return clientCodegen; + } + + @SuppressWarnings("unused") + @Override + protected void setExpectations() { + new Expectations(clientCodegen) {{ + clientCodegen.setDefaultDatabaseName(MysqlSchemaOptionsProvider.DEFAULT_DATABASE_NAME_VALUE); + times = 1; + clientCodegen.setJsonDataTypeEnabled(Boolean.valueOf(MysqlSchemaOptionsProvider.JSON_DATA_TYPE_ENABLED_VALUE)); + times = 1; + }}; + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java index b23cf14f227..42167695ec8 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/DartClientOptionsProvider.java @@ -54,6 +54,7 @@ public class DartClientOptionsProvider implements OptionsProvider { .put(DartClientCodegen.USE_ENUM_EXTENSION, USE_ENUM_EXTENSION) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) + .put(DartClientCodegen.SUPPORT_DART2, "false") .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoGinServerOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoGinServerOptionsProvider.java new file mode 100644 index 00000000000..6df6c978f7d --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/GoGinServerOptionsProvider.java @@ -0,0 +1,50 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.options; + +import org.openapitools.codegen.CodegenConstants; + +import com.google.common.collect.ImmutableMap; + +import java.util.Map; + +public class GoGinServerOptionsProvider implements OptionsProvider { + public static final String SORT_PARAMS_VALUE = "false"; + public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; + public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; + public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; + + @Override + public String getLanguage() { + return "go-gin-server"; + } + + @Override + public Map createOptions() { + ImmutableMap.Builder builder = new ImmutableMap.Builder(); + return builder.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE) + .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) + .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) + .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, "true") + .build(); + } + + @Override + public boolean isServer() { + return true; + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/MysqlSchemaOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/MysqlSchemaOptionsProvider.java new file mode 100644 index 00000000000..e1e51a61d89 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/MysqlSchemaOptionsProvider.java @@ -0,0 +1,46 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.options; + +import org.openapitools.codegen.languages.MysqlSchemaCodegen; + +import com.google.common.collect.ImmutableMap; + +import java.util.Map; + +public class MysqlSchemaOptionsProvider implements OptionsProvider { + public static final String DEFAULT_DATABASE_NAME_VALUE = "database_name"; + public static final String JSON_DATA_TYPE_ENABLED_VALUE = "false"; + + @Override + public String getLanguage() { + return "mysql-schema"; + } + + @Override + public Map createOptions() { + ImmutableMap.Builder builder = new ImmutableMap.Builder(); + return builder.put(MysqlSchemaCodegen.DEFAULT_DATABASE_NAME, DEFAULT_DATABASE_NAME_VALUE) + .put(MysqlSchemaCodegen.JSON_DATA_TYPE_ENABLED, JSON_DATA_TYPE_ENABLED_VALUE) + .build(); + } + + @Override + public boolean isServer() { + return false; + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlimServerOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlimServerOptionsProvider.java index c170e2ff577..39186e7b051 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlimServerOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/PhpSlimServerOptionsProvider.java @@ -19,6 +19,7 @@ package org.openapitools.codegen.options; import org.openapitools.codegen.CodegenConstants; import org.openapitools.codegen.languages.AbstractPhpCodegen; +import org.openapitools.codegen.languages.PhpSlimServerCodegen; import com.google.common.collect.ImmutableMap; @@ -38,6 +39,7 @@ public class PhpSlimServerOptionsProvider implements OptionsProvider { public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true"; public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; + public static final String PHPCS_STANDARD_VALUE = "PSR12"; @Override public String getLanguage() { @@ -60,6 +62,7 @@ public class PhpSlimServerOptionsProvider implements OptionsProvider { .put(CodegenConstants.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_PARAMS_VALUE) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) + .put(PhpSlimServerCodegen.PHPCS_STANDARD, PHPCS_STANDARD_VALUE) .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java index d4a1e718589..c809a156ea5 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/options/TypeScriptAngularClientOptionsProvider.java @@ -35,6 +35,7 @@ public class TypeScriptAngularClientOptionsProvider implements OptionsProvider { public static final String ALLOW_UNICODE_IDENTIFIERS_VALUE = "false"; public static final String NG_VERSION = "2"; public static final String PREPEND_FORM_OR_BODY_PARAMETERS_VALUE = "true"; + public static final String FILE_NAMING_VALUE = "camelCase"; public static String SERVICE_SUFFIX = "Service"; public static String SERVICE_FILE_SUFFIX = ".service"; public static String MODEL_SUFFIX = ""; @@ -66,6 +67,7 @@ public class TypeScriptAngularClientOptionsProvider implements OptionsProvider { .put(TypeScriptAngularClientCodegen.MODEL_FILE_SUFFIX, MODEL_FILE_SUFFIX) .put(CodegenConstants.ALLOW_UNICODE_IDENTIFIERS, ALLOW_UNICODE_IDENTIFIERS_VALUE) .put(CodegenConstants.PREPEND_FORM_OR_BODY_PARAMETERS, PREPEND_FORM_OR_BODY_PARAMETERS_VALUE) + .put(TypeScriptAngularClientCodegen.FILE_NAMING, FILE_NAMING_VALUE) .build(); } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java index a0c5a326ead..2d89be08cf8 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/ruby/RubyClientCodegenTest.java @@ -172,7 +172,7 @@ public class RubyClientCodegenTest { @Test(description = "test nullable for properties") - public void nullableTest() { + public void nullablePropertyTest() { final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/3_0/petstore_oas3_test.yaml", null, new ParseOptions()).getOpenAPI(); final RubyClientCodegen codegen = new RubyClientCodegen(); codegen.setModuleName("OnlinePetstore"); @@ -227,4 +227,48 @@ public class RubyClientCodegenTest { Assert.assertFalse(cp5.isNullable); } + @Test(description = "test nullable for parameters (OAS3)") + public void nullableParameterOAS3Test() { + final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/3_0/petstore_oas3_test.yaml", null, new ParseOptions()).getOpenAPI(); + final RubyClientCodegen codegen = new RubyClientCodegen(); + codegen.setModuleName("OnlinePetstore"); + final String path = "/pet/{petId}"; + + final Operation p = openAPI.getPaths().get(path).getPost(); + final CodegenOperation op = codegen.fromOperation(path, "post", p, openAPI.getComponents().getSchemas()); + + Assert.assertEquals(op.pathParams.size(), 1); + CodegenParameter pp = op.pathParams.get(0); + Assert.assertTrue(pp.isNullable); + + Assert.assertEquals(op.formParams.size(), 2); + CodegenParameter name = op.formParams.get(0); + Assert.assertFalse(name.isNullable); + CodegenParameter status = op.formParams.get(1); + Assert.assertTrue(status.isNullable); + } + + @Test(description = "test nullable for parameters (OAS2)") + public void nullableParameterOAS2Test() { + final OpenAPI openAPI = new OpenAPIParser().readLocation("src/test/resources/2_0/petstore-nullable.yaml", null, new ParseOptions()).getOpenAPI(); + final RubyClientCodegen codegen = new RubyClientCodegen(); + codegen.setModuleName("OnlinePetstore"); + final String path = "/pet/{petId}"; + + final Operation p = openAPI.getPaths().get(path).getPost(); + final CodegenOperation op = codegen.fromOperation(path, "post", p, openAPI.getComponents().getSchemas()); + + // path parameter x-nullable test + Assert.assertEquals(op.pathParams.size(), 1); + CodegenParameter pp = op.pathParams.get(0); + Assert.assertTrue(pp.isNullable); + + // form parameter x-nullable test + Assert.assertEquals(op.formParams.size(), 2); + CodegenParameter name = op.formParams.get(0); + Assert.assertFalse(name.isNullable); + CodegenParameter status = op.formParams.get(1); + // TODO comment out the following until https://github.com/swagger-api/swagger-parser/issues/820 is solved + //Assert.assertTrue(status.isNullable); + } } diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim/PhpSlimServerOptionsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim/PhpSlimServerOptionsTest.java index 25cd43077aa..57a87adaf3f 100644 --- a/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim/PhpSlimServerOptionsTest.java +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/slim/PhpSlimServerOptionsTest.java @@ -63,6 +63,8 @@ public class PhpSlimServerOptionsTest extends AbstractOptionsTest { times = 1; clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(PhpSlimServerOptionsProvider.SORT_PARAMS_VALUE)); times = 1; + clientCodegen.setPhpcsStandard(PhpSlimServerOptionsProvider.PHPCS_STANDARD_VALUE); + times = 1; }}; } } 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 new file mode 100644 index 00000000000..a5d989c6984 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/swift4/Swift4ModelEnumTest.java @@ -0,0 +1,55 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.openapitools.codegen.swift4; + +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; +import org.openapitools.codegen.languages.Swift4Codegen; +import org.testng.Assert; +import org.testng.annotations.Test; + +import java.util.Arrays; +import java.util.Collections; + +@SuppressWarnings("static-method") +public class Swift4ModelEnumTest { + @Test(description = "convert a java model with an enum and a default value") + public void converterTest() { + final StringSchema enumSchema = new StringSchema(); + enumSchema.setEnum(Arrays.asList("VALUE1", "VALUE2", "VALUE3")); + enumSchema.setDefault("VALUE2"); + final Schema model = new Schema().type("object").addProperties("name", enumSchema); + + final DefaultCodegen codegen = new Swift4Codegen(); + final CodegenModel cm = codegen.fromModel("sample", model, Collections.singletonMap("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, ".VALUE2"); + Assert.assertEquals(enumVar.baseType, "String"); + Assert.assertTrue(enumVar.isEnum); + } +} diff --git a/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/StringUtilsTest.java b/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/StringUtilsTest.java new file mode 100644 index 00000000000..cc920b9c6b6 --- /dev/null +++ b/modules/openapi-generator/src/test/java/org/openapitools/codegen/utils/StringUtilsTest.java @@ -0,0 +1,34 @@ +package org.openapitools.codegen.utils; + +import org.testng.Assert; +import org.testng.annotations.Test; + +import static org.openapitools.codegen.utils.StringUtils.*; + +public class StringUtilsTest { + // we'll assume that underscore (Twitter elephant bird) works fine + + @Test + public void testCamelize() throws Exception { + Assert.assertEquals(camelize("abcd"), "Abcd"); + Assert.assertEquals(camelize("some-value"), "SomeValue"); + Assert.assertEquals(camelize("some_value"), "SomeValue"); + Assert.assertEquals(camelize("$type"), "$Type"); + + Assert.assertEquals(camelize("abcd", true), "abcd"); + Assert.assertEquals(camelize("some-value", true), "someValue"); + Assert.assertEquals(camelize("some_value", true), "someValue"); + Assert.assertEquals(camelize("Abcd", true), "abcd"); + Assert.assertEquals(camelize("$type", true), "$type"); + + Assert.assertEquals(camelize("123", true), "123"); + Assert.assertEquals(camelize("$123", true), "$123"); + } + + @Test + public void testDashize() { + Assert.assertEquals(dashize("abcd"), "abcd"); + Assert.assertEquals(dashize("some-value"), "some-value"); + Assert.assertEquals(dashize("some_value"), "some-value"); + } +} diff --git a/modules/openapi-generator/src/test/resources/2_0/petstore-nullable.yaml b/modules/openapi-generator/src/test/resources/2_0/petstore-nullable.yaml new file mode 100644 index 00000000000..cff13ed73ce --- /dev/null +++ b/modules/openapi-generator/src/test/resources/2_0/petstore-nullable.yaml @@ -0,0 +1,702 @@ +swagger: '2.0' +info: + description: 'This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters.' + 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 +basePath: /v2 +tags: + - name: pet + description: Everything about your Pets + - name: store + description: Access to Petstore orders + - name: user + description: Operations about user +schemes: + - http +paths: + /pet: + post: + tags: + - pet + summary: Add a new pet to the store + description: '' + operationId: addPet + consumes: + - application/json + - application/xml + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Pet object that needs to be added to the store + required: true + schema: + $ref: '#/definitions/Pet' + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + put: + tags: + - pet + summary: Update an existing pet + description: '' + operationId: updatePet + consumes: + - application/json + - application/xml + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Pet object that needs to be added to the store + required: true + schema: + $ref: '#/definitions/Pet' + responses: + '400': + description: Invalid ID supplied + '404': + description: Pet not found + '405': + description: Validation exception + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + /pet/findByStatus: + get: + tags: + - pet + summary: Finds Pets by status + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + produces: + - application/xml + - application/json + parameters: + - name: status + in: query + description: Status values that need to be considered for filter + required: true + type: array + items: + type: string + enum: + - available + - pending + - sold + default: available + collectionFormat: csv + responses: + '200': + description: successful operation + schema: + type: array + items: + $ref: '#/definitions/Pet' + '400': + description: Invalid status value + security: + - petstore_auth: + - 'write:pets' + - '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 + produces: + - application/xml + - application/json + parameters: + - name: tags + in: query + description: Tags to filter by + required: true + type: array + items: + type: string + collectionFormat: csv + responses: + '200': + description: successful operation + schema: + type: array + items: + $ref: '#/definitions/Pet' + '400': + description: Invalid tag value + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + deprecated: true + '/pet/{petId}': + get: + tags: + - pet + summary: Find pet by ID + description: Returns a single pet + operationId: getPetById + produces: + - application/xml + - application/json + parameters: + - name: petId + in: path + description: ID of pet to return + required: true + type: integer + format: int64 + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/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 + consumes: + - application/x-www-form-urlencoded + produces: + - application/xml + - application/json + parameters: + - name: petId + in: path + description: ID of pet that needs to be updated + required: true + type: integer + format: int64 + x-nullable: true + - name: name + in: formData + description: Updated name of the pet + required: false + type: string + - name: status + in: formData + description: Updated status of the pet + required: false + type: string + x-nullable: true + responses: + '405': + description: Invalid input + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + delete: + tags: + - pet + summary: Deletes a pet + description: '' + operationId: deletePet + produces: + - application/xml + - application/json + parameters: + - name: api_key + in: header + required: false + type: string + - name: petId + in: path + description: Pet id to delete + required: true + 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 + consumes: + - multipart/form-data + produces: + - application/json + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + type: integer + format: int64 + - name: additionalMetadata + in: formData + description: Additional data to pass to server + required: false + type: string + - name: file + in: formData + description: file to upload + required: false + type: file + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' + /store/inventory: + get: + tags: + - store + summary: Returns pet inventories by status + description: Returns a map of status codes to quantities + operationId: getInventory + produces: + - application/json + parameters: [] + responses: + '200': + description: successful operation + 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 + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: order placed for purchasing the pet + required: true + schema: + $ref: '#/definitions/Order' + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/Order' + '400': + description: Invalid Order + '/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 + produces: + - application/xml + - application/json + parameters: + - name: orderId + in: path + description: ID of pet that needs to be fetched + required: true + type: integer + maximum: 5 + minimum: 1 + format: int64 + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/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 + produces: + - application/xml + - application/json + parameters: + - name: orderId + in: path + description: ID of the order that needs to be deleted + required: true + 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 + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: Created user object + required: true + schema: + $ref: '#/definitions/User' + responses: + default: + description: successful operation + /user/createWithArray: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithArrayInput + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: List of user object + required: true + schema: + type: array + items: + $ref: '#/definitions/User' + responses: + default: + description: successful operation + /user/createWithList: + post: + tags: + - user + summary: Creates list of users with given input array + description: '' + operationId: createUsersWithListInput + produces: + - application/xml + - application/json + parameters: + - in: body + name: body + description: List of user object + required: true + schema: + type: array + items: + $ref: '#/definitions/User' + responses: + default: + description: successful operation + /user/login: + get: + tags: + - user + summary: Logs user into the system + description: '' + operationId: loginUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: query + description: The user name for login + required: true + type: string + - name: password + in: query + description: The password for login in clear text + required: true + type: string + responses: + '200': + description: successful operation + schema: + type: string + headers: + X-Rate-Limit: + type: integer + format: int32 + description: calls per hour allowed by the user + X-Expires-After: + type: string + format: date-time + description: date in UTC when toekn expires + '400': + description: Invalid username/password supplied + /user/logout: + get: + tags: + - user + summary: Logs out current logged in user session + description: '' + operationId: logoutUser + produces: + - application/xml + - application/json + parameters: [] + responses: + default: + description: successful operation + '/user/{username}': + get: + tags: + - user + summary: Get user by user name + description: '' + operationId: getUserByName + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: 'The name that needs to be fetched. Use user1 for testing.' + required: true + type: string + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/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 + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: name that need to be deleted + required: true + type: string + - in: body + name: body + description: Updated user object + required: true + schema: + $ref: '#/definitions/User' + responses: + '400': + description: Invalid user supplied + '404': + description: User not found + delete: + tags: + - user + summary: Delete user + description: This can only be done by the logged in user. + operationId: deleteUser + produces: + - application/xml + - application/json + parameters: + - name: username + in: path + description: The name that needs to be deleted + required: true + type: string + responses: + '400': + description: Invalid username supplied + '404': + description: User not found +securityDefinitions: + petstore_auth: + type: oauth2 + authorizationUrl: 'http://petstore.swagger.io/api/oauth/dialog' + flow: implicit + scopes: + 'write:pets': modify pets in your account + 'read:pets': read your pets + api_key: + type: apiKey + name: api_key + in: header +definitions: + 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 + 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 + x-nullable: true + category: + $ref: '#/definitions/Category' + name: + type: string + example: doggie + x-nullable: true + photoUrls: + type: array + xml: + name: photoUrl + wrapped: true + items: + type: string + x-nullable: true + tags: + x-nullable: true + type: array + xml: + name: tag + wrapped: true + items: + $ref: '#/definitions/Tag' + status: + type: string + x-nullable: true + 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/2_0/petstore-security-test.yaml b/modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml index e63cb90e0a6..f1400ad8c63 100644 --- a/modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/petstore-security-test.yaml @@ -36,7 +36,7 @@ paths: parameters: - name: test code inject */ ' " =end -- \r\n \n \r type: string - in: formData + in: formData description: To test code injection */ ' " =end -- \r\n \n \r responses: '400': diff --git a/modules/openapi-generator/src/test/resources/2_0/rust-server/rust-server-test.yaml b/modules/openapi-generator/src/test/resources/2_0/rust-server/rust-server-test.yaml index b1874cc158e..1aff69d888b 100644 --- a/modules/openapi-generator/src/test/resources/2_0/rust-server/rust-server-test.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/rust-server/rust-server-test.yaml @@ -19,3 +19,14 @@ definitions: additionalProperties: type: string example: "foo" + aNullableContainer: + type: object + properties: + NullableThing: + type: string + x-nullable: true + RequiredNullableThing: + type: string + x-nullable: true + required: + - RequiredNullableThing diff --git a/modules/openapi-generator/src/test/resources/3_0/allOf.yaml b/modules/openapi-generator/src/test/resources/3_0/allOf.yaml index 3c7baaae8b7..6f01aeb80c9 100644 --- a/modules/openapi-generator/src/test/resources/3_0/allOf.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/allOf.yaml @@ -53,9 +53,9 @@ components: Child: description: A representation of a child allOf: - - $ref: '#/components/schemas/Person' - type: object properties: age: type: integer - format: int32 \ No newline at end of file + format: int32 + - $ref: '#/components/schemas/Person' diff --git a/modules/openapi-generator/src/test/resources/3_0/callbacks.yaml b/modules/openapi-generator/src/test/resources/3_0/callbacks.yaml new file mode 100644 index 00000000000..1423867789b --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/callbacks.yaml @@ -0,0 +1,85 @@ +openapi: 3.0.0 +info: + title: Callback Example + version: 1.0.0 +paths: + /streams: + post: + description: subscribes a client to receive out-of-band data + parameters: + - name: callbackUrl + in: query + required: true + description: | + the location where data will be sent. Must be network accessible + by the source server + schema: + type: string + format: uri + example: https://tonys-server.com + responses: + '201': + description: subscription successfully created + content: + application/json: + schema: + description: subscription information + required: + - subscriptionId + properties: + subscriptionId: + description: this unique identifier allows management of the subscription + type: string + example: 2531329f-fb09-4ef7-887e-84e648214436 + callbacks: + onData: + '{$request.query.callbackUrl}/data': + post: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/NewNotificationData' + responses: + '202': + description: | + Your server implementation should return this HTTP status code + if the data was received successfully + '204': + description: | + Your server should return this HTTP status code if no longer interested + in further updates + delete: + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DeleteNotificationData' + responses: + '202': + description: | + Your server implementation should return this HTTP status code + if the data was received successfully + '204': + description: | + Your server should return this HTTP status code if no longer interested + in further updates + '{$request.query.callbackUrl}/test': {} + dummy: {} + +components: + schemas: + NewNotificationData: + description: subscription payload + properties: + timestamp: + type: string + format: date-time + userData: + type: string + DeleteNotificationData: + description: subscription payload + properties: + timestamp: + type: string + format: date-time diff --git a/modules/openapi-generator/src/test/resources/3_0/issue_241.yaml b/modules/openapi-generator/src/test/resources/3_0/issue_241.yaml new file mode 100644 index 00000000000..982f18a2d6b --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/issue_241.yaml @@ -0,0 +1,47 @@ +openapi: "3.0.0" +info: + description: "test" + version: "1.0.0" + title: "myTest" + contact: + email: "my@mail.com" +servers: +- url: "http://localhost:9998/v1" +tags: +- name: "users" +paths: + /users/create/{username}: + post: + tags: + - "user" + operationId: "createUser" + parameters: + - name: "username" + in: "path" + required: true + schema: + type: "string" + responses: + 200: + description: "The User just created" + content: + application/json: + schema: + $ref: "#/components/schemas/User" +components: + schemas: + User: + allOf: + - $ref: "#/components/schemas/UserDetail" + - type: "object" + description: "The User" + required: + - "userid" + - "username" + UserDetail: + type: "object" + description: "Detail of a User" + properties: + name: + type: "string" + description: "the name of the user" diff --git a/modules/openapi-generator/src/test/resources/3_0/petstore_oas3_test.yaml b/modules/openapi-generator/src/test/resources/3_0/petstore_oas3_test.yaml index c9c83e09a6b..370ae3ee32f 100644 --- a/modules/openapi-generator/src/test/resources/3_0/petstore_oas3_test.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/petstore_oas3_test.yaml @@ -181,6 +181,7 @@ paths: schema: type: integer format: int64 + nullable: true responses: '405': description: Invalid input @@ -200,6 +201,7 @@ paths: status: description: Updated status of the pet type: string + nullable: true delete: tags: - pet diff --git a/pom.xml b/pom.xml index 75dcc5d5dc4..05b212826fb 100644 --- a/pom.xml +++ b/pom.xml @@ -158,6 +158,7 @@ none:none -XX:+StartAttachListener + -javaagent:${settings.localRepository}/org/jmockit/jmockit/${jmockit-version}/jmockit-${jmockit-version}.jar @@ -189,7 +190,7 @@ maven-compiler-plugin - 3.6.1 + 3.8.0 1.8 1.8 @@ -198,7 +199,7 @@ org.apache.maven.plugins maven-jar-plugin - 3.0.2 + 3.1.0 @@ -213,7 +214,7 @@ org.apache.maven.plugins maven-site-plugin - 3.5.1 + 3.7.1 org.apache.maven.plugins @@ -260,7 +261,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 1.4.1 + 3.0.0-M2 enforce-versions @@ -280,7 +281,7 @@ de.thetaphi forbiddenapis - 2.5 + 2.6 + samples/client/petstore/dart-jaguar/openapi + samples/client/petstore/dart-jaguar/flutter_petstore/openapi + samples/client/petstore/dart2/petstore samples/client/petstore/haskell-http-client - samples/client/petstore/elm + samples/client/petstore/elm-0.18 samples/client/petstore/groovy samples/client/petstore/rust @@ -1024,6 +1040,7 @@ samples/client/petstore/typescript-fetch/builds/es6-target samples/client/petstore/typescript-fetch/builds/with-npm-version samples/client/petstore/typescript-fetch/tests/default + samples/client/petstore/typescript-axios/tests/default samples/client/petstore/typescript-node/npm @@ -1038,6 +1055,158 @@ samples/server/petstore/rust-server + + + samples.circleci + + + env + samples.circleci + + + + + + samples/client/petstore/go + samples/client/petstore/typescript-angular-v6-provided-in-root + + samples/client/petstore/scala-akka + samples/client/petstore/scala-httpclient + samples/client/petstore/scalaz + samples/client/petstore/clojure + samples/client/petstore/java/feign + samples/client/petstore/java/feign10x + samples/client/petstore/java/jersey1 + samples/client/petstore/java/jersey2 + samples/client/petstore/java/jersey2-java8 + samples/client/petstore/java/okhttp-gson + samples/client/petstore/java/retrofit + samples/client/petstore/java/retrofit2 + samples/client/petstore/java/retrofit2rx + samples/client/petstore/java/retrofit2-play25 + samples/client/petstore/java/retrofit2-play26 + samples/client/petstore/jaxrs-cxf-client + samples/client/petstore/java/resttemplate + samples/client/petstore/java/resttemplate-withXml + samples/client/petstore/java/webclient + samples/client/petstore/java/vertx + samples/client/petstore/java/resteasy + samples/client/petstore/java/google-api-client + samples/client/petstore/java/rest-assured + samples/client/petstore/kotlin/ + samples/client/petstore/kotlin-threetenbp/ + samples/client/petstore/kotlin-string/ + + samples/server/petstore/jaxrs-jersey + samples/server/petstore/jaxrs-spec + samples/server/petstore/jaxrs-spec-interface + samples/server/petstore/jaxrs-spec-interface-response + samples/server/petstore/java-vertx/rx + samples/server/petstore/java-vertx/async + samples/server/petstore/java-inflector + samples/server/petstore/java-pkmst + samples/server/petstore/java-play-framework + samples/server/petstore/java-play-framework-no-wrap-calls + samples/server/petstore/java-play-framework-no-swagger-ui + samples/server/petstore/java-play-framework-no-interface + samples/server/petstore/java-play-framework-no-exception-handling + samples/server/petstore/java-play-framework-no-bean-validation + samples/server/petstore/java-play-framework-fake-endpoints + samples/server/petstore/java-play-framework-controller-only + samples/server/petstore/java-play-framework-api-package-override + samples/server/petstore/undertow + samples/server/petstore/jaxrs/jersey1 + samples/server/petstore/jaxrs/jersey1-useTags + + samples/server/petstore/jaxrs-datelib-j8 + samples/server/petstore/jaxrs-resteasy/default + samples/server/petstore/jaxrs-resteasy/eap + samples/server/petstore/jaxrs-resteasy/eap-joda + samples/server/petstore/jaxrs-resteasy/eap-java8 + samples/server/petstore/jaxrs-resteasy/joda + + + samples/client/petstore/spring-cloud + samples/server/petstore/springboot + samples/server/petstore/springboot-beanvalidation + samples/server/petstore/springboot-useoptional + samples/server/petstore/jaxrs-cxf + samples/server/petstore/jaxrs-cxf-annotated-base-path + samples/server/petstore/jaxrs-cxf-cdi + samples/server/petstore/jaxrs-cxf-non-spring-app + samples/server/petstore/java-msf4j + samples/server/petstore/scala-lagom-server + samples/server/petstore/scalatra + samples/server/petstore/finch + samples/server/petstore/kotlin-springboot + + + + + samples.circleci.jdk7 + + + env + samples.circleci.jdk7 + + + + + + samples/client/petstore/scala-akka + samples/client/petstore/scala-httpclient + samples/client/petstore/scalaz + samples/client/petstore/clojure + samples/client/petstore/java/feign + samples/client/petstore/java/jersey1 + samples/client/petstore/java/jersey2 + samples/client/petstore/java/okhttp-gson + samples/client/petstore/java/retrofit + samples/client/petstore/java/retrofit2 + samples/client/petstore/java/retrofit2rx + samples/client/petstore/jaxrs-cxf-client + samples/client/petstore/java/resttemplate + samples/client/petstore/java/resttemplate-withXml + samples/client/petstore/java/vertx + samples/client/petstore/java/resteasy + samples/client/petstore/java/google-api-client + samples/client/petstore/kotlin/ + + samples/server/petstore/jaxrs-jersey + samples/server/petstore/jaxrs-spec + samples/server/petstore/jaxrs-spec-interface + samples/server/petstore/jaxrs-spec-interface-response + samples/server/petstore/java-vertx/rx + samples/server/petstore/java-vertx/async + samples/server/petstore/java-inflector + samples/server/petstore/undertow + samples/server/petstore/jaxrs/jersey1 + samples/server/petstore/jaxrs/jersey2 + samples/server/petstore/jaxrs/jersey1-useTags + samples/server/petstore/jaxrs/jersey2-useTags + samples/server/petstore/jaxrs-resteasy/default + samples/server/petstore/jaxrs-resteasy/eap + samples/server/petstore/jaxrs-resteasy/eap-joda + samples/server/petstore/jaxrs-resteasy/eap-java8 + samples/server/petstore/jaxrs-resteasy/joda + samples/server/petstore/spring-mvc + samples/client/petstore/spring-cloud + samples/server/petstore/springboot + samples/server/petstore/springboot-beanvalidation + samples/server/petstore/springboot-useoptional + samples/server/petstore/jaxrs-cxf + samples/server/petstore/jaxrs-cxf-annotated-base-path + samples/server/petstore/jaxrs-cxf-cdi + samples/server/petstore/jaxrs-cxf-non-spring-app + samples/server/petstore/java-msf4j + + + samples.shippable @@ -1048,6 +1217,7 @@ + samples/client/petstore/elm samples/client/petstore/elixir samples/client/petstore/erlang-client @@ -1061,6 +1231,41 @@ samples/server/petstore/php-slim + + samples.ios + + + env + samples.ios + + + + samples/client/petstore/swift4/default/SwaggerClientTests + samples/client/petstore/swift4/promisekit/SwaggerClientTests + samples/client/petstore/swift4/rxswift/SwaggerClientTests + samples/client/petstore/swift3/default/SwaggerClientTests + samples/client/petstore/swift3/promisekit/SwaggerClientTests + samples/client/petstore/swift3/rxswift/SwaggerClientTests + samples/client/petstore/swift/default/SwaggerClientTests + samples/client/petstore/swift/promisekit/SwaggerClientTests + samples/client/petstore/swift/rxswift/SwaggerClientTests + + + + + samples.bash + + + env + samples.bash + + + + samples/client/petstore/bash + + modules/openapi-generator @@ -1080,7 +1285,7 @@ org.apache.maven.plugins maven-jxr-plugin - 2.5 + 3.0.0 true @@ -1088,7 +1293,7 @@ org.apache.maven.plugins maven-project-info-reports-plugin - 2.9 + 3.0.0 @@ -1133,10 +1338,10 @@ 1.8 1.8 - 2.0.2-OpenAPITools.org-1 - 2.0.1 + 2.0.4 + 2.0.4 2.11.1 - 3.3.0 + 3.3.1 2.4 1.2 4.8.1 @@ -1147,8 +1352,8 @@ 3.2.1 1.14 6.9.6 - 2.19.1 - 1.25 + 2.22.0 + 1.43 0.9.10 2.0.2.RELEASE diff --git a/samples/client/petstore-security-test/go/.openapi-generator/VERSION b/samples/client/petstore-security-test/go/.openapi-generator/VERSION index 096bf47efe3..f4cb97d56ce 100644 --- a/samples/client/petstore-security-test/go/.openapi-generator/VERSION +++ b/samples/client/petstore-security-test/go/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/go/README.md b/samples/client/petstore-security-test/go/README.md index ea6e8af4f50..f94b342e314 100644 --- a/samples/client/petstore-security-test/go/README.md +++ b/samples/client/petstore-security-test/go/README.md @@ -26,7 +26,7 @@ import "./openapi" ## Documentation for API Endpoints -All URIs are relative to *petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r* +All URIs are relative to *http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- diff --git a/samples/client/petstore-security-test/go/api/openapi.yaml b/samples/client/petstore-security-test/go/api/openapi.yaml index 8ed2aa894f4..ad8c8ff7cf2 100644 --- a/samples/client/petstore-security-test/go/api/openapi.yaml +++ b/samples/client/petstore-security-test/go/api/openapi.yaml @@ -1,33 +1,31 @@ openapi: 3.0.1 info: - title: OpenAPI Petstore */ ' " =end -- \r\n \n \r + contact: + email: something@something.abc */ ' " =end -- \r\n \n \r description: "This spec is mainly for testing Petstore server and contains fake\ \ endpoints, models. Please do not use this for any other purpose. Special characters:\ \ \" \\ */ ' \" =end -- \r\n \n \r" - termsOfService: http://url.to/terms/ */ ' " =end -- \r\n \n \r - contact: - email: something@something.abc */ ' " =end -- \r\n \n \r license: name: Apache-2.0 */ ' " =end -- \r\n \n \r url: http://www.apache.org/licenses/LICENSE-2.0.html */ ' " =end -- \r\n \n \r + termsOfService: http://url.to/terms/ */ ' " =end -- \r\n \n \r + title: OpenAPI Petstore */ ' " =end -- \r\n \n \r version: 1.0.0 */ ' " =end -- \r\n \n \r externalDocs: description: Find out more about OpenAPI */ ' " =end -- \r\n \n \r url: https://openapis.org servers: -- url: petstore.swagger.io */ ' " =end -- \r\n \n \r/v2 */ ' " =end -- \r\n \n \r +- url: //petstore.swagger.io */ ' " =end -- \r\n \n \r/v2 */ ' " =end -- \r\n \n \r tags: -- name: fake - description: Everything about your Pets */ ' " =end -- \r\n \n \r +- description: Everything about your Pets */ ' " =end -- \r\n \n \r externalDocs: description: Find out more */ ' " =end -- \r\n \n \r url: https://openapis.org + name: fake paths: /fake: put: - tags: - - fake - summary: To test code injection */ ' " =end -- \r\n \n \r + description: To test code injection */ ' " =end -- \r\n \n \r operationId: testCodeInject */ ' " =end -- \r\n \n \r requestBody: content: @@ -35,40 +33,43 @@ paths: schema: properties: test code inject */ ' " =end -- \r\n \n \r: - type: string description: To test code injection */ ' " =end -- \r\n \n \r + type: string ? "*/ ' \" =end -- \r\n \n \r" : schema: properties: test code inject */ ' " =end -- \r\n \n \r: - type: string description: To test code injection */ ' " =end -- \r\n \n \r + type: string responses: 400: - description: To test code injection */ ' " =end -- \r\n \n \r content: {} + description: To test code injection */ ' " =end -- \r\n \n \r + summary: To test code injection */ ' " =end -- \r\n \n \r + tags: + - fake components: schemas: Return: - type: object + description: Model for testing reserved words */ ' " =end -- \r\n \n \r properties: return: - type: integer description: property description */ ' " =end -- \r\n \n \r format: int32 - description: Model for testing reserved words */ ' " =end -- \r\n \n \r + type: integer + type: object xml: name: Return securitySchemes: petstore_auth: - type: oauth2 flows: implicit: authorizationUrl: http://petstore.swagger.io/api/oauth/dialog scopes: write:pets: modify pets in your account */ ' " =end -- \r\n \n \r read:pets: read your pets */ ' " =end -- \r\n \n \r + type: oauth2 api_key: - type: apiKey - name: api_key */ ' " =end -- \r\n \n \r in: header + name: api_key */ ' " =end -- \r\n \n \r + type: apiKey diff --git a/samples/client/petstore-security-test/go/api_fake.go b/samples/client/petstore-security-test/go/api_fake.go index c0668d851ef..957fbf39952 100644 --- a/samples/client/petstore-security-test/go/api_fake.go +++ b/samples/client/petstore-security-test/go/api_fake.go @@ -16,6 +16,7 @@ import ( "net/http" "net/url" "strings" + "github.com/antihax/optional" ) // Linger please @@ -25,23 +26,25 @@ var ( type FakeApiService service -/* -FakeApiService To test code injection *_/ ' \" =end -- \\r\\n \\n \\r +/* +FakeApiService To test code injection *_/ ' \" =end -- \\r\\n \\n \\r +To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param optional nil or *TestCodeInjectEndRnNROpts - Optional Parameters: - * @param "UNKNOWNBASETYPE" (optional.Interface of interface{}) - + * @param "UNKNOWNBASETYPE" (optional.Interface of UNKNOWN_BASE_TYPE) - */ type TestCodeInjectEndRnNROpts struct { - UNKNOWNBASETYPE optional.Interface + UNKNOWNBASETYPE optional.Interface } func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOptionals *TestCodeInjectEndRnNROpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") - localVarPostBody interface{} - localVarFileName string - localVarFileBytes []byte + localVarHttpMethod = strings.ToUpper("Put") + localVarPostBody interface{} + localVarFormFileName string + localVarFileName string + localVarFileBytes []byte ) // create path and map variables @@ -70,14 +73,14 @@ func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOpti } // body params if localVarOptionals != nil && localVarOptionals.UNKNOWNBASETYPE.IsSet() { - localVarOptionalUNKNOWNBASETYPE, localVarOptionalUNKNOWNBASETYPEok := localVarOptionals.UNKNOWNBASETYPE.Value().(interface{}) + localVarOptionalUNKNOWNBASETYPE, localVarOptionalUNKNOWNBASETYPEok := localVarOptionals.UNKNOWNBASETYPE.Value().(UNKNOWN_BASE_TYPE) if !localVarOptionalUNKNOWNBASETYPEok { - return nil, reportError("uNKNOWNBASETYPE should be interface{}") + return nil, reportError("uNKNOWNBASETYPE should be UNKNOWN_BASE_TYPE") } localVarPostBody = &localVarOptionalUNKNOWNBASETYPE } - r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return nil, err } @@ -95,7 +98,7 @@ func (a *FakeApiService) TestCodeInjectEndRnNR(ctx context.Context, localVarOpti if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr diff --git a/samples/client/petstore-security-test/go/client.go b/samples/client/petstore-security-test/go/client.go index 9af81649e26..8d579d2ee72 100644 --- a/samples/client/petstore-security-test/go/client.go +++ b/samples/client/petstore-security-test/go/client.go @@ -139,6 +139,8 @@ func parameterToString(obj interface{}, collectionFormat string) string { if reflect.TypeOf(obj).Kind() == reflect.Slice { return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]") + } else if t, ok := obj.(time.Time); ok { + return t.Format(time.RFC3339) } return fmt.Sprintf("%v", obj) @@ -162,6 +164,7 @@ func (c *APIClient) prepareRequest( headerParams map[string]string, queryParams url.Values, formParams url.Values, + formFileName string, fileName string, fileBytes []byte) (localVarRequest *http.Request, err error) { @@ -182,7 +185,7 @@ func (c *APIClient) prepareRequest( } // add form parameters and file if available. - if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { if body != nil { return nil, errors.New("Cannot specify postBody and multipart form at the same time.") } @@ -204,7 +207,7 @@ func (c *APIClient) prepareRequest( if len(fileBytes) > 0 && fileName != "" { w.Boundary() //_, fileNm := filepath.Split(fileName) - part, err := w.CreateFormFile("file", filepath.Base(fileName)) + part, err := w.CreateFormFile(formFileName, filepath.Base(fileName)) if err != nil { return nil, err } @@ -221,6 +224,16 @@ func (c *APIClient) prepareRequest( w.Close() } + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + // Setup path and query parameters url, err := url.Parse(path) if err != nil { @@ -424,8 +437,9 @@ func CacheExpires(r *http.Response) time.Time { lifetime, err := time.ParseDuration(maxAge + "s") if err != nil { expires = now + } else { + expires = now.Add(lifetime) } - expires = now.Add(lifetime) } else { expiresHeader := r.Header.Get("Expires") if expiresHeader != "" { @@ -462,4 +476,4 @@ func (e GenericOpenAPIError) Body() []byte { // Model returns the unpacked model of the error func (e GenericOpenAPIError) Model() interface{} { return e.model -} \ No newline at end of file +} diff --git a/samples/client/petstore-security-test/go/configuration.go b/samples/client/petstore-security-test/go/configuration.go index 659bb16f14f..961a31cd517 100644 --- a/samples/client/petstore-security-test/go/configuration.go +++ b/samples/client/petstore-security-test/go/configuration.go @@ -25,7 +25,7 @@ func (c contextKey) String() string { } var ( - // ContextOAuth2 takes a oauth2.TokenSource as authentication for the request. + // ContextOAuth2 takes an oauth2.TokenSource as authentication for the request. ContextOAuth2 = contextKey("token") // ContextBasicAuth takes BasicAuth as authentication for the request. @@ -61,7 +61,7 @@ type Configuration struct { func NewConfiguration() *Configuration { cfg := &Configuration{ - BasePath: "petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r", + BasePath: "http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r", DefaultHeader: make(map[string]string), UserAgent: "OpenAPI-Generator/1.0.0/go", } diff --git a/samples/client/petstore-security-test/go/docs/FakeApi.md b/samples/client/petstore-security-test/go/docs/FakeApi.md index c556953bdd7..3896e6044b3 100644 --- a/samples/client/petstore-security-test/go/docs/FakeApi.md +++ b/samples/client/petstore-security-test/go/docs/FakeApi.md @@ -1,6 +1,6 @@ # \FakeApi -All URIs are relative to *petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r* +All URIs are relative to *http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -11,6 +11,8 @@ Method | HTTP request | Description > TestCodeInjectEndRnNR(ctx, optional) To test code injection *_/ ' \" =end -- \\r\\n \\n \\r +To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + ### Required Parameters Name | Type | Description | Notes @@ -23,7 +25,7 @@ Optional parameters are passed through a pointer to a TestCodeInjectEndRnNROpts Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **uNKNOWNBASETYPE** | [**optional.Interface of interface{}**](UNKNOWN_BASE_TYPE.md)| | + **uNKNOWNBASETYPE** | [**optional.Interface of UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| | ### Return type diff --git a/samples/client/petstore-security-test/java/okhttp-gson/.openapi-generator/VERSION b/samples/client/petstore-security-test/java/okhttp-gson/.openapi-generator/VERSION index 096bf47efe3..f4cb97d56ce 100644 --- a/samples/client/petstore-security-test/java/okhttp-gson/.openapi-generator/VERSION +++ b/samples/client/petstore-security-test/java/okhttp-gson/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/java/okhttp-gson/build.gradle b/samples/client/petstore-security-test/java/okhttp-gson/build.gradle index df65ade70d1..9d4f85b4459 100644 --- a/samples/client/petstore-security-test/java/okhttp-gson/build.gradle +++ b/samples/client/petstore-security-test/java/okhttp-gson/build.gradle @@ -99,6 +99,7 @@ dependencies { compile 'com.squareup.okhttp:logging-interceptor:2.7.5' compile 'com.google.code.gson:gson:2.8.1' compile 'io.gsonfire:gson-fire:1.8.0' + compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1' compile 'org.threeten:threetenbp:1.3.5' testCompile 'junit:junit:4.12' } diff --git a/samples/client/petstore-security-test/java/okhttp-gson/docs/FakeApi.md b/samples/client/petstore-security-test/java/okhttp-gson/docs/FakeApi.md index 362984cef7a..a125de0a897 100644 --- a/samples/client/petstore-security-test/java/okhttp-gson/docs/FakeApi.md +++ b/samples/client/petstore-security-test/java/okhttp-gson/docs/FakeApi.md @@ -1,6 +1,6 @@ # FakeApi -All URIs are relative to *petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r* +All URIs are relative to *http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r* Method | HTTP request | Description ------------- | ------------- | ------------- @@ -13,6 +13,8 @@ Method | HTTP request | Description To test code injection *_/ ' \" =end -- \\r\\n \\n \\r +To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + ### Example ```java // Import classes: @@ -21,7 +23,7 @@ To test code injection *_/ ' \" =end -- \\r\\n \\n \\r FakeApi apiInstance = new FakeApi(); -Object UNKNOWN_BASE_TYPE = new UNKNOWN_BASE_TYPE(); // Object | +UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE = new UNKNOWN_BASE_TYPE(); // UNKNOWN_BASE_TYPE | try { apiInstance.testCodeInjectEndRnNR(UNKNOWN_BASE_TYPE); } catch (ApiException e) { @@ -34,7 +36,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **UNKNOWN_BASE_TYPE** | [**Object**](UNKNOWN_BASE_TYPE.md)| | [optional] + **UNKNOWN_BASE_TYPE** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md)| | [optional] ### Return type diff --git a/samples/client/petstore-security-test/java/okhttp-gson/pom.xml b/samples/client/petstore-security-test/java/okhttp-gson/pom.xml index e019833bfa1..5fd04f361b2 100644 --- a/samples/client/petstore-security-test/java/okhttp-gson/pom.xml +++ b/samples/client/petstore-security-test/java/okhttp-gson/pom.xml @@ -212,6 +212,11 @@ io.gsonfire gson-fire ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.1 org.threeten diff --git a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java index e05519dae10..de2793cbeef 100644 --- a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java @@ -23,6 +23,9 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import org.threeten.bp.format.DateTimeFormatter; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + import javax.net.ssl.*; import java.io.File; import java.io.IOException; @@ -49,10 +52,12 @@ import org.openapitools.client.auth.Authentication; import org.openapitools.client.auth.HttpBasicAuth; import org.openapitools.client.auth.ApiKeyAuth; import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; public class ApiClient { - private String basePath = "petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r"; + private String basePath = "http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r"; private boolean debugging = false; private Map defaultHeaderMap = new HashMap(); private String tempFolderPath = null; @@ -77,6 +82,37 @@ public class ApiClient { * Constructor for ApiClient */ public ApiClient() { + init(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key */ ' " =end -- \r\n \n \r")); + authentications.put("petstore_auth", new OAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /* + * Constructor for ApiClient to support access token retry on 401/403 + */ + public ApiClient( + String clientId, + String clientSecret, + Map parameters + ) { + init(); + + RetryingOAuth retryingOAuth = new RetryingOAuth("", clientId, OAuthFlow.implicit, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + httpClient.interceptors().add(retryingOAuth); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + private void init() { httpClient = new OkHttpClient(); @@ -87,12 +123,7 @@ public class ApiClient { // Set default User-Agent. setUserAgent("OpenAPI-Generator/1.0.0/java"); - // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); - authentications.put("api_key", new ApiKeyAuth("header", "api_key */ ' " =end -- \r\n \n \r")); - authentications.put("petstore_auth", new OAuth()); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); } /** @@ -107,7 +138,7 @@ public class ApiClient { /** * Set base path * - * @param basePath Base path of the URL (e.g petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r + * @param basePath Base path of the URL (e.g http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r * @return An instance of OkHttpClient */ public ApiClient setBasePath(String basePath) { @@ -482,6 +513,20 @@ public class ApiClient { return this; } + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + /** * Format the given parameter object into string. * @@ -497,7 +542,7 @@ public class ApiClient { return jsonStr.substring(1, jsonStr.length() - 1); } else if (param instanceof Collection) { StringBuilder b = new StringBuilder(); - for (Object o : (Collection)param) { + for (Object o : (Collection) param) { if (b.length() > 0) { b.append(","); } @@ -522,7 +567,9 @@ public class ApiClient { List params = new ArrayList(); // preconditions - if (name == null || name.isEmpty() || value == null || value instanceof Collection) return params; + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } params.add(new Pair(name, parameterToString(value))); return params; @@ -567,7 +614,7 @@ public class ApiClient { delimiter = escapeString("|"); } - StringBuilder sb = new StringBuilder() ; + StringBuilder sb = new StringBuilder(); for (Object item : value) { sb.append(delimiter); sb.append(escapeString(parameterToString(item))); @@ -637,7 +684,7 @@ public class ApiClient { */ public String selectHeaderContentType(String[] contentTypes) { if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { - return "application/json"; + return "application/json"; } for (String contentType : contentTypes) { if (isJsonMime(contentType)) { @@ -895,7 +942,7 @@ public class ApiClient { * @param Type * @param response Response * @param returnType Return type - * @throws ApiException If the response has a unsuccessful status code or + * @throws ApiException If the response has an unsuccessful status code or * fail to deserialize the response body * @return Type */ @@ -961,7 +1008,7 @@ public class ApiClient { * @param formParams The form parameters * @param authNames The authentications to apply * @param progressRequestListener Progress request listener - * @return The HTTP request + * @return The HTTP request * @throws ApiException If fail to serialize the request body object */ public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { @@ -1078,13 +1125,15 @@ public class ApiClient { * Update query and header parameters based on authentication settings. * * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters + * @param queryParams List of query parameters + * @param headerParams Map of header parameters */ public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { for (String authName : authNames) { Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } auth.applyToParams(queryParams, headerParams); } } @@ -1096,7 +1145,7 @@ public class ApiClient { * @return RequestBody */ public RequestBody buildRequestBodyFormEncoding(Map formParams) { - FormEncodingBuilder formBuilder = new FormEncodingBuilder(); + FormEncodingBuilder formBuilder = new FormEncodingBuilder(); for (Entry param : formParams.entrySet()) { formBuilder.add(param.getKey(), parameterToString(param.getValue())); } @@ -1159,10 +1208,12 @@ public class ApiClient { public X509Certificate[] getAcceptedIssuers() { return null; } }; SSLContext sslContext = SSLContext.getInstance("TLS"); - trustManagers = new TrustManager[]{ trustAll }; + trustManagers = new TrustManager[] {trustAll}; hostnameVerifier = new HostnameVerifier() { @Override - public boolean verify(String hostname, SSLSession session) { return true; } + public boolean verify(String hostname, SSLSession session) { + return true; + } }; } else if (sslCaCert != null) { char[] password = null; // Any password will work. diff --git a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/GzipRequestInterceptor.java b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/GzipRequestInterceptor.java index bf05bae5d65..e96eea39113 100644 --- a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/GzipRequestInterceptor.java +++ b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/GzipRequestInterceptor.java @@ -27,7 +27,8 @@ import java.io.IOException; * Taken from https://github.com/square/okhttp/issues/350 */ class GzipRequestInterceptor implements Interceptor { - @Override public Response intercept(Chain chain) throws IOException { + @Override + public Response intercept(Chain chain) throws IOException { Request originalRequest = chain.request(); if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { return chain.proceed(originalRequest); @@ -63,19 +64,22 @@ class GzipRequestInterceptor implements Interceptor { private RequestBody gzip(final RequestBody body) { return new RequestBody() { - @Override public MediaType contentType() { + @Override + public MediaType contentType() { return body.contentType(); } - @Override public long contentLength() { + @Override + public long contentLength() { return -1; // We don't know the compressed length in advance! } - @Override public void writeTo(BufferedSink sink) throws IOException { + @Override + public void writeTo(BufferedSink sink) throws IOException { BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); body.writeTo(gzipSink); gzipSink.close(); } }; } -} \ No newline at end of file +} diff --git a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java index c9048812f0c..ad407544f21 100644 --- a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java @@ -37,6 +37,7 @@ import java.text.DateFormat; import java.text.ParseException; import java.text.ParsePosition; import java.util.Date; +import java.util.Locale; import java.util.Map; import java.util.HashMap; @@ -52,20 +53,21 @@ public class JSON { public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() ; - return fireBuilder.createGsonBuilder(); + GsonBuilder builder = fireBuilder.createGsonBuilder(); + return builder; } private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { JsonElement element = readElement.getAsJsonObject().get(discriminatorField); - if(null == element) { + if (null == element) { throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); } return element.getAsString(); } private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { - Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase()); - if(null == clazz) { + Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase(Locale.ROOT)); + if (null == clazz) { throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); } return clazz; @@ -138,9 +140,11 @@ public class JSON { } catch (JsonParseException e) { // Fallback processing when failed to parse JSON form response body: // return the response body string directly for the String return type; - if (returnType.equals(String.class)) + if (returnType.equals(String.class)) { return (T) body; - else throw (e); + } else { + throw (e); + } } } @@ -276,8 +280,7 @@ public class JSON { private DateFormat dateFormat; - public SqlDateTypeAdapter() { - } + public SqlDateTypeAdapter() {} public SqlDateTypeAdapter(DateFormat dateFormat) { this.dateFormat = dateFormat; @@ -330,8 +333,7 @@ public class JSON { private DateFormat dateFormat; - public DateTypeAdapter() { - } + public DateTypeAdapter() {} public DateTypeAdapter(DateFormat dateFormat) { this.dateFormat = dateFormat; diff --git a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/Pair.java index 272b75b00c8..322c36522b9 100644 --- a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/Pair.java @@ -24,13 +24,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -44,8 +48,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/StringUtil.java index 52188543e5f..9d03dee5fba 100644 --- a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java index 2b03a1dbe80..be842a24fc1 100644 --- a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java @@ -27,6 +27,7 @@ import com.google.gson.reflect.TypeToken; import java.io.IOException; +import org.openapitools.client.model.UNKNOWN_BASE_TYPE; import java.lang.reflect.Type; import java.util.ArrayList; @@ -61,7 +62,7 @@ public class FakeApi { * @return Call to execute * @throws ApiException If fail to serialize the request body object */ - public com.squareup.okhttp.Call testCodeInjectEndRnNRCall(Object UNKNOWN_BASE_TYPE, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + public com.squareup.okhttp.Call testCodeInjectEndRnNRCall(UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { Object localVarPostBody = UNKNOWN_BASE_TYPE; // create path and map variables @@ -69,16 +70,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json", "*_/ ' =end -- " @@ -86,7 +86,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -103,7 +103,7 @@ public class FakeApi { } @SuppressWarnings("rawtypes") - private com.squareup.okhttp.Call testCodeInjectEndRnNRValidateBeforeCall(Object UNKNOWN_BASE_TYPE, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + private com.squareup.okhttp.Call testCodeInjectEndRnNRValidateBeforeCall(UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { com.squareup.okhttp.Call call = testCodeInjectEndRnNRCall(UNKNOWN_BASE_TYPE, progressListener, progressRequestListener); @@ -113,35 +113,35 @@ public class FakeApi { /** * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r - * + * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * @param UNKNOWN_BASE_TYPE (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public void testCodeInjectEndRnNR(Object UNKNOWN_BASE_TYPE) throws ApiException { + public void testCodeInjectEndRnNR(UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE) throws ApiException { testCodeInjectEndRnNRWithHttpInfo(UNKNOWN_BASE_TYPE); } /** * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r - * + * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * @param UNKNOWN_BASE_TYPE (optional) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ - public ApiResponse testCodeInjectEndRnNRWithHttpInfo(Object UNKNOWN_BASE_TYPE) throws ApiException { + public ApiResponse testCodeInjectEndRnNRWithHttpInfo(UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE) throws ApiException { com.squareup.okhttp.Call call = testCodeInjectEndRnNRValidateBeforeCall(UNKNOWN_BASE_TYPE, null, null); return apiClient.execute(call); } /** * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r (asynchronously) - * + * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r * @param UNKNOWN_BASE_TYPE (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object */ - public com.squareup.okhttp.Call testCodeInjectEndRnNRAsync(Object UNKNOWN_BASE_TYPE, final ApiCallback callback) throws ApiException { + public com.squareup.okhttp.Call testCodeInjectEndRnNRAsync(UNKNOWN_BASE_TYPE UNKNOWN_BASE_TYPE, final ApiCallback callback) throws ApiException { ProgressResponseBody.ProgressListener progressListener = null; ProgressRequestBody.ProgressRequestListener progressRequestListener = null; diff --git a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 00000000000..76b4f76af76 --- /dev/null +++ b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,68 @@ +package org.openapitools.client.auth; + +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.MediaType; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.RequestBody; +import com.squareup.okhttp.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(mediaType, request.getBody()) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 00000000000..78fcb52d5a3 --- /dev/null +++ b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,165 @@ +package org.openapitools.client.auth; + +import com.squareup.okhttp.Interceptor; +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.Map; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (String paramName : parameters.keySet()) { + tokenRequestBuilder.setParameter(paramName, parameters.get(paramName)); + } + } + } + + public void setFlow(OAuthFlow flow) { + switch(flow) { + case accessCode: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case implicit: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case password: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case application: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.urlString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (String headerName : headers.keySet()) { + requestBuilder.addHeader(headerName, headers.get(headerName)); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /* + * Returns true if the access token has been updated + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + return !getAccessToken().equals(requestAccessToken); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + + return false; + } + + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } +} diff --git a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java index db937fd8170..cb658432bb1 100644 --- a/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore-security-test/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -30,7 +30,8 @@ import java.io.IOException; @ApiModel(description = "Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r") public class ModelReturn { - @SerializedName("return") + public static final String SERIALIZED_NAME_RETURN = "return"; + @SerializedName(SERIALIZED_NAME_RETURN) private Integer _return = null; public ModelReturn _return(Integer _return) { diff --git a/samples/client/petstore-security-test/php/.openapi-generator/VERSION b/samples/client/petstore-security-test/php/.openapi-generator/VERSION index dde25ef08e8..67b096dafc9 100644 --- a/samples/client/petstore-security-test/php/.openapi-generator/VERSION +++ b/samples/client/petstore-security-test/php/.openapi-generator/VERSION @@ -1 +1 @@ -3.1.1-SNAPSHOT \ No newline at end of file +3.2.1-SNAPSHOT diff --git a/samples/client/petstore-security-test/php/.php_cs b/samples/client/petstore-security-test/php/.php_cs new file mode 100644 index 00000000000..4fbe53ec5ff --- /dev/null +++ b/samples/client/petstore-security-test/php/.php_cs @@ -0,0 +1,23 @@ +setUsingCache(true) + ->setRules([ + '@PSR2' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('test') + ->exclude('tests') + ->in(__DIR__) + ); diff --git a/samples/client/petstore-security-test/php/.travis.yml b/samples/client/petstore-security-test/php/.travis.yml new file mode 100644 index 00000000000..d77f3825f6f --- /dev/null +++ b/samples/client/petstore-security-test/php/.travis.yml @@ -0,0 +1,10 @@ +language: php +sudo: false +php: + - 5.4 + - 5.5 + - 5.6 + - 7.0 + - hhvm +before_install: "composer install" +script: "vendor/bin/phpunit" diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/.gitignore b/samples/client/petstore-security-test/php/OpenAPIClient-php/.gitignore new file mode 100644 index 00000000000..edcf63f6aee --- /dev/null +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/.gitignore @@ -0,0 +1,8 @@ +# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore + +composer.phar +/vendor/ + +# Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control +# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file +composer.lock \ No newline at end of file diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/.openapi-generator-ignore b/samples/client/petstore-security-test/php/OpenAPIClient-php/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/.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-security-test/php/OpenAPIClient-php/.openapi-generator/VERSION b/samples/client/petstore-security-test/php/OpenAPIClient-php/.openapi-generator/VERSION new file mode 100644 index 00000000000..6d94c9c2e12 --- /dev/null +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/.php_cs b/samples/client/petstore-security-test/php/OpenAPIClient-php/.php_cs index 6b8e23c818a..4fbe53ec5ff 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/.php_cs +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/.php_cs @@ -1,18 +1,23 @@ level(Symfony\CS\FixerInterface::PSR2_LEVEL) +return PhpCsFixer\Config::create() ->setUsingCache(true) - ->fixers( - [ - 'ordered_use', - 'phpdoc_order', - 'short_array_syntax', - 'strict', - 'strict_param' - ] - ) - ->finder( - Symfony\CS\Finder\DefaultFinder::create() - ->in(__DIR__) + ->setRules([ + '@PSR2' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('test') + ->exclude('tests') + ->in(__DIR__) ); diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/composer.json b/samples/client/petstore-security-test/php/OpenAPIClient-php/composer.json index 65d3c935fb8..45b3c697261 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/composer.json +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "php": ">=5.5", + "php": ">=5.6", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", @@ -27,7 +27,7 @@ "require-dev": { "phpunit/phpunit": "^4.8", "squizlabs/php_codesniffer": "~2.6", - "friendsofphp/php-cs-fixer": "~1.12" + "friendsofphp/php-cs-fixer": "~2.12" }, "autoload": { "psr-4": { "OpenAPI\\Client\\" : "lib/" } diff --git a/samples/client/petstore-security-test/php/OpenAPIClient-php/docs/Api/FakeApi.md b/samples/client/petstore-security-test/php/OpenAPIClient-php/docs/Api/FakeApi.md index dae9ffabe9b..afee7db1162 100644 --- a/samples/client/petstore-security-test/php/OpenAPIClient-php/docs/Api/FakeApi.md +++ b/samples/client/petstore-security-test/php/OpenAPIClient-php/docs/Api/FakeApi.md @@ -12,6 +12,8 @@ Method | HTTP request | Description To test code injection *_/ ' \" =end -- \\r\\n \\n \\r +To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + ### Example ```php $value) { @@ -284,12 +287,13 @@ class ObjectSerializer return new \SplFileObject($filename, 'r'); } elseif (method_exists($class, 'getAllowableEnumValues')) { - if (!in_array($data, $class::getAllowableEnumValues())) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { $imploded = implode("', '", $class::getAllowableEnumValues()); throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); } return $data; } else { + $data = is_string($data) ? json_decode($data) : $data; // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { diff --git a/samples/client/petstore-security-test/php/README.md b/samples/client/petstore-security-test/php/README.md new file mode 100644 index 00000000000..72e324853a6 --- /dev/null +++ b/samples/client/petstore-security-test/php/README.md @@ -0,0 +1,112 @@ +# OpenAPIClient-php +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- + +This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r +- Build package: org.openapitools.codegen.languages.PhpClientCodegen + +## Requirements + +PHP 5.5 and later + +## Installation & Usage +### Composer + +To install the bindings via [Composer](http://getcomposer.org/), add the following to `composer.json`: + +``` +{ + "repositories": [ + { + "type": "git", + "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" + } + ], + "require": { + "GIT_USER_ID/GIT_REPO_ID": "*@dev" + } +} +``` + +Then run `composer install` + +### Manual Installation + +Download the files and include `autoload.php`: + +```php + require_once('/path/to/OpenAPIClient-php/vendor/autoload.php'); +``` + +## Tests + +To run the unit tests: + +``` +composer install +./vendor/bin/phpunit +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```php +testCodeInjectEndRnNR($unknown_base_type); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL; +} + +?> +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*FakeApi* | [**testCodeInjectEndRnNR**](docs/Api/FakeApi.md#testcodeinjectendrnnr) | **PUT** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + + +## Documentation For Models + + - [ModelReturn](docs/Model/ModelReturn.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key */ ' " =end -- \r\n \n \r +- **Location**: HTTP header + +## petstore_auth + +- **Type**: OAuth +- **Flow**: implicit +- **Authorization URL**: http://petstore.swagger.io/api/oauth/dialog +- **Scopes**: + - **write:pets**: modify pets in your account *_/ ' \" =end -- \\r\\n \\n \\r + - **read:pets**: read your pets *_/ ' \" =end -- \\r\\n \\n \\r + + +## Author + +something@something.abc *_/ ' \" =end -- \\r\\n \\n \\r + + diff --git a/samples/client/petstore-security-test/php/composer.json b/samples/client/petstore-security-test/php/composer.json new file mode 100644 index 00000000000..834ab01d201 --- /dev/null +++ b/samples/client/petstore-security-test/php/composer.json @@ -0,0 +1,38 @@ +{ + "name": "GIT_USER_ID/GIT_REPO_ID", + "description": "", + "keywords": [ + "openapitools", + "openapi-generator", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "http://openapi-generator.tech", + "license": "proprietary", + "authors": [ + { + "name": "OpenAPI-Generator contributors", + "homepage": "https://openapi-generator.tech" + } + ], + "require": { + "php": ">=5.5", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^6.2" + }, + "require-dev": { + "phpunit/phpunit": "^4.8", + "squizlabs/php_codesniffer": "~2.6", + "friendsofphp/php-cs-fixer": "~2.12" + }, + "autoload": { + "psr-4": { "OpenAPI\\Client\\" : "lib/" } + }, + "autoload-dev": { + "psr-4": { "OpenAPI\\Client\\" : "test/" } + } +} diff --git a/samples/client/petstore-security-test/php/docs/Api/FakeApi.md b/samples/client/petstore-security-test/php/docs/Api/FakeApi.md new file mode 100644 index 00000000000..afee7db1162 --- /dev/null +++ b/samples/client/petstore-security-test/php/docs/Api/FakeApi.md @@ -0,0 +1,57 @@ +# OpenAPI\Client\FakeApi + +All URIs are relative to *http://petstore.swagger.io *_/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**testCodeInjectEndRnNR**](FakeApi.md#testCodeInjectEndRnNR) | **PUT** /fake | To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + + +# **testCodeInjectEndRnNR** +> testCodeInjectEndRnNR($unknown_base_type) + +To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + +To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + +### Example +```php +testCodeInjectEndRnNR($unknown_base_type); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->testCodeInjectEndRnNR: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **unknown_base_type** | [**\OpenAPI\Client\Model\UNKNOWN_BASE_TYPE**](../Model/UNKNOWN_BASE_TYPE.md)| | [optional] + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json, *_/ \" =end -- + - **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-security-test/php/docs/Model/ModelReturn.md b/samples/client/petstore-security-test/php/docs/Model/ModelReturn.md new file mode 100644 index 00000000000..efd25fe6d22 --- /dev/null +++ b/samples/client/petstore-security-test/php/docs/Model/ModelReturn.md @@ -0,0 +1,10 @@ +# ModelReturn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**return** | **int** | property description *_/ ' \" =end -- \\r\\n \\n \\r | [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-security-test/php/git_push.sh b/samples/client/petstore-security-test/php/git_push.sh new file mode 100644 index 00000000000..20057f67ade --- /dev/null +++ b/samples/client/petstore-security-test/php/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +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://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore-security-test/php/lib/Api/FakeApi.php b/samples/client/petstore-security-test/php/lib/Api/FakeApi.php new file mode 100644 index 00000000000..9908f6d7075 --- /dev/null +++ b/samples/client/petstore-security-test/php/lib/Api/FakeApi.php @@ -0,0 +1,321 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation testCodeInjectEndRnNR + * + * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * + * @param \OpenAPI\Client\Model\UNKNOWN_BASE_TYPE $unknown_base_type unknown_base_type (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return void + */ + public function testCodeInjectEndRnNR($unknown_base_type = null) + { + $this->testCodeInjectEndRnNRWithHttpInfo($unknown_base_type); + } + + /** + * Operation testCodeInjectEndRnNRWithHttpInfo + * + * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * + * @param \OpenAPI\Client\Model\UNKNOWN_BASE_TYPE $unknown_base_type (optional) + * + * @throws \OpenAPI\Client\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function testCodeInjectEndRnNRWithHttpInfo($unknown_base_type = null) + { + $request = $this->testCodeInjectEndRnNRRequest($unknown_base_type); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? $e->getResponse()->getBody()->getContents() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation testCodeInjectEndRnNRAsync + * + * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * + * @param \OpenAPI\Client\Model\UNKNOWN_BASE_TYPE $unknown_base_type (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testCodeInjectEndRnNRAsync($unknown_base_type = null) + { + return $this->testCodeInjectEndRnNRAsyncWithHttpInfo($unknown_base_type) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation testCodeInjectEndRnNRAsyncWithHttpInfo + * + * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * + * @param \OpenAPI\Client\Model\UNKNOWN_BASE_TYPE $unknown_base_type (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function testCodeInjectEndRnNRAsyncWithHttpInfo($unknown_base_type = null) + { + $returnType = ''; + $request = $this->testCodeInjectEndRnNRRequest($unknown_base_type); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'testCodeInjectEndRnNR' + * + * @param \OpenAPI\Client\Model\UNKNOWN_BASE_TYPE $unknown_base_type (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function testCodeInjectEndRnNRRequest($unknown_base_type = null) + { + + $resourcePath = '/fake'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // body params + $_tempBody = null; + if (isset($unknown_base_type)) { + $_tempBody = $unknown_base_type; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + [] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + [], + ['application/json', '*_/ \" =end --'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + $httpBody = $_tempBody; + // \stdClass has no __toString(), so we should encode it manually + if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($httpBody); + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'PUT', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/samples/client/petstore-security-test/php/lib/ApiException.php b/samples/client/petstore-security-test/php/lib/ApiException.php new file mode 100644 index 00000000000..06960702b35 --- /dev/null +++ b/samples/client/petstore-security-test/php/lib/ApiException.php @@ -0,0 +1,121 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return mixed HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deseralized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deseralized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/samples/client/petstore-security-test/php/lib/Configuration.php b/samples/client/petstore-security-test/php/lib/Configuration.php new file mode 100644 index 00000000000..1e2b013ccf0 --- /dev/null +++ b/samples/client/petstore-security-test/php/lib/Configuration.php @@ -0,0 +1,429 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the detault configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (OpenAPI\Client) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' OpenAPI Spec Version: 1.0.0 *_/ ' \" =end -- \\r\\n \\n \\r' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } +} diff --git a/samples/client/petstore-security-test/php/lib/HeaderSelector.php b/samples/client/petstore-security-test/php/lib/HeaderSelector.php new file mode 100644 index 00000000000..fac0c0df7d8 --- /dev/null +++ b/samples/client/petstore-security-test/php/lib/HeaderSelector.php @@ -0,0 +1,110 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + $headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes); + return $headers; + } + + /** + * @param string[] $accept + * @return array + */ + public function selectHeadersForMultipart($accept) + { + $headers = $this->selectHeaders($accept, []); + + unset($headers['Content-Type']); + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided + * + * @param string[] $accept Array of header + * + * @return string Accept (e.g. application/json) + */ + private function selectAcceptHeader($accept) + { + if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + return null; + } elseif (preg_grep("/application\/json/i", $accept)) { + return 'application/json'; + } else { + return implode(',', $accept); + } + } + + /** + * Return the content type based on an array of content-type provided + * + * @param string[] $contentType Array fo content-type + * + * @return string Content-Type (e.g. application/json) + */ + private function selectContentTypeHeader($contentType) + { + if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { + return 'application/json'; + } elseif (preg_grep("/application\/json/i", $contentType)) { + return 'application/json'; + } else { + return implode(',', $contentType); + } + } +} + diff --git a/samples/client/petstore-security-test/php/lib/Model/ModelInterface.php b/samples/client/petstore-security-test/php/lib/Model/ModelInterface.php new file mode 100644 index 00000000000..b1bff06abb2 --- /dev/null +++ b/samples/client/petstore-security-test/php/lib/Model/ModelInterface.php @@ -0,0 +1,96 @@ + 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'return' => 'int32' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'return' => 'return' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'return' => 'setReturn' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'return' => 'getReturn' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['return'] = isset($data['return']) ? $data['return'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets return + * + * @return int|null + */ + public function getReturn() + { + return $this->container['return']; + } + + /** + * Sets return + * + * @param int|null $return property description *_/ ' \" =end -- \\r\\n \\n \\r + * + * @return $this + */ + public function setReturn($return) + { + $this->container['return'] = $return; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } +} + + diff --git a/samples/client/petstore-security-test/php/lib/ObjectSerializer.php b/samples/client/petstore-security-test/php/lib/ObjectSerializer.php new file mode 100644 index 00000000000..4cc6b43e564 --- /dev/null +++ b/samples/client/petstore-security-test/php/lib/ObjectSerializer.php @@ -0,0 +1,317 @@ +format('Y-m-d') : $data->format(\DateTime::ATOM); + } elseif (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } elseif (is_object($data)) { + $values = []; + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null + && !in_array($openAPIType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) + && method_exists($openAPIType, 'getAllowableEnumValues') + && !in_array($value, $openAPIType::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $openAPIType::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + if ($value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the query, by imploding comma-separated if it's an object. + * If it's a string, pass through unchanged. It will be url-encoded + * later. + * + * @param string[]|string|\DateTime $object an object to be serialized to a string + * + * @return string the serialized object + */ + public static function toQueryValue($object) + { + if (is_array($object)) { + return implode(',', $object); + } else { + return self::toString($object); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(\DateTime::ATOM); + } else { + return $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $collectionFormat the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $collectionFormat, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $collectionFormat)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($collectionFormat) { + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'ssv': + return implode(' ', $collection); + + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } elseif (strcasecmp(substr($class, -2), '[]') === 0) { + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } elseif ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === '\DateTime') { + // Some API's return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + return new \DateTime($data); + } else { + return null; + } + } elseif (in_array($class, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } elseif ($class === '\SplFileObject') { + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if (array_key_exists('Content-Disposition', $httpHeaders) && + preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } elseif (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\OpenAPI\Client\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + continue; + } + + $propertyValue = $data->{$instance::attributeMap()[$property]}; + if (isset($propertyValue)) { + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } +} diff --git a/samples/client/petstore-security-test/php/phpunit.xml.dist b/samples/client/petstore-security-test/php/phpunit.xml.dist new file mode 100644 index 00000000000..c12ee148477 --- /dev/null +++ b/samples/client/petstore-security-test/php/phpunit.xml.dist @@ -0,0 +1,21 @@ + + + + + ./test/Api + ./test/Model + + + + + + ./lib/Api + ./lib/Model + + + diff --git a/samples/client/petstore-security-test/php/test/Api/FakeApiTest.php b/samples/client/petstore-security-test/php/test/Api/FakeApiTest.php new file mode 100644 index 00000000000..07057cd8a7f --- /dev/null +++ b/samples/client/petstore-security-test/php/test/Api/FakeApiTest.php @@ -0,0 +1,83 @@ + /// Pet id to delete - /// (optional) + /// (optional, default to utility::conversions::to_string_t("")) pplx::task deletePet( int64_t petId, boost::optional apiKey diff --git a/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp b/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp index c690f2be511..6af51a562b4 100644 --- a/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp +++ b/samples/client/petstore/cpp-restsdk/api/StoreApi.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/StoreApi.h b/samples/client/petstore/cpp-restsdk/api/StoreApi.h index f952506a16d..507756dee1d 100644 --- a/samples/client/petstore/cpp-restsdk/api/StoreApi.h +++ b/samples/client/petstore/cpp-restsdk/api/StoreApi.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/UserApi.cpp b/samples/client/petstore/cpp-restsdk/api/UserApi.cpp index af3fb210b68..808f988a2eb 100644 --- a/samples/client/petstore/cpp-restsdk/api/UserApi.cpp +++ b/samples/client/petstore/cpp-restsdk/api/UserApi.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/api/UserApi.h b/samples/client/petstore/cpp-restsdk/api/UserApi.h index d74deecb3d0..ea184c0cf76 100644 --- a/samples/client/petstore/cpp-restsdk/api/UserApi.h +++ b/samples/client/petstore/cpp-restsdk/api/UserApi.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp b/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp index b93cbb85328..72e188a8984 100644 --- a/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp +++ b/samples/client/petstore/cpp-restsdk/model/ApiResponse.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -61,15 +61,27 @@ void ApiResponse::fromJson(web::json::value& val) { if(val.has_field(utility::conversions::to_string_t("code"))) { - setCode(ModelBase::int32_tFromJson(val[utility::conversions::to_string_t("code")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("code")]; + if(!fieldValue.is_null()) + { + setCode(ModelBase::int32_tFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("type"))) { - setType(ModelBase::stringFromJson(val[utility::conversions::to_string_t("type")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("type")]; + if(!fieldValue.is_null()) + { + setType(ModelBase::stringFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("message"))) { - setMessage(ModelBase::stringFromJson(val[utility::conversions::to_string_t("message")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("message")]; + if(!fieldValue.is_null()) + { + setMessage(ModelBase::stringFromJson(fieldValue)); + } } } diff --git a/samples/client/petstore/cpp-restsdk/model/ApiResponse.h b/samples/client/petstore/cpp-restsdk/model/ApiResponse.h index fc1bf4e6109..422091ab1f7 100644 --- a/samples/client/petstore/cpp-restsdk/model/ApiResponse.h +++ b/samples/client/petstore/cpp-restsdk/model/ApiResponse.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Category.cpp b/samples/client/petstore/cpp-restsdk/model/Category.cpp index 53494010800..e8b48e94269 100644 --- a/samples/client/petstore/cpp-restsdk/model/Category.cpp +++ b/samples/client/petstore/cpp-restsdk/model/Category.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -55,11 +55,19 @@ void Category::fromJson(web::json::value& val) { if(val.has_field(utility::conversions::to_string_t("id"))) { - setId(ModelBase::int64_tFromJson(val[utility::conversions::to_string_t("id")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("id")]; + if(!fieldValue.is_null()) + { + setId(ModelBase::int64_tFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("name"))) { - setName(ModelBase::stringFromJson(val[utility::conversions::to_string_t("name")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("name")]; + if(!fieldValue.is_null()) + { + setName(ModelBase::stringFromJson(fieldValue)); + } } } diff --git a/samples/client/petstore/cpp-restsdk/model/Category.h b/samples/client/petstore/cpp-restsdk/model/Category.h index ab370a4bb03..e4f9b7bbf59 100644 --- a/samples/client/petstore/cpp-restsdk/model/Category.h +++ b/samples/client/petstore/cpp-restsdk/model/Category.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Order.cpp b/samples/client/petstore/cpp-restsdk/model/Order.cpp index 7f5b5464d5f..aa39a3ada03 100644 --- a/samples/client/petstore/cpp-restsdk/model/Order.cpp +++ b/samples/client/petstore/cpp-restsdk/model/Order.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -79,27 +79,51 @@ void Order::fromJson(web::json::value& val) { if(val.has_field(utility::conversions::to_string_t("id"))) { - setId(ModelBase::int64_tFromJson(val[utility::conversions::to_string_t("id")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("id")]; + if(!fieldValue.is_null()) + { + setId(ModelBase::int64_tFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("petId"))) { - setPetId(ModelBase::int64_tFromJson(val[utility::conversions::to_string_t("petId")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("petId")]; + if(!fieldValue.is_null()) + { + setPetId(ModelBase::int64_tFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("quantity"))) { - setQuantity(ModelBase::int32_tFromJson(val[utility::conversions::to_string_t("quantity")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("quantity")]; + if(!fieldValue.is_null()) + { + setQuantity(ModelBase::int32_tFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("shipDate"))) { - setShipDate(ModelBase::dateFromJson(val[utility::conversions::to_string_t("shipDate")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("shipDate")]; + if(!fieldValue.is_null()) + { + setShipDate(ModelBase::dateFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("status"))) { - setStatus(ModelBase::stringFromJson(val[utility::conversions::to_string_t("status")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("status")]; + if(!fieldValue.is_null()) + { + setStatus(ModelBase::stringFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("complete"))) { - setComplete(ModelBase::boolFromJson(val[utility::conversions::to_string_t("complete")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("complete")]; + if(!fieldValue.is_null()) + { + setComplete(ModelBase::boolFromJson(fieldValue)); + } } } diff --git a/samples/client/petstore/cpp-restsdk/model/Order.h b/samples/client/petstore/cpp-restsdk/model/Order.h index b2d4410d643..716cd3edb6f 100644 --- a/samples/client/petstore/cpp-restsdk/model/Order.h +++ b/samples/client/petstore/cpp-restsdk/model/Order.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Pet.cpp b/samples/client/petstore/cpp-restsdk/model/Pet.cpp index 78fed60be7d..8d37d3fd330 100644 --- a/samples/client/petstore/cpp-restsdk/model/Pet.cpp +++ b/samples/client/petstore/cpp-restsdk/model/Pet.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -82,14 +82,19 @@ void Pet::fromJson(web::json::value& val) { if(val.has_field(utility::conversions::to_string_t("id"))) { - setId(ModelBase::int64_tFromJson(val[utility::conversions::to_string_t("id")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("id")]; + if(!fieldValue.is_null()) + { + setId(ModelBase::int64_tFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("category"))) { - if(!val[utility::conversions::to_string_t("category")].is_null()) + web::json::value& fieldValue = val[utility::conversions::to_string_t("category")]; + if(!fieldValue.is_null()) { std::shared_ptr newItem(new Category()); - newItem->fromJson(val[utility::conversions::to_string_t("category")]); + newItem->fromJson(fieldValue); setCategory( newItem ); } } @@ -124,7 +129,11 @@ void Pet::fromJson(web::json::value& val) } if(val.has_field(utility::conversions::to_string_t("status"))) { - setStatus(ModelBase::stringFromJson(val[utility::conversions::to_string_t("status")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("status")]; + if(!fieldValue.is_null()) + { + setStatus(ModelBase::stringFromJson(fieldValue)); + } } } diff --git a/samples/client/petstore/cpp-restsdk/model/Pet.h b/samples/client/petstore/cpp-restsdk/model/Pet.h index c4e0d0b4978..d5f9293a3ff 100644 --- a/samples/client/petstore/cpp-restsdk/model/Pet.h +++ b/samples/client/petstore/cpp-restsdk/model/Pet.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/Tag.cpp b/samples/client/petstore/cpp-restsdk/model/Tag.cpp index 8c0c537cf26..a2edf655290 100644 --- a/samples/client/petstore/cpp-restsdk/model/Tag.cpp +++ b/samples/client/petstore/cpp-restsdk/model/Tag.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -55,11 +55,19 @@ void Tag::fromJson(web::json::value& val) { if(val.has_field(utility::conversions::to_string_t("id"))) { - setId(ModelBase::int64_tFromJson(val[utility::conversions::to_string_t("id")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("id")]; + if(!fieldValue.is_null()) + { + setId(ModelBase::int64_tFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("name"))) { - setName(ModelBase::stringFromJson(val[utility::conversions::to_string_t("name")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("name")]; + if(!fieldValue.is_null()) + { + setName(ModelBase::stringFromJson(fieldValue)); + } } } diff --git a/samples/client/petstore/cpp-restsdk/model/Tag.h b/samples/client/petstore/cpp-restsdk/model/Tag.h index b2b49f58c43..4213e328479 100644 --- a/samples/client/petstore/cpp-restsdk/model/Tag.h +++ b/samples/client/petstore/cpp-restsdk/model/Tag.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/cpp-restsdk/model/User.cpp b/samples/client/petstore/cpp-restsdk/model/User.cpp index 511811b9f08..cf72b9e02e9 100644 --- a/samples/client/petstore/cpp-restsdk/model/User.cpp +++ b/samples/client/petstore/cpp-restsdk/model/User.cpp @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -91,35 +91,67 @@ void User::fromJson(web::json::value& val) { if(val.has_field(utility::conversions::to_string_t("id"))) { - setId(ModelBase::int64_tFromJson(val[utility::conversions::to_string_t("id")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("id")]; + if(!fieldValue.is_null()) + { + setId(ModelBase::int64_tFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("username"))) { - setUsername(ModelBase::stringFromJson(val[utility::conversions::to_string_t("username")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("username")]; + if(!fieldValue.is_null()) + { + setUsername(ModelBase::stringFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("firstName"))) { - setFirstName(ModelBase::stringFromJson(val[utility::conversions::to_string_t("firstName")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("firstName")]; + if(!fieldValue.is_null()) + { + setFirstName(ModelBase::stringFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("lastName"))) { - setLastName(ModelBase::stringFromJson(val[utility::conversions::to_string_t("lastName")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("lastName")]; + if(!fieldValue.is_null()) + { + setLastName(ModelBase::stringFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("email"))) { - setEmail(ModelBase::stringFromJson(val[utility::conversions::to_string_t("email")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("email")]; + if(!fieldValue.is_null()) + { + setEmail(ModelBase::stringFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("password"))) { - setPassword(ModelBase::stringFromJson(val[utility::conversions::to_string_t("password")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("password")]; + if(!fieldValue.is_null()) + { + setPassword(ModelBase::stringFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("phone"))) { - setPhone(ModelBase::stringFromJson(val[utility::conversions::to_string_t("phone")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("phone")]; + if(!fieldValue.is_null()) + { + setPhone(ModelBase::stringFromJson(fieldValue)); + } } if(val.has_field(utility::conversions::to_string_t("userStatus"))) { - setUserStatus(ModelBase::int32_tFromJson(val[utility::conversions::to_string_t("userStatus")])); + web::json::value& fieldValue = val[utility::conversions::to_string_t("userStatus")]; + if(!fieldValue.is_null()) + { + setUserStatus(ModelBase::int32_tFromJson(fieldValue)); + } } } diff --git a/samples/client/petstore/cpp-restsdk/model/User.h b/samples/client/petstore/cpp-restsdk/model/User.h index aca144de933..ed18d117ced 100644 --- a/samples/client/petstore/cpp-restsdk/model/User.h +++ b/samples/client/petstore/cpp-restsdk/model/User.h @@ -4,7 +4,7 @@ * * OpenAPI spec version: 1.0.0 * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.2-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator-ignore b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.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/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator/VERSION b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator/VERSION new file mode 100644 index 00000000000..6d94c9c2e12 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/README.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/README.md new file mode 100644 index 00000000000..6b861dfd723 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/README.md @@ -0,0 +1,131 @@ +# Org.OpenAPITools - the C# library for the 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. + +This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- SDK version: 1.0.0 +- Build package: org.openapitools.codegen.languages.CSharpDotNet2ClientCodegen + + +## Frameworks supported +- .NET 2.0 + + +## Dependencies +- Mono compiler +- Newtonsoft.Json.7.0.1 +- RestSharp.Net2.1.1.11 + +Note: NuGet is downloaded by the mono compilation script and packages are installed with it. No dependency DLLs are bundled with this generator + + +## Installation +Run the following command to generate the DLL +- [Mac/Linux] `/bin/sh compile-mono.sh` +- [Windows] TODO + +Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces: +```csharp +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; +``` + +## Getting Started + +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class Example + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + apiInstance.AddPet(pet); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + } + } + } +} +``` + + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*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 +*StoreApi* | [**DeleteOrder**](docs/StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | 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/{orderId} | 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 + + - [Org.OpenAPITools.Model.ApiResponse](docs/ApiResponse.md) + - [Org.OpenAPITools.Model.Category](docs/Category.md) + - [Org.OpenAPITools.Model.Order](docs/Order.md) + - [Org.OpenAPITools.Model.Pet](docs/Pet.md) + - [Org.OpenAPITools.Model.Tag](docs/Tag.md) + - [Org.OpenAPITools.Model.User](docs/User.md) + + + +## Documentation for Authorization + + +### api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + + +### 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 + diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh new file mode 100644 index 00000000000..8e6e23eba08 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/compile-mono.sh @@ -0,0 +1,12 @@ +wget -nc https://dist.nuget.org/win-x86-commandline/latest/nuget.exe; +mozroots --import --sync +mono nuget.exe install vendor/packages.config -o vendor; +mkdir -p bin; +mcs -sdk:2 -r:vendor/Newtonsoft.Json.7.0.1/lib/net20/Newtonsoft.Json.dll,\ +vendor/RestSharp.Net2.1.1.11/lib/net20/RestSharp.Net2.dll,\ +System.Runtime.Serialization.dll \ +-target:library \ +-out:bin/Org.OpenAPITools.dll \ +-recurse:'src/*.cs' \ +-doc:bin/Org.OpenAPITools.xml \ +-platform:anycpu diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md new file mode 100644 index 00000000000..01b35815bd4 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/ApiResponse.md @@ -0,0 +1,11 @@ +# Org.OpenAPITools.Model.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/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md new file mode 100644 index 00000000000..860a468e35c --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Category.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Category +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [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/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md new file mode 100644 index 00000000000..984bd5ca063 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Order.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Order +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [optional] +**PetId** | **long?** | | [optional] +**Quantity** | **int?** | | [optional] +**ShipDate** | **DateTime?** | | [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/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md new file mode 100644 index 00000000000..ce9fe873cd2 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Pet.md @@ -0,0 +1,14 @@ +# Org.OpenAPITools.Model.Pet +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [optional] +**Category** | [**Category**](Category.md) | | [optional] +**Name** | **string** | | +**PhotoUrls** | **List** | | +**Tags** | [**List**](Tag.md) | | [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/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md new file mode 100644 index 00000000000..0051c617a1d --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/PetApi.md @@ -0,0 +1,534 @@ +# Org.OpenAPITools.Api.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 (Pet pet) + +Add a new pet to the store + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class AddPetExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Add a new pet to the store + apiInstance.AddPet(pet); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.AddPet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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** +> void DeletePet (long? petId, string apiKey) + +Deletes a pet + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeletePetExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | Pet id to delete + var apiKey = apiKey_example; // string | (optional) + + try + { + // Deletes a pet + apiInstance.DeletePet(petId, apiKey); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.DeletePet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| 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** +> List FindPetsByStatus (List status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByStatusExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var status = status_example; // List | Status values that need to be considered for filter + + try + { + // Finds Pets by status + List<Pet> result = apiInstance.FindPetsByStatus(status); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.FindPetsByStatus: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | **List**| Status values that need to be considered for filter | + +### Return type + +[**List**](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** +> List FindPetsByTags (List tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class FindPetsByTagsExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var tags = new List(); // List | Tags to filter by + + try + { + // Finds Pets by tags + List<Pet> result = apiInstance.FindPetsByTags(tags); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.FindPetsByTags: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List**](string.md)| Tags to filter by | + +### Return type + +[**List**](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** +> Pet GetPetById (long? petId) + +Find pet by ID + +Returns a single pet + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetPetByIdExample + { + public void main() + { + + // Configure API key authorization: api_key + Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer"); + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to return + + try + { + // Find pet by ID + Pet result = apiInstance.GetPetById(petId); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.GetPetById: " + e.Message ); + } + } + } +} +``` + +### 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 + +[[Back to top]](#) [[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** +> void UpdatePet (Pet pet) + +Update an existing pet + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var pet = new Pet(); // Pet | Pet object that needs to be added to the store + + try + { + // Update an existing pet + apiInstance.UpdatePet(pet); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UpdatePet: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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** +> void UpdatePetWithForm (long? petId, string name, string status) + +Updates a pet in the store with form data + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdatePetWithFormExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet that needs to be updated + var name = name_example; // string | Updated name of the pet (optional) + var status = status_example; // string | Updated status of the pet (optional) + + try + { + // Updates a pet in the store with form data + apiInstance.UpdatePetWithForm(petId, name, status); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UpdatePetWithForm: " + e.Message ); + } + } + } +} +``` + +### 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 (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** +> ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file) + +uploads an image + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileExample + { + public void main() + { + + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to update + var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) + var file = new System.IO.Stream(); // System.IO.Stream | file to upload (optional) + + try + { + // uploads an image + ApiResponse result = apiInstance.UploadFile(petId, additionalMetadata, file); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UploadFile: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to update | + **additionalMetadata** | **string**| Additional data to pass to server | [optional] + **file** | **System.IO.Stream**| 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) + diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md new file mode 100644 index 00000000000..76334b0ca4d --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/StoreApi.md @@ -0,0 +1,258 @@ +# Org.OpenAPITools.Api.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 (string 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 +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteOrderExample + { + public void main() + { + + var apiInstance = new StoreApi(); + var orderId = orderId_example; // string | ID of the order that needs to be deleted + + try + { + // Delete purchase order by ID + apiInstance.DeleteOrder(orderId); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.DeleteOrder: " + e.Message ); + } + } + } +} +``` + +### 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** +> Dictionary GetInventory () + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetInventoryExample + { + public void main() + { + + // Configure API key authorization: api_key + Configuration.Default.ApiKey.Add("api_key", "YOUR_API_KEY"); + // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed + // Configuration.Default.ApiKeyPrefix.Add("api_key", "Bearer"); + + var apiInstance = new StoreApi(); + + try + { + // Returns pet inventories by status + Dictionary<string, int?> result = apiInstance.GetInventory(); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.GetInventory: " + e.Message ); + } + } + } +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Dictionary** + +### 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** +> Order GetOrderById (long? orderId) + +Find purchase order by ID + +For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetOrderByIdExample + { + public void main() + { + + var apiInstance = new StoreApi(); + var orderId = 789; // long? | ID of pet that needs to be fetched + + try + { + // Find purchase order by ID + Order result = apiInstance.GetOrderById(orderId); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.GetOrderById: " + e.Message ); + } + } + } +} +``` + +### 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 + +[[Back to top]](#) [[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** +> Order PlaceOrder (Order order) + +Place an order for a pet + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class PlaceOrderExample + { + public void main() + { + + var apiInstance = new StoreApi(); + var order = new Order(); // Order | order placed for purchasing the pet + + try + { + // Place an order for a pet + Order result = apiInstance.PlaceOrder(order); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling StoreApi.PlaceOrder: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**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/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md new file mode 100644 index 00000000000..6a76c28595f --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/Tag.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.Tag +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**Id** | **long?** | | [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/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/User.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/User.md new file mode 100644 index 00000000000..04dd24a3423 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/User.md @@ -0,0 +1,16 @@ +# Org.OpenAPITools.Model.User +## 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** | **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/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md new file mode 100644 index 00000000000..dad1e505005 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/docs/UserApi.md @@ -0,0 +1,496 @@ +# Org.OpenAPITools.Api.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 (User user) + +Create user + +This can only be done by the logged in user. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + var user = new User(); // User | Created user object + + try + { + // Create user + apiInstance.CreateUser(user); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**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** +> void CreateUsersWithArrayInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithArrayInputExample + { + public void main() + { + + var apiInstance = new UserApi(); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithArrayInput(user); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithArrayInput: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List**](List.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** +> void CreateUsersWithListInput (List user) + +Creates list of users with given input array + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class CreateUsersWithListInputExample + { + public void main() + { + + var apiInstance = new UserApi(); + var user = new List(); // List | List of user object + + try + { + // Creates list of users with given input array + apiInstance.CreateUsersWithListInput(user); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.CreateUsersWithListInput: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List**](List.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** +> void DeleteUser (string username) + +Delete user + +This can only be done by the logged in user. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class DeleteUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + var username = username_example; // string | The name that needs to be deleted + + try + { + // Delete user + apiInstance.DeleteUser(username); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.DeleteUser: " + e.Message ); + } + } + } +} +``` + +### 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** +> User GetUserByName (string username) + +Get user by user name + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class GetUserByNameExample + { + public void main() + { + + var apiInstance = new UserApi(); + var username = username_example; // string | The name that needs to be fetched. Use user1 for testing. + + try + { + // Get user by user name + User result = apiInstance.GetUserByName(username); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.GetUserByName: " + e.Message ); + } + } + } +} +``` + +### 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** +> string LoginUser (string username, string password) + +Logs user into the system + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LoginUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + var username = username_example; // string | The user name for login + var password = password_example; // string | The password for login in clear text + + try + { + // Logs user into the system + string result = apiInstance.LoginUser(username, password); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.LoginUser: " + e.Message ); + } + } + } +} +``` + +### 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** +> void LogoutUser () + +Logs out current logged in user session + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class LogoutUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + + try + { + // Logs out current logged in user session + apiInstance.LogoutUser(); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.LogoutUser: " + e.Message ); + } + } + } +} +``` + +### 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** +> void UpdateUser (string username, User user) + +Updated user + +This can only be done by the logged in user. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UpdateUserExample + { + public void main() + { + + var apiInstance = new UserApi(); + var username = username_example; // string | name that need to be deleted + var user = new User(); // User | Updated user object + + try + { + // Updated user + apiInstance.UpdateUser(username, user); + } + catch (Exception e) + { + Debug.Print("Exception when calling UserApi.UpdateUser: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **string**| name that need to be deleted | + **user** | [**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/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/PetApi.cs new file mode 100644 index 00000000000..66e0f6ab5cc --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/PetApi.cs @@ -0,0 +1,429 @@ +using System; +using System.Collections.Generic; +using RestSharp; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IPetApi + { + /// + /// Add a new pet to the store + /// + /// Pet object that needs to be added to the store + /// + void AddPet (Pet pet); + /// + /// Deletes a pet + /// + /// Pet id to delete + /// + /// + void DeletePet (long? petId, string apiKey); + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter + /// List<Pet> + List FindPetsByStatus (List status); + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// List<Pet> + List FindPetsByTags (List tags); + /// + /// Find pet by ID Returns a single pet + /// + /// ID of pet to return + /// Pet + Pet GetPetById (long? petId); + /// + /// Update an existing pet + /// + /// Pet object that needs to be added to the store + /// + void UpdatePet (Pet pet); + /// + /// Updates a pet in the store with form data + /// + /// ID of pet that needs to be updated + /// Updated name of the pet + /// Updated status of the pet + /// + void UpdatePetWithForm (long? petId, string name, string status); + /// + /// uploads an image + /// + /// ID of pet to update + /// Additional data to pass to server + /// file to upload + /// ApiResponse + ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file); + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class PetApi : IPetApi + { + /// + /// Initializes a new instance of the class. + /// + /// an instance of ApiClient (optional) + /// + public PetApi(ApiClient apiClient = null) + { + if (apiClient == null) // use the default one in Configuration + this.ApiClient = Configuration.DefaultApiClient; + else + this.ApiClient = apiClient; + } + + /// + /// Initializes a new instance of the class. + /// + /// + public PetApi(String basePath) + { + this.ApiClient = new ApiClient(basePath); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + /// The base path + public void SetBasePath(String basePath) + { + this.ApiClient.BasePath = basePath; + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + /// The base path + public String GetBasePath(String basePath) + { + return this.ApiClient.BasePath; + } + + /// + /// Gets or sets the API client. + /// + /// An instance of the ApiClient + public ApiClient ApiClient {get; set;} + + /// + /// Add a new pet to the store + /// + /// Pet object that needs to be added to the store + /// + public void AddPet (Pet pet) + { + + // verify the required parameter 'pet' is set + if (pet == null) throw new ApiException(400, "Missing required parameter 'pet' when calling AddPet"); + + + var path = "/pet"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + postBody = ApiClient.Serialize(pet); // http body (model) parameter + + // authentication setting, if any + String[] authSettings = new String[] { "petstore_auth" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling AddPet: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + /// + /// Deletes a pet + /// + /// Pet id to delete + /// + /// + public void DeletePet (long? petId, string apiKey) + { + + // verify the required parameter 'petId' is set + if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling DeletePet"); + + + var path = "/pet/{petId}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + if (apiKey != null) headerParams.Add("api_key", ApiClient.ParameterToString(apiKey)); // header parameter + + // authentication setting, if any + String[] authSettings = new String[] { "petstore_auth" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling DeletePet: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + /// + /// Finds Pets by status Multiple status values can be provided with comma separated strings + /// + /// Status values that need to be considered for filter + /// List<Pet> + public List FindPetsByStatus (List status) + { + + // verify the required parameter 'status' is set + if (status == null) throw new ApiException(400, "Missing required parameter 'status' when calling FindPetsByStatus"); + + + var path = "/pet/findByStatus"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + if (status != null) queryParams.Add("status", ApiClient.ParameterToString(status)); // query parameter + + // authentication setting, if any + String[] authSettings = new String[] { "petstore_auth" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByStatus: " + response.ErrorMessage, response.ErrorMessage); + + return (List) ApiClient.Deserialize(response.Content, typeof(List), response.Headers); + } + + /// + /// Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + /// + /// Tags to filter by + /// List<Pet> + public List FindPetsByTags (List tags) + { + + // verify the required parameter 'tags' is set + if (tags == null) throw new ApiException(400, "Missing required parameter 'tags' when calling FindPetsByTags"); + + + var path = "/pet/findByTags"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + if (tags != null) queryParams.Add("tags", ApiClient.ParameterToString(tags)); // query parameter + + // authentication setting, if any + String[] authSettings = new String[] { "petstore_auth" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling FindPetsByTags: " + response.ErrorMessage, response.ErrorMessage); + + return (List) ApiClient.Deserialize(response.Content, typeof(List), response.Headers); + } + + /// + /// Find pet by ID Returns a single pet + /// + /// ID of pet to return + /// Pet + public Pet GetPetById (long? petId) + { + + // verify the required parameter 'petId' is set + if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling GetPetById"); + + + var path = "/pet/{petId}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + + // authentication setting, if any + String[] authSettings = new String[] { "api_key" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling GetPetById: " + response.ErrorMessage, response.ErrorMessage); + + return (Pet) ApiClient.Deserialize(response.Content, typeof(Pet), response.Headers); + } + + /// + /// Update an existing pet + /// + /// Pet object that needs to be added to the store + /// + public void UpdatePet (Pet pet) + { + + // verify the required parameter 'pet' is set + if (pet == null) throw new ApiException(400, "Missing required parameter 'pet' when calling UpdatePet"); + + + var path = "/pet"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + postBody = ApiClient.Serialize(pet); // http body (model) parameter + + // authentication setting, if any + String[] authSettings = new String[] { "petstore_auth" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling UpdatePet: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + /// + /// Updates a pet in the store with form data + /// + /// ID of pet that needs to be updated + /// Updated name of the pet + /// Updated status of the pet + /// + public void UpdatePetWithForm (long? petId, string name, string status) + { + + // verify the required parameter 'petId' is set + if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UpdatePetWithForm"); + + + var path = "/pet/{petId}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + if (name != null) formParams.Add("name", ApiClient.ParameterToString(name)); // form parameter +if (status != null) formParams.Add("status", ApiClient.ParameterToString(status)); // form parameter + + // authentication setting, if any + String[] authSettings = new String[] { "petstore_auth" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling UpdatePetWithForm: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + /// + /// uploads an image + /// + /// ID of pet to update + /// Additional data to pass to server + /// file to upload + /// ApiResponse + public ApiResponse UploadFile (long? petId, string additionalMetadata, System.IO.Stream file) + { + + // verify the required parameter 'petId' is set + if (petId == null) throw new ApiException(400, "Missing required parameter 'petId' when calling UploadFile"); + + + var path = "/pet/{petId}/uploadImage"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "petId" + "}", ApiClient.ParameterToString(petId)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + if (additionalMetadata != null) formParams.Add("additionalMetadata", ApiClient.ParameterToString(additionalMetadata)); // form parameter +if (file != null) fileParams.Add("file", ApiClient.ParameterToFile("file", file)); + + // authentication setting, if any + String[] authSettings = new String[] { "petstore_auth" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling UploadFile: " + response.ErrorMessage, response.ErrorMessage); + + return (ApiResponse) ApiClient.Deserialize(response.Content, typeof(ApiResponse), response.Headers); + } + + } +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/StoreApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/StoreApi.cs new file mode 100644 index 00000000000..3390bbbcaba --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/StoreApi.cs @@ -0,0 +1,236 @@ +using System; +using System.Collections.Generic; +using RestSharp; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IStoreApi + { + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// ID of the order that needs to be deleted + /// + void DeleteOrder (string orderId); + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Dictionary<string, int?> + Dictionary GetInventory (); + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// ID of pet that needs to be fetched + /// Order + Order GetOrderById (long? orderId); + /// + /// Place an order for a pet + /// + /// order placed for purchasing the pet + /// Order + Order PlaceOrder (Order order); + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class StoreApi : IStoreApi + { + /// + /// Initializes a new instance of the class. + /// + /// an instance of ApiClient (optional) + /// + public StoreApi(ApiClient apiClient = null) + { + if (apiClient == null) // use the default one in Configuration + this.ApiClient = Configuration.DefaultApiClient; + else + this.ApiClient = apiClient; + } + + /// + /// Initializes a new instance of the class. + /// + /// + public StoreApi(String basePath) + { + this.ApiClient = new ApiClient(basePath); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + /// The base path + public void SetBasePath(String basePath) + { + this.ApiClient.BasePath = basePath; + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + /// The base path + public String GetBasePath(String basePath) + { + return this.ApiClient.BasePath; + } + + /// + /// Gets or sets the API client. + /// + /// An instance of the ApiClient + public ApiClient ApiClient {get; set;} + + /// + /// Delete purchase order by ID For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + /// + /// ID of the order that needs to be deleted + /// + public void DeleteOrder (string orderId) + { + + // verify the required parameter 'orderId' is set + if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling DeleteOrder"); + + + var path = "/store/order/{orderId}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling DeleteOrder: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + /// + /// Returns pet inventories by status Returns a map of status codes to quantities + /// + /// Dictionary<string, int?> + public Dictionary GetInventory () + { + + + var path = "/store/inventory"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + + // authentication setting, if any + String[] authSettings = new String[] { "api_key" }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling GetInventory: " + response.ErrorMessage, response.ErrorMessage); + + return (Dictionary) ApiClient.Deserialize(response.Content, typeof(Dictionary), response.Headers); + } + + /// + /// Find purchase order by ID For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + /// + /// ID of pet that needs to be fetched + /// Order + public Order GetOrderById (long? orderId) + { + + // verify the required parameter 'orderId' is set + if (orderId == null) throw new ApiException(400, "Missing required parameter 'orderId' when calling GetOrderById"); + + + var path = "/store/order/{orderId}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "orderId" + "}", ApiClient.ParameterToString(orderId)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling GetOrderById: " + response.ErrorMessage, response.ErrorMessage); + + return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers); + } + + /// + /// Place an order for a pet + /// + /// order placed for purchasing the pet + /// Order + public Order PlaceOrder (Order order) + { + + // verify the required parameter 'order' is set + if (order == null) throw new ApiException(400, "Missing required parameter 'order' when calling PlaceOrder"); + + + var path = "/store/order"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + postBody = ApiClient.Serialize(order); // http body (model) parameter + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling PlaceOrder: " + response.ErrorMessage, response.ErrorMessage); + + return (Order) ApiClient.Deserialize(response.Content, typeof(Order), response.Headers); + } + + } +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/UserApi.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/UserApi.cs new file mode 100644 index 00000000000..60a0ccac599 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Api/UserApi.cs @@ -0,0 +1,420 @@ +using System; +using System.Collections.Generic; +using RestSharp; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Org.OpenAPITools.Api +{ + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public interface IUserApi + { + /// + /// Create user This can only be done by the logged in user. + /// + /// Created user object + /// + void CreateUser (User user); + /// + /// Creates list of users with given input array + /// + /// List of user object + /// + void CreateUsersWithArrayInput (List user); + /// + /// Creates list of users with given input array + /// + /// List of user object + /// + void CreateUsersWithListInput (List user); + /// + /// Delete user This can only be done by the logged in user. + /// + /// The name that needs to be deleted + /// + void DeleteUser (string username); + /// + /// Get user by user name + /// + /// The name that needs to be fetched. Use user1 for testing. + /// User + User GetUserByName (string username); + /// + /// Logs user into the system + /// + /// The user name for login + /// The password for login in clear text + /// string + string LoginUser (string username, string password); + /// + /// Logs out current logged in user session + /// + /// + void LogoutUser (); + /// + /// Updated user This can only be done by the logged in user. + /// + /// name that need to be deleted + /// Updated user object + /// + void UpdateUser (string username, User user); + } + + /// + /// Represents a collection of functions to interact with the API endpoints + /// + public class UserApi : IUserApi + { + /// + /// Initializes a new instance of the class. + /// + /// an instance of ApiClient (optional) + /// + public UserApi(ApiClient apiClient = null) + { + if (apiClient == null) // use the default one in Configuration + this.ApiClient = Configuration.DefaultApiClient; + else + this.ApiClient = apiClient; + } + + /// + /// Initializes a new instance of the class. + /// + /// + public UserApi(String basePath) + { + this.ApiClient = new ApiClient(basePath); + } + + /// + /// Sets the base path of the API client. + /// + /// The base path + /// The base path + public void SetBasePath(String basePath) + { + this.ApiClient.BasePath = basePath; + } + + /// + /// Gets the base path of the API client. + /// + /// The base path + /// The base path + public String GetBasePath(String basePath) + { + return this.ApiClient.BasePath; + } + + /// + /// Gets or sets the API client. + /// + /// An instance of the ApiClient + public ApiClient ApiClient {get; set;} + + /// + /// Create user This can only be done by the logged in user. + /// + /// Created user object + /// + public void CreateUser (User user) + { + + // verify the required parameter 'user' is set + if (user == null) throw new ApiException(400, "Missing required parameter 'user' when calling CreateUser"); + + + var path = "/user"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + postBody = ApiClient.Serialize(user); // http body (model) parameter + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling CreateUser: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + /// + /// Creates list of users with given input array + /// + /// List of user object + /// + public void CreateUsersWithArrayInput (List user) + { + + // verify the required parameter 'user' is set + if (user == null) throw new ApiException(400, "Missing required parameter 'user' when calling CreateUsersWithArrayInput"); + + + var path = "/user/createWithArray"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + postBody = ApiClient.Serialize(user); // http body (model) parameter + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithArrayInput: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + /// + /// Creates list of users with given input array + /// + /// List of user object + /// + public void CreateUsersWithListInput (List user) + { + + // verify the required parameter 'user' is set + if (user == null) throw new ApiException(400, "Missing required parameter 'user' when calling CreateUsersWithListInput"); + + + var path = "/user/createWithList"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + postBody = ApiClient.Serialize(user); // http body (model) parameter + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling CreateUsersWithListInput: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + /// + /// Delete user This can only be done by the logged in user. + /// + /// The name that needs to be deleted + /// + public void DeleteUser (string username) + { + + // verify the required parameter 'username' is set + if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling DeleteUser"); + + + var path = "/user/{username}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.DELETE, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling DeleteUser: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + /// + /// Get user by user name + /// + /// The name that needs to be fetched. Use user1 for testing. + /// User + public User GetUserByName (string username) + { + + // verify the required parameter 'username' is set + if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling GetUserByName"); + + + var path = "/user/{username}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling GetUserByName: " + response.ErrorMessage, response.ErrorMessage); + + return (User) ApiClient.Deserialize(response.Content, typeof(User), response.Headers); + } + + /// + /// Logs user into the system + /// + /// The user name for login + /// The password for login in clear text + /// string + public string LoginUser (string username, string password) + { + + // verify the required parameter 'username' is set + if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling LoginUser"); + + // verify the required parameter 'password' is set + if (password == null) throw new ApiException(400, "Missing required parameter 'password' when calling LoginUser"); + + + var path = "/user/login"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + if (username != null) queryParams.Add("username", ApiClient.ParameterToString(username)); // query parameter + if (password != null) queryParams.Add("password", ApiClient.ParameterToString(password)); // query parameter + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling LoginUser: " + response.ErrorMessage, response.ErrorMessage); + + return (string) ApiClient.Deserialize(response.Content, typeof(string), response.Headers); + } + + /// + /// Logs out current logged in user session + /// + /// + public void LogoutUser () + { + + + var path = "/user/logout"; + path = path.Replace("{format}", "json"); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.GET, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling LogoutUser: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + /// + /// Updated user This can only be done by the logged in user. + /// + /// name that need to be deleted + /// Updated user object + /// + public void UpdateUser (string username, User user) + { + + // verify the required parameter 'username' is set + if (username == null) throw new ApiException(400, "Missing required parameter 'username' when calling UpdateUser"); + + // verify the required parameter 'user' is set + if (user == null) throw new ApiException(400, "Missing required parameter 'user' when calling UpdateUser"); + + + var path = "/user/{username}"; + path = path.Replace("{format}", "json"); + path = path.Replace("{" + "username" + "}", ApiClient.ParameterToString(username)); + + var queryParams = new Dictionary(); + var headerParams = new Dictionary(); + var formParams = new Dictionary(); + var fileParams = new Dictionary(); + String postBody = null; + + postBody = ApiClient.Serialize(user); // http body (model) parameter + + // authentication setting, if any + String[] authSettings = new String[] { }; + + // make the HTTP request + IRestResponse response = (IRestResponse) ApiClient.CallApi(path, Method.PUT, queryParams, postBody, headerParams, formParams, fileParams, authSettings); + + if (((int)response.StatusCode) >= 400) + throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.Content, response.Content); + else if (((int)response.StatusCode) == 0) + throw new ApiException ((int)response.StatusCode, "Error calling UpdateUser: " + response.ErrorMessage, response.ErrorMessage); + + return; + } + + } +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiClient.cs new file mode 100644 index 00000000000..095f97997ec --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiClient.cs @@ -0,0 +1,297 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Text.RegularExpressions; +using System.IO; +using System.Web; +using System.Linq; +using System.Net; +using System.Text; +using Newtonsoft.Json; +using RestSharp; +using RestSharp.Extensions; + +namespace Org.OpenAPITools.Client +{ + /// + /// API client is mainly responible for making the HTTP call to the API backend. + /// + public class ApiClient + { + private readonly Dictionary _defaultHeaderMap = new Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// The base path. + public ApiClient(String basePath="http://petstore.swagger.io/v2") + { + BasePath = basePath; + RestClient = new RestClient(BasePath); + } + + /// + /// Gets or sets the base path. + /// + /// The base path + public string BasePath { get; set; } + + /// + /// Gets or sets the RestClient. + /// + /// An instance of the RestClient + public RestClient RestClient { get; set; } + + /// + /// Gets the default header. + /// + public Dictionary DefaultHeader + { + get { return _defaultHeaderMap; } + } + + /// + /// Makes the HTTP request (Sync). + /// + /// URL path. + /// HTTP method. + /// Query parameters. + /// HTTP body (POST request). + /// Header parameters. + /// Form parameters. + /// File parameters. + /// Authentication settings. + /// Object + public Object CallApi(String path, RestSharp.Method method, Dictionary queryParams, String postBody, + Dictionary headerParams, Dictionary formParams, + Dictionary fileParams, String[] authSettings) + { + + var request = new RestRequest(path, method); + + UpdateParamsForAuth(queryParams, headerParams, authSettings); + + // add default header, if any + foreach(var defaultHeader in _defaultHeaderMap) + request.AddHeader(defaultHeader.Key, defaultHeader.Value); + + // add header parameter, if any + foreach(var param in headerParams) + request.AddHeader(param.Key, param.Value); + + // add query parameter, if any + foreach(var param in queryParams) + request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost); + + // add form parameter, if any + foreach(var param in formParams) + request.AddParameter(param.Key, param.Value, ParameterType.GetOrPost); + + // add file parameter, if any + foreach(var param in fileParams) + request.AddFile(param.Value.Name, param.Value.Writer, param.Value.FileName, param.Value.ContentType); + + if (postBody != null) // http body (model) parameter + request.AddParameter("application/json", postBody, ParameterType.RequestBody); + + return (Object)RestClient.Execute(request); + + } + + /// + /// Add default header. + /// + /// Header field name. + /// Header field value. + /// + public void AddDefaultHeader(string key, string value) + { + _defaultHeaderMap.Add(key, value); + } + + /// + /// Escape string (url-encoded). + /// + /// String to be escaped. + /// Escaped string. + public string EscapeString(string str) + { + return RestSharp.Contrib.HttpUtility.UrlEncode(str); + } + + /// + /// Create FileParameter based on Stream. + /// + /// Parameter name. + /// Input stream. + /// FileParameter. + public FileParameter ParameterToFile(string name, Stream stream) + { + if (stream is FileStream) + return FileParameter.Create(name, stream.ReadAsBytes(), Path.GetFileName(((FileStream)stream).Name)); + else + return FileParameter.Create(name, stream.ReadAsBytes(), "no_file_name_provided"); + } + + /// + /// If parameter is DateTime, output in a formatted string (default ISO 8601), customizable with Configuration.DateTime. + /// If parameter is a list of string, join the list with ",". + /// Otherwise just return the string. + /// + /// The parameter (header, path, query, form). + /// Formatted string. + public string ParameterToString(object obj) + { + if (obj is DateTime) + // Return a formatted date string - Can be customized with Configuration.DateTimeFormat + // Defaults to an ISO 8601, using the known as a Round-trip date/time pattern ("o") + // https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 + // For example: 2009-06-15T13:45:30.0000000 + return ((DateTime)obj).ToString (Configuration.DateTimeFormat); + else if (obj is List) + return String.Join(",", (obj as List).ToArray()); + else + return Convert.ToString (obj); + } + + /// + /// Deserialize the JSON string into a proper object. + /// + /// HTTP body (e.g. string, JSON). + /// Object type. + /// HTTP headers. + /// Object representation of the JSON string. + public object Deserialize(string content, Type type, IList headers=null) + { + if (type == typeof(Object)) // return an object + { + return content; + } + + if (type == typeof(Stream)) + { + var filePath = String.IsNullOrEmpty(Configuration.TempFolderPath) + ? Path.GetTempPath() + : Configuration.TempFolderPath; + + var fileName = filePath + Guid.NewGuid(); + if (headers != null) + { + var regex = new Regex(@"Content-Disposition:.*filename=['""]?([^'""\s]+)['""]?$"); + var match = regex.Match(headers.ToString()); + if (match.Success) + fileName = filePath + match.Value.Replace("\"", "").Replace("'", ""); + } + File.WriteAllText(fileName, content); + return new FileStream(fileName, FileMode.Open); + + } + + if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object + { + return DateTime.Parse(content, null, System.Globalization.DateTimeStyles.RoundtripKind); + } + + if (type == typeof(String) || type.Name.StartsWith("System.Nullable")) // return primitive type + { + return ConvertType(content, type); + } + + // at this point, it must be a model (json) + try + { + return JsonConvert.DeserializeObject(content, type); + } + catch (IOException e) + { + throw new ApiException(500, e.Message); + } + } + + /// + /// Serialize an object into JSON string. + /// + /// Object. + /// JSON string. + public string Serialize(object obj) + { + try + { + return obj != null ? JsonConvert.SerializeObject(obj) : null; + } + catch (Exception e) + { + throw new ApiException(500, e.Message); + } + } + + /// + /// Get the API key with prefix. + /// + /// API key identifier (authentication scheme). + /// API key with prefix. + public string GetApiKeyWithPrefix (string apiKeyIdentifier) + { + var apiKeyValue = ""; + Configuration.ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue); + var apiKeyPrefix = ""; + if (Configuration.ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix)) + return apiKeyPrefix + " " + apiKeyValue; + else + return apiKeyValue; + } + + /// + /// Update parameters based on authentication. + /// + /// Query parameters. + /// Header parameters. + /// Authentication settings. + public void UpdateParamsForAuth(Dictionary queryParams, Dictionary headerParams, string[] authSettings) + { + if (authSettings == null || authSettings.Length == 0) + return; + + foreach (string auth in authSettings) + { + // determine which one to use + switch(auth) + { + case "api_key": + headerParams["api_key"] = GetApiKeyWithPrefix("api_key"); + + break; + case "petstore_auth": + + //TODO support oauth + break; + default: + //TODO show warning about security definition not found + break; + } + } + } + + /// + /// Encode string in base64 format. + /// + /// String to be encoded. + /// Encoded string. + public static string Base64Encode(string text) + { + var textByte = System.Text.Encoding.UTF8.GetBytes(text); + return System.Convert.ToBase64String(textByte); + } + + /// + /// Dynamically cast the object into target type. + /// + /// Object to be casted + /// Target type + /// Casted object + public static Object ConvertType(Object fromObject, Type toObject) { + return Convert.ChangeType(fromObject, toObject); + } + + } +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiException.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiException.cs new file mode 100644 index 00000000000..7985897b93e --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/ApiException.cs @@ -0,0 +1,47 @@ +using System; + +namespace Org.OpenAPITools.Client { + /// + /// API Exception + /// + public class ApiException : Exception { + /// + /// Gets or sets the error code (HTTP status code) + /// + /// The error code (HTTP status code). + public int ErrorCode { get; set; } + + /// + /// Gets or sets the error content (body json object) + /// + /// The error content (Http response body). + public Object ErrorContent { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + public ApiException() {} + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + public ApiException(int errorCode, string message) : base(message) { + this.ErrorCode = errorCode; + } + + /// + /// Initializes a new instance of the class. + /// + /// HTTP status code. + /// Error message. + /// Error content. + public ApiException(int errorCode, string message, Object errorContent = null) : base(message) { + this.ErrorCode = errorCode; + this.ErrorContent = errorContent; + } + + } + +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/Configuration.cs new file mode 100644 index 00000000000..8cac9c7d9db --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Client/Configuration.cs @@ -0,0 +1,132 @@ +using System; +using System.Reflection; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; + +namespace Org.OpenAPITools.Client +{ + /// + /// Represents a set of configuration settings + /// + public class Configuration + { + + /// + /// Version of the package. + /// + /// Version of the package. + public const string Version = "1.0.0"; + + /// + /// Gets or sets the default API client for making HTTP calls. + /// + /// The API client. + public static ApiClient DefaultApiClient = new ApiClient(); + + /// + /// Gets or sets the username (HTTP basic authentication). + /// + /// The username. + public static String Username { get; set; } + + /// + /// Gets or sets the password (HTTP basic authentication). + /// + /// The password. + public static String Password { get; set; } + + /// + /// Gets or sets the API key based on the authentication name. + /// + /// The API key. + public static Dictionary ApiKey = new Dictionary(); + + /// + /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. + /// + /// The prefix of the API key. + public static Dictionary ApiKeyPrefix = new Dictionary(); + + private static string _tempFolderPath = Path.GetTempPath(); + + /// + /// Gets or sets the temporary folder path to store the files downloaded from the server. + /// + /// Folder path. + public static String TempFolderPath + { + get { return _tempFolderPath; } + + set + { + if (String.IsNullOrEmpty(value)) + { + _tempFolderPath = value; + return; + } + + // create the directory if it does not exist + if (!Directory.Exists(value)) + Directory.CreateDirectory(value); + + // check if the path contains directory separator at the end + if (value[value.Length - 1] == Path.DirectorySeparatorChar) + _tempFolderPath = value; + else + _tempFolderPath = value + Path.DirectorySeparatorChar; + } + } + + private const string ISO8601_DATETIME_FORMAT = "o"; + + private static string _dateTimeFormat = ISO8601_DATETIME_FORMAT; + + /// + /// Gets or sets the the date time format used when serializing in the ApiClient + /// By default, it's set to ISO 8601 - "o", for others see: + /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx + /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx + /// No validation is done to ensure that the string you're providing is valid + /// + /// The DateTimeFormat string + public static String DateTimeFormat + { + get + { + return _dateTimeFormat; + } + set + { + if (string.IsNullOrEmpty(value)) + { + // Never allow a blank or null string, go back to the default + _dateTimeFormat = ISO8601_DATETIME_FORMAT; + return; + } + + // Caution, no validation when you choose date time format other than ISO 8601 + // Take a look at the above links + _dateTimeFormat = value; + } + } + + /// + /// Returns a string with essential information for debugging. + /// + public static String ToDebugReport() + { + String report = "C# SDK (Org.OpenAPITools) Debug Report:\n"; + report += " OS: " + Environment.OSVersion + "\n"; + report += " .NET Framework Version: " + Assembly + .GetExecutingAssembly() + .GetReferencedAssemblies() + .Where(x => x.Name == "System.Core").First().Version.ToString() + "\n"; + report += " Version of the API: 1.0.0\n"; + report += " SDK Package Version: 1.0.0\n"; + + return report; + } + } +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/ApiResponse.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/ApiResponse.cs new file mode 100644 index 00000000000..648aaeba5b1 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/ApiResponse.cs @@ -0,0 +1,60 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// Describes the result of uploading an image resource + /// + [DataContract] + public class ApiResponse { + /// + /// Gets or Sets Code + /// + [DataMember(Name="code", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "code")] + public int? Code { get; set; } + + /// + /// Gets or Sets Type + /// + [DataMember(Name="type", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "type")] + public string Type { get; set; } + + /// + /// Gets or Sets Message + /// + [DataMember(Name="message", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "message")] + public string Message { get; set; } + + + /// + /// Get the string presentation of the object + /// + /// String presentation of the object + public override string ToString() { + var sb = new StringBuilder(); + sb.Append("class ApiResponse {\n"); + sb.Append(" Code: ").Append(Code).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append(" Message: ").Append(Message).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Get the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + +} +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Category.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Category.cs new file mode 100644 index 00000000000..847279502e2 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Category.cs @@ -0,0 +1,52 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// A category for a pet + /// + [DataContract] + public class Category { + /// + /// Gets or Sets Id + /// + [DataMember(Name="id", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "id")] + public long? Id { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name="name", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + + /// + /// Get the string presentation of the object + /// + /// String presentation of the object + public override string ToString() { + var sb = new StringBuilder(); + sb.Append("class Category {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Get the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + +} +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Order.cs new file mode 100644 index 00000000000..c19511ca3f8 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Order.cs @@ -0,0 +1,85 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// An order for a pets from the pet store + /// + [DataContract] + public class Order { + /// + /// Gets or Sets Id + /// + [DataMember(Name="id", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "id")] + public long? Id { get; set; } + + /// + /// Gets or Sets PetId + /// + [DataMember(Name="petId", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "petId")] + public long? PetId { get; set; } + + /// + /// Gets or Sets Quantity + /// + [DataMember(Name="quantity", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "quantity")] + public int? Quantity { get; set; } + + /// + /// Gets or Sets ShipDate + /// + [DataMember(Name="shipDate", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "shipDate")] + public DateTime? ShipDate { get; set; } + + /// + /// Order Status + /// + /// Order Status + [DataMember(Name="status", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + /// + /// Gets or Sets Complete + /// + [DataMember(Name="complete", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "complete")] + public bool? Complete { get; set; } + + + /// + /// Get the string presentation of the object + /// + /// String presentation of the object + public override string ToString() { + var sb = new StringBuilder(); + sb.Append("class Order {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" PetId: ").Append(PetId).Append("\n"); + sb.Append(" Quantity: ").Append(Quantity).Append("\n"); + sb.Append(" ShipDate: ").Append(ShipDate).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append(" Complete: ").Append(Complete).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Get the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + +} +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Pet.cs new file mode 100644 index 00000000000..71ec62aa9c8 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Pet.cs @@ -0,0 +1,85 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// A pet for sale in the pet store + /// + [DataContract] + public class Pet { + /// + /// Gets or Sets Id + /// + [DataMember(Name="id", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "id")] + public long? Id { get; set; } + + /// + /// Gets or Sets Category + /// + [DataMember(Name="category", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "category")] + public Category Category { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name="name", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + /// + /// Gets or Sets PhotoUrls + /// + [DataMember(Name="photoUrls", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "photoUrls")] + public List PhotoUrls { get; set; } + + /// + /// Gets or Sets Tags + /// + [DataMember(Name="tags", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "tags")] + public List Tags { get; set; } + + /// + /// pet status in the store + /// + /// pet status in the store + [DataMember(Name="status", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "status")] + public string Status { get; set; } + + + /// + /// Get the string presentation of the object + /// + /// String presentation of the object + public override string ToString() { + var sb = new StringBuilder(); + sb.Append("class Pet {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Category: ").Append(Category).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append(" PhotoUrls: ").Append(PhotoUrls).Append("\n"); + sb.Append(" Tags: ").Append(Tags).Append("\n"); + sb.Append(" Status: ").Append(Status).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Get the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + +} +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Tag.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Tag.cs new file mode 100644 index 00000000000..6399695a50a --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/Tag.cs @@ -0,0 +1,52 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// A tag for a pet + /// + [DataContract] + public class Tag { + /// + /// Gets or Sets Id + /// + [DataMember(Name="id", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "id")] + public long? Id { get; set; } + + /// + /// Gets or Sets Name + /// + [DataMember(Name="name", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "name")] + public string Name { get; set; } + + + /// + /// Get the string presentation of the object + /// + /// String presentation of the object + public override string ToString() { + var sb = new StringBuilder(); + sb.Append("class Tag {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Name: ").Append(Name).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Get the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + +} +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/User.cs b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/User.cs new file mode 100644 index 00000000000..c6af059dcdc --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/src/main/CsharpDotNet2/Org/OpenAPITools/Model/User.cs @@ -0,0 +1,101 @@ +using System; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Runtime.Serialization; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Model { + + /// + /// A User who is purchasing from the pet store + /// + [DataContract] + public class User { + /// + /// Gets or Sets Id + /// + [DataMember(Name="id", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "id")] + public long? Id { get; set; } + + /// + /// Gets or Sets Username + /// + [DataMember(Name="username", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "username")] + public string Username { get; set; } + + /// + /// Gets or Sets FirstName + /// + [DataMember(Name="firstName", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "firstName")] + public string FirstName { get; set; } + + /// + /// Gets or Sets LastName + /// + [DataMember(Name="lastName", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "lastName")] + public string LastName { get; set; } + + /// + /// Gets or Sets Email + /// + [DataMember(Name="email", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "email")] + public string Email { get; set; } + + /// + /// Gets or Sets Password + /// + [DataMember(Name="password", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "password")] + public string Password { get; set; } + + /// + /// Gets or Sets Phone + /// + [DataMember(Name="phone", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "phone")] + public string Phone { get; set; } + + /// + /// User Status + /// + /// User Status + [DataMember(Name="userStatus", EmitDefaultValue=false)] + [JsonProperty(PropertyName = "userStatus")] + public int? UserStatus { get; set; } + + + /// + /// Get the string presentation of the object + /// + /// String presentation of the object + public override string ToString() { + var sb = new StringBuilder(); + sb.Append("class User {\n"); + sb.Append(" Id: ").Append(Id).Append("\n"); + sb.Append(" Username: ").Append(Username).Append("\n"); + sb.Append(" FirstName: ").Append(FirstName).Append("\n"); + sb.Append(" LastName: ").Append(LastName).Append("\n"); + sb.Append(" Email: ").Append(Email).Append("\n"); + sb.Append(" Password: ").Append(Password).Append("\n"); + sb.Append(" Phone: ").Append(Phone).Append("\n"); + sb.Append(" UserStatus: ").Append(UserStatus).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Get the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + +} +} diff --git a/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/vendor/packages.config b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/vendor/packages.config new file mode 100644 index 00000000000..7b9cf186303 --- /dev/null +++ b/samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient/vendor/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClient/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClient/docs/MapTest.md index ee62dbf135f..2c44f95808a 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClient/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] **DirectMap** | **Dictionary<string, bool?>** | | [optional] -**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**IndirectMap** | **Dictionary<string, 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/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs index b9444fb3607..1504638f6f2 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Cat.cs @@ -123,7 +123,7 @@ namespace Org.OpenAPITools.Model /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; + foreach(var x in base.BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs index 90c181c11b6..ecd67f40b6e 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/Dog.cs @@ -123,7 +123,7 @@ namespace Org.OpenAPITools.Model /// Validation Result IEnumerable IValidatableObject.Validate(ValidationContext validationContext) { - foreach(var x in BaseValidate(validationContext)) yield return x; + foreach(var x in base.BaseValidate(validationContext)) yield return x; yield break; } } diff --git a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MapTest.cs index 1c5bfa70198..3f44bcf22ea 100644 --- a/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClient/src/Org.OpenAPITools/Model/MapTest.cs @@ -63,7 +63,7 @@ namespace Org.OpenAPITools.Model /// mapOfEnumString. /// directMap. /// indirectMap. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), Dictionary indirectMap = default(Dictionary)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; @@ -88,7 +88,7 @@ namespace Org.OpenAPITools.Model /// Gets or Sets IndirectMap /// [DataMember(Name="indirect_map", EmitDefaultValue=false)] - public StringBooleanMap IndirectMap { get; set; } + public Dictionary IndirectMap { get; set; } /// /// Returns the string presentation of the object @@ -153,8 +153,8 @@ namespace Org.OpenAPITools.Model ) && ( this.IndirectMap == input.IndirectMap || - (this.IndirectMap != null && - this.IndirectMap.Equals(input.IndirectMap)) + this.IndirectMap != null && + this.IndirectMap.SequenceEqual(input.IndirectMap) ); } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/README.md b/samples/client/petstore/csharp/OpenAPIClientNet35/README.md index 441abc40881..a2b8a9b17a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/README.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/README.md @@ -76,12 +76,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } @@ -96,11 +96,12 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*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 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -116,6 +117,7 @@ Class | Method | HTTP request | Description *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 @@ -148,6 +150,8 @@ Class | Method | HTTP request | Description - [Model.EnumArrays](docs/EnumArrays.md) - [Model.EnumClass](docs/EnumClass.md) - [Model.EnumTest](docs/EnumTest.md) + - [Model.File](docs/File.md) + - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.List](docs/List.md) @@ -164,6 +168,7 @@ Class | Method | HTTP request | Description - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Model.Return](docs/Return.md) - [Model.SpecialModelName](docs/SpecialModelName.md) + - [Model.StringBooleanMap](docs/StringBooleanMap.md) - [Model.Tag](docs/Tag.md) - [Model.User](docs/User.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/AnotherFakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/AnotherFakeApi.md index 2dca444f276..81cc3106d64 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/AnotherFakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/AnotherFakeApi.md @@ -4,16 +4,16 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestSpecialTags**](AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +[**Call123TestSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags - -# **TestSpecialTags** -> ModelClient TestSpecialTags (ModelClient modelClient) + +# **Call123TestSpecialTags** +> ModelClient Call123TestSpecialTags (ModelClient modelClient) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Example ```csharp @@ -25,7 +25,7 @@ using Org.OpenAPITools.Model; namespace Example { - public class TestSpecialTagsExample + public class Call123TestSpecialTagsExample { public void main() { @@ -35,12 +35,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FakeApi.md index 2a4fb6094ae..d51d29c09a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**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 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -159,7 +160,7 @@ namespace Example public void main() { var apiInstance = new FakeApi(); - var body = 1.2; // decimal? | Input number as post body (optional) + var body = 1.2D; // decimal? | Input number as post body (optional) try { @@ -256,6 +257,65 @@ No authorization required [[Back to top]](#) [[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** +> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithFileSchemaExample + { + public void main() + { + var apiInstance = new FakeApi(); + var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(fileSchemaTestClass); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**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** > void TestBodyWithQueryParams (string query, User user) @@ -404,13 +464,13 @@ namespace Example var apiInstance = new FakeApi(); var number = 8.14; // decimal? | None - var _double = 1.2; // double? | None + var _double = 1.2D; // double? | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None var integer = 56; // int? | None (optional) var int32 = 56; // int? | None (optional) var int64 = 789; // long? | None (optional) - var _float = 3.4; // float? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) var date = 2013-10-20; // DateTime? | None (optional) @@ -494,8 +554,8 @@ namespace Example var enumQueryStringArray = enumQueryStringArray_example; // List | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2; // double? | Query parameter enum test (double) (optional) - var enumFormStringArray = enumFormStringArray_example; // List | Form parameter enum test (string array) (optional) (default to $) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) + var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) try @@ -522,7 +582,7 @@ Name | Type | Description | Notes **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** | **List<string>**| Form parameter enum test (string array) | [optional] [default to $] + **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/File.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/File.md new file mode 100644 index 00000000000..acf85a4c001 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/File.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.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/csharp/OpenAPIClientNet35/docs/FileSchemaTestClass.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..e0820fa4e65 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/FileSchemaTestClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | **System.IO.Stream** | | [optional] +**Files** | **List<System.IO.Stream>** | | [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/csharp/OpenAPIClientNet35/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md index 2baba08d855..ee62dbf135f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/MapTest.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] +**DirectMap** | **Dictionary<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/csharp/OpenAPIClientNet35/docs/PetApi.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/PetApi.md index 244ece53a31..dd23df9b368 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/docs/PetApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/PetApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**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) @@ -524,3 +525,69 @@ Name | Type | Description | Notes [[Back to top]](#) [[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** +> ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + +uploads an image (required) + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileWithRequiredFileExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to update + var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload + var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) + + try + { + // uploads an image (required) + ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to update | + **requiredFile** | **System.IO.Stream**| 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/csharp/OpenAPIClientNet35/docs/StringBooleanMap.md b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/StringBooleanMap.md new file mode 100644 index 00000000000..6e7a71368df --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/docs/StringBooleanMap.md @@ -0,0 +1,8 @@ +# Org.OpenAPITools.Model.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/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs new file mode 100644 index 00000000000..bb47c43dc7a --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing FileSchemaTestClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FileSchemaTestClassTests + { + // TODO uncomment below to declare an instance variable for FileSchemaTestClass + //private FileSchemaTestClass instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of FileSchemaTestClass + //instance = new FileSchemaTestClass(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of FileSchemaTestClass + /// + [Test] + public void FileSchemaTestClassInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" FileSchemaTestClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a FileSchemaTestClass"); + } + + + /// + /// Test the property 'File' + /// + [Test] + public void FileTest() + { + // TODO unit test for the property 'File' + } + /// + /// Test the property 'Files' + /// + [Test] + public void FilesTest() + { + // TODO unit test for the property 'Files' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileTests.cs new file mode 100644 index 00000000000..f1cf54c22e4 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing File + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FileTests + { + // TODO uncomment below to declare an instance variable for File + //private File instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of File + //instance = new File(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of File + /// + [Test] + public void FileInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" File + //Assert.IsInstanceOfType (instance, "variable 'instance' is a File"); + } + + + /// + /// Test the property 'SourceURI' + /// + [Test] + public void SourceURITest() + { + // TODO unit test for the property 'SourceURI' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs new file mode 100644 index 00000000000..efc4cd90773 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing StringBooleanMap + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class StringBooleanMapTests + { + // TODO uncomment below to declare an instance variable for StringBooleanMap + //private StringBooleanMap instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of StringBooleanMap + //instance = new StringBooleanMap(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of StringBooleanMap + /// + [Test] + public void StringBooleanMapInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" StringBooleanMap + //Assert.IsInstanceOfType (instance, "variable 'instance' is a StringBooleanMap"); + } + + + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index be68c4ede50..193c4907a1e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -28,23 +28,23 @@ namespace Org.OpenAPITools.Api /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - ModelClient TestSpecialTags (ModelClient modelClient); + ModelClient Call123TestSpecialTags (ModelClient modelClient); /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - ApiResponse TestSpecialTagsWithHttpInfo (ModelClient modelClient); + ApiResponse Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient); #endregion Synchronous Operations } @@ -146,28 +146,28 @@ namespace Org.OpenAPITools.Api } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - public ModelClient TestSpecialTags (ModelClient modelClient) + public ModelClient Call123TestSpecialTags (ModelClient modelClient) { - ApiResponse localVarResponse = TestSpecialTagsWithHttpInfo(modelClient); + ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient); return localVarResponse.Data; } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient modelClient) + public ApiResponse< ModelClient > Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient) { // verify the required parameter 'modelClient' is set if (modelClient == null) - throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags"); + throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); var localVarPath = "/another-fake/dummy"; var localVarPathParams = new Dictionary(); @@ -210,7 +210,7 @@ namespace Org.OpenAPITools.Api if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); + Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse); if (exception != null) throw exception; } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs index c9d0b50be14..20430b4bbdb 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/FakeApi.cs @@ -112,6 +112,27 @@ namespace Org.OpenAPITools.Api /// /// /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass); + /// + /// + /// + /// /// /// /// Thrown when fails to make API call @@ -658,6 +679,78 @@ namespace Org.OpenAPITools.Api (string) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); } + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + public void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + { + TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + + var localVarPath = "/fake/body-with-file-schema"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter + } + else + { + localVarPostBody = fileSchemaTestClass; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + /// /// /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/PetApi.cs index c6db8f4b909..6ec963b56ee 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Api/PetApi.cs @@ -202,6 +202,31 @@ namespace Org.OpenAPITools.Api /// file to upload (optional) /// ApiResponse of ApiResponse ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); #endregion Synchronous Operations } @@ -907,5 +932,87 @@ namespace Org.OpenAPITools.Api (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); } + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + public ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + ApiResponse localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + public ApiResponse< ApiResponse > UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + var localVarPath = "/fake/{petId}/uploadImageWithRequiredFile"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "multipart/form-data" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter + if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumArrays.cs index 77490c7b120..b8b86f0038a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -36,18 +36,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum JustSymbolEnum { - /// /// Enum GreaterThanOrEqualTo for value: >= /// [EnumMember(Value = ">=")] GreaterThanOrEqualTo = 1, - + /// /// Enum Dollar for value: $ /// [EnumMember(Value = "$")] Dollar = 2 + } /// @@ -61,18 +61,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum ArrayEnumEnum { - /// /// Enum Fish for value: fish /// [EnumMember(Value = "fish")] Fish = 1, - + /// /// Enum Crab for value: crab /// [EnumMember(Value = "crab")] Crab = 2 + } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumClass.cs index 3da1bee1360..33643e475f5 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumClass.cs @@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model public enum EnumClass { - /// /// Enum Abc for value: _abc /// [EnumMember(Value = "_abc")] Abc = 1, - + /// /// Enum Efg for value: -efg /// [EnumMember(Value = "-efg")] Efg = 2, - + /// /// Enum Xyz for value: (xyz) /// [EnumMember(Value = "(xyz)")] Xyz = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumTest.cs index f887f56d9c6..0329f3f29f8 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/EnumTest.cs @@ -36,24 +36,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -67,24 +67,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringRequiredEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -97,18 +97,16 @@ namespace Org.OpenAPITools.Model /// public enum EnumIntegerEnum { - /// /// Enum NUMBER_1 for value: 1 /// - NUMBER_1 = 1, - + /// /// Enum NUMBER_MINUS_1 for value: -1 /// - NUMBER_MINUS_1 = -1 + } /// @@ -122,18 +120,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum EnumNumberEnum { - /// /// Enum NUMBER_1_DOT_1 for value: 1.1 /// [EnumMember(Value = "1.1")] NUMBER_1_DOT_1 = 1, - + /// /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 /// [EnumMember(Value = "-1.2")] NUMBER_MINUS_1_DOT_2 = 2 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 00000000000..22367be1c22 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/File.cs @@ -0,0 +1,116 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// Must be named `File` for test. + /// + [DataContract] + public partial class File : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Test capitalization. + public File(string sourceURI = default(string)) + { + this.SourceURI = sourceURI; + } + + /// + /// Test capitalization + /// + /// Test capitalization + [DataMember(Name="sourceURI", EmitDefaultValue=false)] + public string SourceURI { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class File {\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as File); + } + + /// + /// Returns true if File instances are equal + /// + /// Instance of File to be compared + /// Boolean + public bool Equals(File input) + { + if (input == null) + return false; + + return + ( + this.SourceURI == input.SourceURI || + (this.SourceURI != null && + this.SourceURI.Equals(input.SourceURI)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceURI != null) + hashCode = hashCode * 59 + this.SourceURI.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 00000000000..4e3d772816f --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -0,0 +1,131 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + [DataContract] + public partial class FileSchemaTestClass : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// file. + /// files. + public FileSchemaTestClass(System.IO.Stream file = default(System.IO.Stream), List files = default(List)) + { + this.File = file; + this.Files = files; + } + + /// + /// Gets or Sets File + /// + [DataMember(Name="file", EmitDefaultValue=false)] + public System.IO.Stream File { get; set; } + + /// + /// Gets or Sets Files + /// + [DataMember(Name="files", EmitDefaultValue=false)] + public List Files { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class FileSchemaTestClass {\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append(" Files: ").Append(Files).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FileSchemaTestClass); + } + + /// + /// Returns true if FileSchemaTestClass instances are equal + /// + /// Instance of FileSchemaTestClass to be compared + /// Boolean + public bool Equals(FileSchemaTestClass input) + { + if (input == null) + return false; + + return + ( + this.File == input.File || + (this.File != null && + this.File.Equals(input.File)) + ) && + ( + this.Files == input.Files || + this.Files != null && + this.Files.SequenceEqual(input.Files) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.File != null) + hashCode = hashCode * 59 + this.File.GetHashCode(); + if (this.Files != null) + hashCode = hashCode * 59 + this.Files.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs index 9f3836c7e22..b9ad7659bcb 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/MapTest.cs @@ -36,18 +36,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum InnerEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2 + } @@ -61,10 +61,14 @@ namespace Org.OpenAPITools.Model /// /// mapMapOfString. /// mapOfEnumString. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary)) + /// directMap. + /// indirectMap. + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; + this.DirectMap = directMap; + this.IndirectMap = indirectMap; } /// @@ -74,6 +78,18 @@ namespace Org.OpenAPITools.Model public Dictionary> MapMapOfString { get; set; } + /// + /// Gets or Sets DirectMap + /// + [DataMember(Name="direct_map", EmitDefaultValue=false)] + public Dictionary DirectMap { get; set; } + + /// + /// Gets or Sets IndirectMap + /// + [DataMember(Name="indirect_map", EmitDefaultValue=false)] + public StringBooleanMap IndirectMap { get; set; } + /// /// Returns the string presentation of the object /// @@ -84,6 +100,8 @@ namespace Org.OpenAPITools.Model sb.Append("class MapTest {\n"); sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); + sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -127,6 +145,16 @@ namespace Org.OpenAPITools.Model this.MapOfEnumString == input.MapOfEnumString || this.MapOfEnumString != null && this.MapOfEnumString.SequenceEqual(input.MapOfEnumString) + ) && + ( + this.DirectMap == input.DirectMap || + this.DirectMap != null && + this.DirectMap.SequenceEqual(input.DirectMap) + ) && + ( + this.IndirectMap == input.IndirectMap || + (this.IndirectMap != null && + this.IndirectMap.Equals(input.IndirectMap)) ); } @@ -143,6 +171,10 @@ namespace Org.OpenAPITools.Model hashCode = hashCode * 59 + this.MapMapOfString.GetHashCode(); if (this.MapOfEnumString != null) hashCode = hashCode * 59 + this.MapOfEnumString.GetHashCode(); + if (this.DirectMap != null) + hashCode = hashCode * 59 + this.DirectMap.GetHashCode(); + if (this.IndirectMap != null) + hashCode = hashCode * 59 + this.IndirectMap.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Order.cs index 7e0a4287576..80bab785b7e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Order.cs @@ -37,24 +37,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/OuterEnum.cs index 2716692ee0e..be116aff60a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model public enum OuterEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Pet.cs index c496a100aec..ade35d0936e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/Pet.cs @@ -37,24 +37,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Available for value: available /// [EnumMember(Value = "available")] Available = 1, - + /// /// Enum Pending for value: pending /// [EnumMember(Value = "pending")] Pending = 2, - + /// /// Enum Sold for value: sold /// [EnumMember(Value = "sold")] Sold = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/StringBooleanMap.cs b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/StringBooleanMap.cs new file mode 100644 index 00000000000..75ce6dca939 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet35/src/Org.OpenAPITools/Model/StringBooleanMap.cs @@ -0,0 +1,101 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// StringBooleanMap + /// + [DataContract] + public partial class StringBooleanMap : Dictionary, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public StringBooleanMap() : base() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class StringBooleanMap {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as StringBooleanMap); + } + + /// + /// Returns true if StringBooleanMap instances are equal + /// + /// Instance of StringBooleanMap to be compared + /// Boolean + public bool Equals(StringBooleanMap input) + { + if (input == null) + return false; + + return base.Equals(input); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + return hashCode; + } + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/README.md b/samples/client/petstore/csharp/OpenAPIClientNet40/README.md index 441abc40881..a2b8a9b17a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/README.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/README.md @@ -76,12 +76,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } @@ -96,11 +96,12 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*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 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -116,6 +117,7 @@ Class | Method | HTTP request | Description *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 @@ -148,6 +150,8 @@ Class | Method | HTTP request | Description - [Model.EnumArrays](docs/EnumArrays.md) - [Model.EnumClass](docs/EnumClass.md) - [Model.EnumTest](docs/EnumTest.md) + - [Model.File](docs/File.md) + - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.List](docs/List.md) @@ -164,6 +168,7 @@ Class | Method | HTTP request | Description - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Model.Return](docs/Return.md) - [Model.SpecialModelName](docs/SpecialModelName.md) + - [Model.StringBooleanMap](docs/StringBooleanMap.md) - [Model.Tag](docs/Tag.md) - [Model.User](docs/User.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/AnotherFakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/AnotherFakeApi.md index 2dca444f276..81cc3106d64 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/AnotherFakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/AnotherFakeApi.md @@ -4,16 +4,16 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestSpecialTags**](AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +[**Call123TestSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags - -# **TestSpecialTags** -> ModelClient TestSpecialTags (ModelClient modelClient) + +# **Call123TestSpecialTags** +> ModelClient Call123TestSpecialTags (ModelClient modelClient) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Example ```csharp @@ -25,7 +25,7 @@ using Org.OpenAPITools.Model; namespace Example { - public class TestSpecialTagsExample + public class Call123TestSpecialTagsExample { public void main() { @@ -35,12 +35,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FakeApi.md index 2a4fb6094ae..d51d29c09a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**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 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -159,7 +160,7 @@ namespace Example public void main() { var apiInstance = new FakeApi(); - var body = 1.2; // decimal? | Input number as post body (optional) + var body = 1.2D; // decimal? | Input number as post body (optional) try { @@ -256,6 +257,65 @@ No authorization required [[Back to top]](#) [[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** +> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithFileSchemaExample + { + public void main() + { + var apiInstance = new FakeApi(); + var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(fileSchemaTestClass); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**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** > void TestBodyWithQueryParams (string query, User user) @@ -404,13 +464,13 @@ namespace Example var apiInstance = new FakeApi(); var number = 8.14; // decimal? | None - var _double = 1.2; // double? | None + var _double = 1.2D; // double? | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None var integer = 56; // int? | None (optional) var int32 = 56; // int? | None (optional) var int64 = 789; // long? | None (optional) - var _float = 3.4; // float? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) var date = 2013-10-20; // DateTime? | None (optional) @@ -494,8 +554,8 @@ namespace Example var enumQueryStringArray = enumQueryStringArray_example; // List | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2; // double? | Query parameter enum test (double) (optional) - var enumFormStringArray = enumFormStringArray_example; // List | Form parameter enum test (string array) (optional) (default to $) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) + var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) try @@ -522,7 +582,7 @@ Name | Type | Description | Notes **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** | **List<string>**| Form parameter enum test (string array) | [optional] [default to $] + **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/File.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/File.md new file mode 100644 index 00000000000..acf85a4c001 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/File.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.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/csharp/OpenAPIClientNet40/docs/FileSchemaTestClass.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..e0820fa4e65 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/FileSchemaTestClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | **System.IO.Stream** | | [optional] +**Files** | **List<System.IO.Stream>** | | [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/csharp/OpenAPIClientNet40/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md index 2baba08d855..ee62dbf135f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/MapTest.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] +**DirectMap** | **Dictionary<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/csharp/OpenAPIClientNet40/docs/PetApi.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/PetApi.md index 244ece53a31..dd23df9b368 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/docs/PetApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/PetApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**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) @@ -524,3 +525,69 @@ Name | Type | Description | Notes [[Back to top]](#) [[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** +> ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + +uploads an image (required) + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileWithRequiredFileExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to update + var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload + var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) + + try + { + // uploads an image (required) + ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to update | + **requiredFile** | **System.IO.Stream**| 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/csharp/OpenAPIClientNet40/docs/StringBooleanMap.md b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/StringBooleanMap.md new file mode 100644 index 00000000000..6e7a71368df --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/docs/StringBooleanMap.md @@ -0,0 +1,8 @@ +# Org.OpenAPITools.Model.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/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs new file mode 100644 index 00000000000..bb47c43dc7a --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing FileSchemaTestClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FileSchemaTestClassTests + { + // TODO uncomment below to declare an instance variable for FileSchemaTestClass + //private FileSchemaTestClass instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of FileSchemaTestClass + //instance = new FileSchemaTestClass(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of FileSchemaTestClass + /// + [Test] + public void FileSchemaTestClassInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" FileSchemaTestClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a FileSchemaTestClass"); + } + + + /// + /// Test the property 'File' + /// + [Test] + public void FileTest() + { + // TODO unit test for the property 'File' + } + /// + /// Test the property 'Files' + /// + [Test] + public void FilesTest() + { + // TODO unit test for the property 'Files' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileTests.cs new file mode 100644 index 00000000000..f1cf54c22e4 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing File + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FileTests + { + // TODO uncomment below to declare an instance variable for File + //private File instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of File + //instance = new File(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of File + /// + [Test] + public void FileInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" File + //Assert.IsInstanceOfType (instance, "variable 'instance' is a File"); + } + + + /// + /// Test the property 'SourceURI' + /// + [Test] + public void SourceURITest() + { + // TODO unit test for the property 'SourceURI' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs new file mode 100644 index 00000000000..efc4cd90773 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing StringBooleanMap + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class StringBooleanMapTests + { + // TODO uncomment below to declare an instance variable for StringBooleanMap + //private StringBooleanMap instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of StringBooleanMap + //instance = new StringBooleanMap(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of StringBooleanMap + /// + [Test] + public void StringBooleanMapInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" StringBooleanMap + //Assert.IsInstanceOfType (instance, "variable 'instance' is a StringBooleanMap"); + } + + + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 5e074d5ee58..71bcd84a663 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -28,23 +28,23 @@ namespace Org.OpenAPITools.Api /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - ModelClient TestSpecialTags (ModelClient modelClient); + ModelClient Call123TestSpecialTags (ModelClient modelClient); /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - ApiResponse TestSpecialTagsWithHttpInfo (ModelClient modelClient); + ApiResponse Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient); #endregion Synchronous Operations } @@ -146,28 +146,28 @@ namespace Org.OpenAPITools.Api } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - public ModelClient TestSpecialTags (ModelClient modelClient) + public ModelClient Call123TestSpecialTags (ModelClient modelClient) { - ApiResponse localVarResponse = TestSpecialTagsWithHttpInfo(modelClient); + ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient); return localVarResponse.Data; } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient modelClient) + public ApiResponse< ModelClient > Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient) { // verify the required parameter 'modelClient' is set if (modelClient == null) - throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags"); + throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); var localVarPath = "/another-fake/dummy"; var localVarPathParams = new Dictionary(); @@ -210,7 +210,7 @@ namespace Org.OpenAPITools.Api if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); + Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse); if (exception != null) throw exception; } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs index ef93f6dbcdc..c2f338c3bb7 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/FakeApi.cs @@ -112,6 +112,27 @@ namespace Org.OpenAPITools.Api /// /// /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass); + /// + /// + /// + /// /// /// /// Thrown when fails to make API call @@ -658,6 +679,78 @@ namespace Org.OpenAPITools.Api (string) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); } + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + public void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + { + TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + + var localVarPath = "/fake/body-with-file-schema"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter + } + else + { + localVarPostBody = fileSchemaTestClass; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + /// /// /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/PetApi.cs index c7aa7e2f655..ca532940cf0 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Api/PetApi.cs @@ -202,6 +202,31 @@ namespace Org.OpenAPITools.Api /// file to upload (optional) /// ApiResponse of ApiResponse ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); #endregion Synchronous Operations } @@ -907,5 +932,87 @@ namespace Org.OpenAPITools.Api (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); } + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + public ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + ApiResponse localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + public ApiResponse< ApiResponse > UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + var localVarPath = "/fake/{petId}/uploadImageWithRequiredFile"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "multipart/form-data" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter + if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumArrays.cs index ba25e777563..567a207068c 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -36,18 +36,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum JustSymbolEnum { - /// /// Enum GreaterThanOrEqualTo for value: >= /// [EnumMember(Value = ">=")] GreaterThanOrEqualTo = 1, - + /// /// Enum Dollar for value: $ /// [EnumMember(Value = "$")] Dollar = 2 + } /// @@ -61,18 +61,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum ArrayEnumEnum { - /// /// Enum Fish for value: fish /// [EnumMember(Value = "fish")] Fish = 1, - + /// /// Enum Crab for value: crab /// [EnumMember(Value = "crab")] Crab = 2 + } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumClass.cs index 3da1bee1360..33643e475f5 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumClass.cs @@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model public enum EnumClass { - /// /// Enum Abc for value: _abc /// [EnumMember(Value = "_abc")] Abc = 1, - + /// /// Enum Efg for value: -efg /// [EnumMember(Value = "-efg")] Efg = 2, - + /// /// Enum Xyz for value: (xyz) /// [EnumMember(Value = "(xyz)")] Xyz = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumTest.cs index 663d01a2b23..7099a980016 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/EnumTest.cs @@ -36,24 +36,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -67,24 +67,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringRequiredEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -97,18 +97,16 @@ namespace Org.OpenAPITools.Model /// public enum EnumIntegerEnum { - /// /// Enum NUMBER_1 for value: 1 /// - NUMBER_1 = 1, - + /// /// Enum NUMBER_MINUS_1 for value: -1 /// - NUMBER_MINUS_1 = -1 + } /// @@ -122,18 +120,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum EnumNumberEnum { - /// /// Enum NUMBER_1_DOT_1 for value: 1.1 /// [EnumMember(Value = "1.1")] NUMBER_1_DOT_1 = 1, - + /// /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 /// [EnumMember(Value = "-1.2")] NUMBER_MINUS_1_DOT_2 = 2 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 00000000000..68d564d17e7 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/File.cs @@ -0,0 +1,125 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// Must be named `File` for test. + /// + [DataContract] + public partial class File : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Test capitalization. + public File(string sourceURI = default(string)) + { + this.SourceURI = sourceURI; + } + + /// + /// Test capitalization + /// + /// Test capitalization + [DataMember(Name="sourceURI", EmitDefaultValue=false)] + public string SourceURI { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class File {\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as File); + } + + /// + /// Returns true if File instances are equal + /// + /// Instance of File to be compared + /// Boolean + public bool Equals(File input) + { + if (input == null) + return false; + + return + ( + this.SourceURI == input.SourceURI || + (this.SourceURI != null && + this.SourceURI.Equals(input.SourceURI)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceURI != null) + hashCode = hashCode * 59 + this.SourceURI.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 00000000000..1505ab9c4b1 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -0,0 +1,140 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + [DataContract] + public partial class FileSchemaTestClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// file. + /// files. + public FileSchemaTestClass(System.IO.Stream file = default(System.IO.Stream), List files = default(List)) + { + this.File = file; + this.Files = files; + } + + /// + /// Gets or Sets File + /// + [DataMember(Name="file", EmitDefaultValue=false)] + public System.IO.Stream File { get; set; } + + /// + /// Gets or Sets Files + /// + [DataMember(Name="files", EmitDefaultValue=false)] + public List Files { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class FileSchemaTestClass {\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append(" Files: ").Append(Files).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FileSchemaTestClass); + } + + /// + /// Returns true if FileSchemaTestClass instances are equal + /// + /// Instance of FileSchemaTestClass to be compared + /// Boolean + public bool Equals(FileSchemaTestClass input) + { + if (input == null) + return false; + + return + ( + this.File == input.File || + (this.File != null && + this.File.Equals(input.File)) + ) && + ( + this.Files == input.Files || + this.Files != null && + this.Files.SequenceEqual(input.Files) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.File != null) + hashCode = hashCode * 59 + this.File.GetHashCode(); + if (this.Files != null) + hashCode = hashCode * 59 + this.Files.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs index 25c03006706..1c5bfa70198 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/MapTest.cs @@ -36,18 +36,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum InnerEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2 + } @@ -61,10 +61,14 @@ namespace Org.OpenAPITools.Model /// /// mapMapOfString. /// mapOfEnumString. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary)) + /// directMap. + /// indirectMap. + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; + this.DirectMap = directMap; + this.IndirectMap = indirectMap; } /// @@ -74,6 +78,18 @@ namespace Org.OpenAPITools.Model public Dictionary> MapMapOfString { get; set; } + /// + /// Gets or Sets DirectMap + /// + [DataMember(Name="direct_map", EmitDefaultValue=false)] + public Dictionary DirectMap { get; set; } + + /// + /// Gets or Sets IndirectMap + /// + [DataMember(Name="indirect_map", EmitDefaultValue=false)] + public StringBooleanMap IndirectMap { get; set; } + /// /// Returns the string presentation of the object /// @@ -84,6 +100,8 @@ namespace Org.OpenAPITools.Model sb.Append("class MapTest {\n"); sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); + sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -127,6 +145,16 @@ namespace Org.OpenAPITools.Model this.MapOfEnumString == input.MapOfEnumString || this.MapOfEnumString != null && this.MapOfEnumString.SequenceEqual(input.MapOfEnumString) + ) && + ( + this.DirectMap == input.DirectMap || + this.DirectMap != null && + this.DirectMap.SequenceEqual(input.DirectMap) + ) && + ( + this.IndirectMap == input.IndirectMap || + (this.IndirectMap != null && + this.IndirectMap.Equals(input.IndirectMap)) ); } @@ -143,6 +171,10 @@ namespace Org.OpenAPITools.Model hashCode = hashCode * 59 + this.MapMapOfString.GetHashCode(); if (this.MapOfEnumString != null) hashCode = hashCode * 59 + this.MapOfEnumString.GetHashCode(); + if (this.DirectMap != null) + hashCode = hashCode * 59 + this.DirectMap.GetHashCode(); + if (this.IndirectMap != null) + hashCode = hashCode * 59 + this.IndirectMap.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Order.cs index 27863dccbae..f895f035192 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Order.cs @@ -37,24 +37,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/OuterEnum.cs index 2716692ee0e..be116aff60a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -32,24 +32,24 @@ namespace Org.OpenAPITools.Model public enum OuterEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Pet.cs index 02628fcf124..1e213e5006a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/Pet.cs @@ -37,24 +37,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Available for value: available /// [EnumMember(Value = "available")] Available = 1, - + /// /// Enum Pending for value: pending /// [EnumMember(Value = "pending")] Pending = 2, - + /// /// Enum Sold for value: sold /// [EnumMember(Value = "sold")] Sold = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/StringBooleanMap.cs b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/StringBooleanMap.cs new file mode 100644 index 00000000000..df4dc6e486d --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNet40/src/Org.OpenAPITools/Model/StringBooleanMap.cs @@ -0,0 +1,110 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// StringBooleanMap + /// + [DataContract] + public partial class StringBooleanMap : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public StringBooleanMap() : base() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class StringBooleanMap {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as StringBooleanMap); + } + + /// + /// Returns true if StringBooleanMap instances are equal + /// + /// Instance of StringBooleanMap to be compared + /// Boolean + public bool Equals(StringBooleanMap input) + { + if (input == null) + return false; + + return base.Equals(input); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + return hashCode; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/README.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/README.md index 2676c56acc9..e5a4fcea2ec 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/README.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/README.md @@ -54,12 +54,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } @@ -74,11 +74,12 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*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 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -94,6 +95,7 @@ Class | Method | HTTP request | Description *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 @@ -126,6 +128,8 @@ Class | Method | HTTP request | Description - [Model.EnumArrays](docs/EnumArrays.md) - [Model.EnumClass](docs/EnumClass.md) - [Model.EnumTest](docs/EnumTest.md) + - [Model.File](docs/File.md) + - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.List](docs/List.md) @@ -142,6 +146,7 @@ Class | Method | HTTP request | Description - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Model.Return](docs/Return.md) - [Model.SpecialModelName](docs/SpecialModelName.md) + - [Model.StringBooleanMap](docs/StringBooleanMap.md) - [Model.Tag](docs/Tag.md) - [Model.User](docs/User.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/AnotherFakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/AnotherFakeApi.md index 2dca444f276..81cc3106d64 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/AnotherFakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/AnotherFakeApi.md @@ -4,16 +4,16 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestSpecialTags**](AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +[**Call123TestSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags - -# **TestSpecialTags** -> ModelClient TestSpecialTags (ModelClient modelClient) + +# **Call123TestSpecialTags** +> ModelClient Call123TestSpecialTags (ModelClient modelClient) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Example ```csharp @@ -25,7 +25,7 @@ using Org.OpenAPITools.Model; namespace Example { - public class TestSpecialTagsExample + public class Call123TestSpecialTagsExample { public void main() { @@ -35,12 +35,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FakeApi.md index 2a4fb6094ae..d51d29c09a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**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 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -159,7 +160,7 @@ namespace Example public void main() { var apiInstance = new FakeApi(); - var body = 1.2; // decimal? | Input number as post body (optional) + var body = 1.2D; // decimal? | Input number as post body (optional) try { @@ -256,6 +257,65 @@ No authorization required [[Back to top]](#) [[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** +> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithFileSchemaExample + { + public void main() + { + var apiInstance = new FakeApi(); + var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(fileSchemaTestClass); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**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** > void TestBodyWithQueryParams (string query, User user) @@ -404,13 +464,13 @@ namespace Example var apiInstance = new FakeApi(); var number = 8.14; // decimal? | None - var _double = 1.2; // double? | None + var _double = 1.2D; // double? | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None var integer = 56; // int? | None (optional) var int32 = 56; // int? | None (optional) var int64 = 789; // long? | None (optional) - var _float = 3.4; // float? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) var date = 2013-10-20; // DateTime? | None (optional) @@ -494,8 +554,8 @@ namespace Example var enumQueryStringArray = enumQueryStringArray_example; // List | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2; // double? | Query parameter enum test (double) (optional) - var enumFormStringArray = enumFormStringArray_example; // List | Form parameter enum test (string array) (optional) (default to $) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) + var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) try @@ -522,7 +582,7 @@ Name | Type | Description | Notes **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** | **List<string>**| Form parameter enum test (string array) | [optional] [default to $] + **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/File.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/File.md new file mode 100644 index 00000000000..acf85a4c001 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/File.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.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/csharp/OpenAPIClientNetStandard/docs/FileSchemaTestClass.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..e0820fa4e65 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/FileSchemaTestClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | **System.IO.Stream** | | [optional] +**Files** | **List<System.IO.Stream>** | | [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/csharp/OpenAPIClientNetStandard/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md index 2baba08d855..ee62dbf135f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/MapTest.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] +**DirectMap** | **Dictionary<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/csharp/OpenAPIClientNetStandard/docs/PetApi.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/PetApi.md index 244ece53a31..dd23df9b368 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/PetApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/PetApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**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) @@ -524,3 +525,69 @@ Name | Type | Description | Notes [[Back to top]](#) [[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** +> ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + +uploads an image (required) + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileWithRequiredFileExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to update + var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload + var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) + + try + { + // uploads an image (required) + ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to update | + **requiredFile** | **System.IO.Stream**| 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/csharp/OpenAPIClientNetStandard/docs/StringBooleanMap.md b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/StringBooleanMap.md new file mode 100644 index 00000000000..6e7a71368df --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/docs/StringBooleanMap.md @@ -0,0 +1,8 @@ +# Org.OpenAPITools.Model.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/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index 586ead5d200..57dcf5ca7b3 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -28,46 +28,46 @@ namespace Org.OpenAPITools.Api /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - ModelClient TestSpecialTags (ModelClient modelClient); + ModelClient Call123TestSpecialTags (ModelClient modelClient); /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - ApiResponse TestSpecialTagsWithHttpInfo (ModelClient modelClient); + ApiResponse Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient); #endregion Synchronous Operations #region Asynchronous Operations /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ModelClient - System.Threading.Tasks.Task TestSpecialTagsAsync (ModelClient modelClient); + System.Threading.Tasks.Task Call123TestSpecialTagsAsync (ModelClient modelClient); /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient); + System.Threading.Tasks.Task> Call123TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient); #endregion Asynchronous Operations } @@ -169,28 +169,28 @@ namespace Org.OpenAPITools.Api } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - public ModelClient TestSpecialTags (ModelClient modelClient) + public ModelClient Call123TestSpecialTags (ModelClient modelClient) { - ApiResponse localVarResponse = TestSpecialTagsWithHttpInfo(modelClient); + ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient); return localVarResponse.Data; } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient modelClient) + public ApiResponse< ModelClient > Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient) { // verify the required parameter 'modelClient' is set if (modelClient == null) - throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags"); + throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); var localVarPath = "./another-fake/dummy"; var localVarPathParams = new Dictionary(); @@ -233,7 +233,7 @@ namespace Org.OpenAPITools.Api if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); + Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse); if (exception != null) throw exception; } @@ -243,29 +243,29 @@ namespace Org.OpenAPITools.Api } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ModelClient - public async System.Threading.Tasks.Task TestSpecialTagsAsync (ModelClient modelClient) + public async System.Threading.Tasks.Task Call123TestSpecialTagsAsync (ModelClient modelClient) { - ApiResponse localVarResponse = await TestSpecialTagsAsyncWithHttpInfo(modelClient); + ApiResponse localVarResponse = await Call123TestSpecialTagsAsyncWithHttpInfo(modelClient); return localVarResponse.Data; } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient) + public async System.Threading.Tasks.Task> Call123TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient) { // verify the required parameter 'modelClient' is set if (modelClient == null) - throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags"); + throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); var localVarPath = "./another-fake/dummy"; var localVarPathParams = new Dictionary(); @@ -308,7 +308,7 @@ namespace Org.OpenAPITools.Api if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); + Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse); if (exception != null) throw exception; } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs index 234c794dd41..da68811f95a 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/FakeApi.cs @@ -112,6 +112,27 @@ namespace Org.OpenAPITools.Api /// /// /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass); + /// + /// + /// + /// /// /// /// Thrown when fails to make API call @@ -368,6 +389,27 @@ namespace Org.OpenAPITools.Api /// /// /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of void + System.Threading.Tasks.Task TestBodyWithFileSchemaAsync (FileSchemaTestClass fileSchemaTestClass); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse + System.Threading.Tasks.Task> TestBodyWithFileSchemaAsyncWithHttpInfo (FileSchemaTestClass fileSchemaTestClass); + /// + /// + /// + /// /// /// /// Thrown when fails to make API call @@ -1198,6 +1240,151 @@ namespace Org.OpenAPITools.Api (string) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); } + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + public void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + { + TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + + var localVarPath = "./fake/body-with-file-schema"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter + } + else + { + localVarPostBody = fileSchemaTestClass; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + null); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of void + public async System.Threading.Tasks.Task TestBodyWithFileSchemaAsync (FileSchemaTestClass fileSchemaTestClass) + { + await TestBodyWithFileSchemaAsyncWithHttpInfo(fileSchemaTestClass); + + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestBodyWithFileSchemaAsyncWithHttpInfo (FileSchemaTestClass fileSchemaTestClass) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + + var localVarPath = "./fake/body-with-file-schema"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter + } + else + { + localVarPostBody = fileSchemaTestClass; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + null); + } + /// /// /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/PetApi.cs index f34cfb4d6a3..e07717ae436 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Api/PetApi.cs @@ -202,6 +202,31 @@ namespace Org.OpenAPITools.Api /// file to upload (optional) /// ApiResponse of ApiResponse ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); #endregion Synchronous Operations #region Asynchronous Operations /// @@ -382,6 +407,31 @@ namespace Org.OpenAPITools.Api /// file to upload (optional) /// Task of ApiResponse (ApiResponse) System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse + System.Threading.Tasks.Task UploadFileWithRequiredFileAsync (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse (ApiResponse) + System.Threading.Tasks.Task> UploadFileWithRequiredFileAsyncWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); #endregion Asynchronous Operations } @@ -1700,5 +1750,170 @@ namespace Org.OpenAPITools.Api (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); } + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + public ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + ApiResponse localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + public ApiResponse< ApiResponse > UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + var localVarPath = "./fake/{petId}/uploadImageWithRequiredFile"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "multipart/form-data" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter + if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse + public async System.Threading.Tasks.Task UploadFileWithRequiredFileAsync (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + ApiResponse localVarResponse = await UploadFileWithRequiredFileAsyncWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse (ApiResponse) + public async System.Threading.Tasks.Task> UploadFileWithRequiredFileAsyncWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + var localVarPath = "./fake/{petId}/uploadImageWithRequiredFile"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "multipart/form-data" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter + if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumArrays.cs index 26c4194396d..7490299730c 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -34,18 +34,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum JustSymbolEnum { - /// /// Enum GreaterThanOrEqualTo for value: >= /// [EnumMember(Value = ">=")] GreaterThanOrEqualTo = 1, - + /// /// Enum Dollar for value: $ /// [EnumMember(Value = "$")] Dollar = 2 + } /// @@ -59,18 +59,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum ArrayEnumEnum { - /// /// Enum Fish for value: fish /// [EnumMember(Value = "fish")] Fish = 1, - + /// /// Enum Crab for value: crab /// [EnumMember(Value = "crab")] Crab = 2 + } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumClass.cs index 8065505fd74..cfeef31c19c 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumClass.cs @@ -30,24 +30,24 @@ namespace Org.OpenAPITools.Model public enum EnumClass { - /// /// Enum Abc for value: _abc /// [EnumMember(Value = "_abc")] Abc = 1, - + /// /// Enum Efg for value: -efg /// [EnumMember(Value = "-efg")] Efg = 2, - + /// /// Enum Xyz for value: (xyz) /// [EnumMember(Value = "(xyz)")] Xyz = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumTest.cs index d148da13222..17d1f39b2be 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/EnumTest.cs @@ -34,24 +34,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -65,24 +65,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringRequiredEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -95,18 +95,16 @@ namespace Org.OpenAPITools.Model /// public enum EnumIntegerEnum { - /// /// Enum NUMBER_1 for value: 1 /// - NUMBER_1 = 1, - + /// /// Enum NUMBER_MINUS_1 for value: -1 /// - NUMBER_MINUS_1 = -1 + } /// @@ -120,18 +118,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum EnumNumberEnum { - /// /// Enum NUMBER_1_DOT_1 for value: 1.1 /// [EnumMember(Value = "1.1")] NUMBER_1_DOT_1 = 1, - + /// /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 /// [EnumMember(Value = "-1.2")] NUMBER_MINUS_1_DOT_2 = 2 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 00000000000..e9addc9d7e5 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/File.cs @@ -0,0 +1,113 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// Must be named `File` for test. + /// + [DataContract] + public partial class File : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// Test capitalization. + public File(string sourceURI = default(string)) + { + this.SourceURI = sourceURI; + } + + /// + /// Test capitalization + /// + /// Test capitalization + [DataMember(Name="sourceURI", EmitDefaultValue=false)] + public string SourceURI { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class File {\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as File); + } + + /// + /// Returns true if File instances are equal + /// + /// Instance of File to be compared + /// Boolean + public bool Equals(File input) + { + if (input == null) + return false; + + return + ( + this.SourceURI == input.SourceURI || + (this.SourceURI != null && + this.SourceURI.Equals(input.SourceURI)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceURI != null) + hashCode = hashCode * 59 + this.SourceURI.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 00000000000..543cf492626 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -0,0 +1,128 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + [DataContract] + public partial class FileSchemaTestClass : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// file. + /// files. + public FileSchemaTestClass(System.IO.Stream file = default(System.IO.Stream), List files = default(List)) + { + this.File = file; + this.Files = files; + } + + /// + /// Gets or Sets File + /// + [DataMember(Name="file", EmitDefaultValue=false)] + public System.IO.Stream File { get; set; } + + /// + /// Gets or Sets Files + /// + [DataMember(Name="files", EmitDefaultValue=false)] + public List Files { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class FileSchemaTestClass {\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append(" Files: ").Append(Files).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FileSchemaTestClass); + } + + /// + /// Returns true if FileSchemaTestClass instances are equal + /// + /// Instance of FileSchemaTestClass to be compared + /// Boolean + public bool Equals(FileSchemaTestClass input) + { + if (input == null) + return false; + + return + ( + this.File == input.File || + (this.File != null && + this.File.Equals(input.File)) + ) && + ( + this.Files == input.Files || + this.Files != null && + this.Files.SequenceEqual(input.Files) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.File != null) + hashCode = hashCode * 59 + this.File.GetHashCode(); + if (this.Files != null) + hashCode = hashCode * 59 + this.Files.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs index 1ccbdba8adf..18ccbc3ba9b 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/MapTest.cs @@ -34,18 +34,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum InnerEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2 + } @@ -59,10 +59,14 @@ namespace Org.OpenAPITools.Model /// /// mapMapOfString. /// mapOfEnumString. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary)) + /// directMap. + /// indirectMap. + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; + this.DirectMap = directMap; + this.IndirectMap = indirectMap; } /// @@ -72,6 +76,18 @@ namespace Org.OpenAPITools.Model public Dictionary> MapMapOfString { get; set; } + /// + /// Gets or Sets DirectMap + /// + [DataMember(Name="direct_map", EmitDefaultValue=false)] + public Dictionary DirectMap { get; set; } + + /// + /// Gets or Sets IndirectMap + /// + [DataMember(Name="indirect_map", EmitDefaultValue=false)] + public StringBooleanMap IndirectMap { get; set; } + /// /// Returns the string presentation of the object /// @@ -82,6 +98,8 @@ namespace Org.OpenAPITools.Model sb.Append("class MapTest {\n"); sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); + sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -125,6 +143,16 @@ namespace Org.OpenAPITools.Model this.MapOfEnumString == input.MapOfEnumString || this.MapOfEnumString != null && this.MapOfEnumString.SequenceEqual(input.MapOfEnumString) + ) && + ( + this.DirectMap == input.DirectMap || + this.DirectMap != null && + this.DirectMap.SequenceEqual(input.DirectMap) + ) && + ( + this.IndirectMap == input.IndirectMap || + (this.IndirectMap != null && + this.IndirectMap.Equals(input.IndirectMap)) ); } @@ -141,6 +169,10 @@ namespace Org.OpenAPITools.Model hashCode = hashCode * 59 + this.MapMapOfString.GetHashCode(); if (this.MapOfEnumString != null) hashCode = hashCode * 59 + this.MapOfEnumString.GetHashCode(); + if (this.DirectMap != null) + hashCode = hashCode * 59 + this.DirectMap.GetHashCode(); + if (this.IndirectMap != null) + hashCode = hashCode * 59 + this.IndirectMap.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Order.cs index ef1160318b2..713657125c6 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Order.cs @@ -35,24 +35,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/OuterEnum.cs index e465b750cab..cdf6a7e9161 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -30,24 +30,24 @@ namespace Org.OpenAPITools.Model public enum OuterEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Pet.cs index 446d6e7971b..e3951fa6681 100644 --- a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/Pet.cs @@ -35,24 +35,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Available for value: available /// [EnumMember(Value = "available")] Available = 1, - + /// /// Enum Pending for value: pending /// [EnumMember(Value = "pending")] Pending = 2, - + /// /// Enum Sold for value: sold /// [EnumMember(Value = "sold")] Sold = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/StringBooleanMap.cs b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/StringBooleanMap.cs new file mode 100644 index 00000000000..ac60f8efc44 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientNetStandard/src/Org.OpenAPITools/Model/StringBooleanMap.cs @@ -0,0 +1,98 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// StringBooleanMap + /// + [DataContract] + public partial class StringBooleanMap : Dictionary, IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public StringBooleanMap() : base() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class StringBooleanMap {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as StringBooleanMap); + } + + /// + /// Returns true if StringBooleanMap instances are equal + /// + /// Instance of StringBooleanMap to be compared + /// Boolean + public bool Equals(StringBooleanMap input) + { + if (input == null) + return false; + + return base.Equals(input); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + return hashCode; + } + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/README.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/README.md index 441abc40881..a2b8a9b17a0 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/README.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/README.md @@ -76,12 +76,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } @@ -96,11 +96,12 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +*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 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -116,6 +117,7 @@ Class | Method | HTTP request | Description *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 @@ -148,6 +150,8 @@ Class | Method | HTTP request | Description - [Model.EnumArrays](docs/EnumArrays.md) - [Model.EnumClass](docs/EnumClass.md) - [Model.EnumTest](docs/EnumTest.md) + - [Model.File](docs/File.md) + - [Model.FileSchemaTestClass](docs/FileSchemaTestClass.md) - [Model.FormatTest](docs/FormatTest.md) - [Model.HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [Model.List](docs/List.md) @@ -164,6 +168,7 @@ Class | Method | HTTP request | Description - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Model.Return](docs/Return.md) - [Model.SpecialModelName](docs/SpecialModelName.md) + - [Model.StringBooleanMap](docs/StringBooleanMap.md) - [Model.Tag](docs/Tag.md) - [Model.User](docs/User.md) diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/AnotherFakeApi.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/AnotherFakeApi.md index 2dca444f276..81cc3106d64 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/AnotherFakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/AnotherFakeApi.md @@ -4,16 +4,16 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestSpecialTags**](AnotherFakeApi.md#testspecialtags) | **PATCH** /another-fake/dummy | To test special tags +[**Call123TestSpecialTags**](AnotherFakeApi.md#call123testspecialtags) | **PATCH** /another-fake/dummy | To test special tags - -# **TestSpecialTags** -> ModelClient TestSpecialTags (ModelClient modelClient) + +# **Call123TestSpecialTags** +> ModelClient Call123TestSpecialTags (ModelClient modelClient) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Example ```csharp @@ -25,7 +25,7 @@ using Org.OpenAPITools.Model; namespace Example { - public class TestSpecialTagsExample + public class Call123TestSpecialTagsExample { public void main() { @@ -35,12 +35,12 @@ namespace Example try { // To test special tags - ModelClient result = apiInstance.TestSpecialTags(modelClient); + ModelClient result = apiInstance.Call123TestSpecialTags(modelClient); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling AnotherFakeApi.TestSpecialTags: " + e.Message ); + Debug.Print("Exception when calling AnotherFakeApi.Call123TestSpecialTags: " + e.Message ); } } } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FakeApi.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FakeApi.md index 2a4fb6094ae..d51d29c09a6 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FakeApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FakeApi.md @@ -8,6 +8,7 @@ Method | HTTP request | Description [**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 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -159,7 +160,7 @@ namespace Example public void main() { var apiInstance = new FakeApi(); - var body = 1.2; // decimal? | Input number as post body (optional) + var body = 1.2D; // decimal? | Input number as post body (optional) try { @@ -256,6 +257,65 @@ No authorization required [[Back to top]](#) [[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** +> void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class TestBodyWithFileSchemaExample + { + public void main() + { + var apiInstance = new FakeApi(); + var fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | + + try + { + apiInstance.TestBodyWithFileSchema(fileSchemaTestClass); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.TestBodyWithFileSchema: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**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** > void TestBodyWithQueryParams (string query, User user) @@ -404,13 +464,13 @@ namespace Example var apiInstance = new FakeApi(); var number = 8.14; // decimal? | None - var _double = 1.2; // double? | None + var _double = 1.2D; // double? | None var patternWithoutDelimiter = patternWithoutDelimiter_example; // string | None var _byte = BYTE_ARRAY_DATA_HERE; // byte[] | None var integer = 56; // int? | None (optional) var int32 = 56; // int? | None (optional) var int64 = 789; // long? | None (optional) - var _float = 3.4; // float? | None (optional) + var _float = 3.4F; // float? | None (optional) var _string = _string_example; // string | None (optional) var binary = BINARY_DATA_HERE; // System.IO.Stream | None (optional) var date = 2013-10-20; // DateTime? | None (optional) @@ -494,8 +554,8 @@ namespace Example var enumQueryStringArray = enumQueryStringArray_example; // List | Query parameter enum test (string array) (optional) var enumQueryString = enumQueryString_example; // string | Query parameter enum test (string) (optional) (default to -efg) var enumQueryInteger = 56; // int? | Query parameter enum test (double) (optional) - var enumQueryDouble = 1.2; // double? | Query parameter enum test (double) (optional) - var enumFormStringArray = enumFormStringArray_example; // List | Form parameter enum test (string array) (optional) (default to $) + var enumQueryDouble = 1.2D; // double? | Query parameter enum test (double) (optional) + var enumFormStringArray = new List(); // List | Form parameter enum test (string array) (optional) (default to $) var enumFormString = enumFormString_example; // string | Form parameter enum test (string) (optional) (default to -efg) try @@ -522,7 +582,7 @@ Name | Type | Description | Notes **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** | **List<string>**| Form parameter enum test (string array) | [optional] [default to $] + **enumFormStringArray** | [**List<string>**](string.md)| Form parameter enum test (string array) | [optional] [default to $] **enumFormString** | **string**| Form parameter enum test (string) | [optional] [default to -efg] ### Return type diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/File.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/File.md new file mode 100644 index 00000000000..acf85a4c001 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/File.md @@ -0,0 +1,9 @@ +# Org.OpenAPITools.Model.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/csharp/OpenAPIClientWithPropertyChanged/docs/FileSchemaTestClass.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..e0820fa4e65 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/FileSchemaTestClass.md @@ -0,0 +1,10 @@ +# Org.OpenAPITools.Model.FileSchemaTestClass +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**File** | **System.IO.Stream** | | [optional] +**Files** | **List<System.IO.Stream>** | | [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/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md index 2baba08d855..ee62dbf135f 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/MapTest.md @@ -5,6 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **MapMapOfString** | **Dictionary<string, Dictionary<string, string>>** | | [optional] **MapOfEnumString** | **Dictionary<string, string>** | | [optional] +**DirectMap** | **Dictionary<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/csharp/OpenAPIClientWithPropertyChanged/docs/PetApi.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/PetApi.md index 244ece53a31..dd23df9b368 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/PetApi.md +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/PetApi.md @@ -12,6 +12,7 @@ Method | HTTP request | Description [**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) @@ -524,3 +525,69 @@ Name | Type | Description | Notes [[Back to top]](#) [[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** +> ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + +uploads an image (required) + +### Example +```csharp +using System; +using System.Diagnostics; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Client; +using Org.OpenAPITools.Model; + +namespace Example +{ + public class UploadFileWithRequiredFileExample + { + public void main() + { + // Configure OAuth2 access token for authorization: petstore_auth + Configuration.Default.AccessToken = "YOUR_ACCESS_TOKEN"; + + var apiInstance = new PetApi(); + var petId = 789; // long? | ID of pet to update + var requiredFile = BINARY_DATA_HERE; // System.IO.Stream | file to upload + var additionalMetadata = additionalMetadata_example; // string | Additional data to pass to server (optional) + + try + { + // uploads an image (required) + ApiResponse result = apiInstance.UploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling PetApi.UploadFileWithRequiredFile: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **long?**| ID of pet to update | + **requiredFile** | **System.IO.Stream**| 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/csharp/OpenAPIClientWithPropertyChanged/docs/StringBooleanMap.md b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/StringBooleanMap.md new file mode 100644 index 00000000000..6e7a71368df --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/docs/StringBooleanMap.md @@ -0,0 +1,8 @@ +# Org.OpenAPITools.Model.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/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs new file mode 100644 index 00000000000..bb47c43dc7a --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileSchemaTestClassTests.cs @@ -0,0 +1,88 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing FileSchemaTestClass + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FileSchemaTestClassTests + { + // TODO uncomment below to declare an instance variable for FileSchemaTestClass + //private FileSchemaTestClass instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of FileSchemaTestClass + //instance = new FileSchemaTestClass(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of FileSchemaTestClass + /// + [Test] + public void FileSchemaTestClassInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" FileSchemaTestClass + //Assert.IsInstanceOfType (instance, "variable 'instance' is a FileSchemaTestClass"); + } + + + /// + /// Test the property 'File' + /// + [Test] + public void FileTest() + { + // TODO unit test for the property 'File' + } + /// + /// Test the property 'Files' + /// + [Test] + public void FilesTest() + { + // TODO unit test for the property 'Files' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileTests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileTests.cs new file mode 100644 index 00000000000..f1cf54c22e4 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/FileTests.cs @@ -0,0 +1,80 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing File + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class FileTests + { + // TODO uncomment below to declare an instance variable for File + //private File instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of File + //instance = new File(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of File + /// + [Test] + public void FileInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" File + //Assert.IsInstanceOfType (instance, "variable 'instance' is a File"); + } + + + /// + /// Test the property 'SourceURI' + /// + [Test] + public void SourceURITest() + { + // TODO unit test for the property 'SourceURI' + } + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs new file mode 100644 index 00000000000..efc4cd90773 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools.Test/Model/StringBooleanMapTests.cs @@ -0,0 +1,72 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +using Org.OpenAPITools.Client; +using System.Reflection; +using Newtonsoft.Json; + +namespace Org.OpenAPITools.Test +{ + /// + /// Class for testing StringBooleanMap + /// + /// + /// This file is automatically generated by OpenAPI Generator (https://openapi-generator.tech). + /// Please update the test case below to test the model. + /// + [TestFixture] + public class StringBooleanMapTests + { + // TODO uncomment below to declare an instance variable for StringBooleanMap + //private StringBooleanMap instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of StringBooleanMap + //instance = new StringBooleanMap(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of StringBooleanMap + /// + [Test] + public void StringBooleanMapInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" StringBooleanMap + //Assert.IsInstanceOfType (instance, "variable 'instance' is a StringBooleanMap"); + } + + + + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/AnotherFakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/AnotherFakeApi.cs index a636d07b721..aacccf92ca5 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/AnotherFakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/AnotherFakeApi.cs @@ -28,46 +28,46 @@ namespace Org.OpenAPITools.Api /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - ModelClient TestSpecialTags (ModelClient modelClient); + ModelClient Call123TestSpecialTags (ModelClient modelClient); /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - ApiResponse TestSpecialTagsWithHttpInfo (ModelClient modelClient); + ApiResponse Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient); #endregion Synchronous Operations #region Asynchronous Operations /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ModelClient - System.Threading.Tasks.Task TestSpecialTagsAsync (ModelClient modelClient); + System.Threading.Tasks.Task Call123TestSpecialTagsAsync (ModelClient modelClient); /// /// To test special tags /// /// - /// To test special tags + /// To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ApiResponse (ModelClient) - System.Threading.Tasks.Task> TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient); + System.Threading.Tasks.Task> Call123TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient); #endregion Asynchronous Operations } @@ -169,28 +169,28 @@ namespace Org.OpenAPITools.Api } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ModelClient - public ModelClient TestSpecialTags (ModelClient modelClient) + public ModelClient Call123TestSpecialTags (ModelClient modelClient) { - ApiResponse localVarResponse = TestSpecialTagsWithHttpInfo(modelClient); + ApiResponse localVarResponse = Call123TestSpecialTagsWithHttpInfo(modelClient); return localVarResponse.Data; } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// ApiResponse of ModelClient - public ApiResponse< ModelClient > TestSpecialTagsWithHttpInfo (ModelClient modelClient) + public ApiResponse< ModelClient > Call123TestSpecialTagsWithHttpInfo (ModelClient modelClient) { // verify the required parameter 'modelClient' is set if (modelClient == null) - throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags"); + throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); var localVarPath = "/another-fake/dummy"; var localVarPathParams = new Dictionary(); @@ -233,7 +233,7 @@ namespace Org.OpenAPITools.Api if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); + Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse); if (exception != null) throw exception; } @@ -243,29 +243,29 @@ namespace Org.OpenAPITools.Api } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ModelClient - public async System.Threading.Tasks.Task TestSpecialTagsAsync (ModelClient modelClient) + public async System.Threading.Tasks.Task Call123TestSpecialTagsAsync (ModelClient modelClient) { - ApiResponse localVarResponse = await TestSpecialTagsAsyncWithHttpInfo(modelClient); + ApiResponse localVarResponse = await Call123TestSpecialTagsAsyncWithHttpInfo(modelClient); return localVarResponse.Data; } /// - /// To test special tags To test special tags + /// To test special tags To test special tags and operation ID starting with number /// /// Thrown when fails to make API call /// client model /// Task of ApiResponse (ModelClient) - public async System.Threading.Tasks.Task> TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient) + public async System.Threading.Tasks.Task> Call123TestSpecialTagsAsyncWithHttpInfo (ModelClient modelClient) { // verify the required parameter 'modelClient' is set if (modelClient == null) - throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->TestSpecialTags"); + throw new ApiException(400, "Missing required parameter 'modelClient' when calling AnotherFakeApi->Call123TestSpecialTags"); var localVarPath = "/another-fake/dummy"; var localVarPathParams = new Dictionary(); @@ -308,7 +308,7 @@ namespace Org.OpenAPITools.Api if (ExceptionFactory != null) { - Exception exception = ExceptionFactory("TestSpecialTags", localVarResponse); + Exception exception = ExceptionFactory("Call123TestSpecialTags", localVarResponse); if (exception != null) throw exception; } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs index 8974ba42570..60e219ead9d 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/FakeApi.cs @@ -112,6 +112,27 @@ namespace Org.OpenAPITools.Api /// /// /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass); + /// + /// + /// + /// /// /// /// Thrown when fails to make API call @@ -368,6 +389,27 @@ namespace Org.OpenAPITools.Api /// /// /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of void + System.Threading.Tasks.Task TestBodyWithFileSchemaAsync (FileSchemaTestClass fileSchemaTestClass); + + /// + /// + /// + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse + System.Threading.Tasks.Task> TestBodyWithFileSchemaAsyncWithHttpInfo (FileSchemaTestClass fileSchemaTestClass); + /// + /// + /// + /// /// /// /// Thrown when fails to make API call @@ -1198,6 +1240,151 @@ namespace Org.OpenAPITools.Api (string) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(string))); } + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// + public void TestBodyWithFileSchema (FileSchemaTestClass fileSchemaTestClass) + { + TestBodyWithFileSchemaWithHttpInfo(fileSchemaTestClass); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// ApiResponse of Object(void) + public ApiResponse TestBodyWithFileSchemaWithHttpInfo (FileSchemaTestClass fileSchemaTestClass) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + + var localVarPath = "/fake/body-with-file-schema"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter + } + else + { + localVarPostBody = fileSchemaTestClass; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of void + public async System.Threading.Tasks.Task TestBodyWithFileSchemaAsync (FileSchemaTestClass fileSchemaTestClass) + { + await TestBodyWithFileSchemaAsyncWithHttpInfo(fileSchemaTestClass); + + } + + /// + /// For this test, the body for this request much reference a schema named `File`. + /// + /// Thrown when fails to make API call + /// + /// Task of ApiResponse + public async System.Threading.Tasks.Task> TestBodyWithFileSchemaAsyncWithHttpInfo (FileSchemaTestClass fileSchemaTestClass) + { + // verify the required parameter 'fileSchemaTestClass' is set + if (fileSchemaTestClass == null) + throw new ApiException(400, "Missing required parameter 'fileSchemaTestClass' when calling FakeApi->TestBodyWithFileSchema"); + + var localVarPath = "/fake/body-with-file-schema"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "application/json" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (fileSchemaTestClass != null && fileSchemaTestClass.GetType() != typeof(byte[])) + { + localVarPostBody = this.Configuration.ApiClient.Serialize(fileSchemaTestClass); // http body (model) parameter + } + else + { + localVarPostBody = fileSchemaTestClass; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.PUT, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("TestBodyWithFileSchema", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + null); + } + /// /// /// diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/PetApi.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/PetApi.cs index 9bfb712fd45..2fb6528b32e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/PetApi.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Api/PetApi.cs @@ -202,6 +202,31 @@ namespace Org.OpenAPITools.Api /// file to upload (optional) /// ApiResponse of ApiResponse ApiResponse UploadFileWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + ApiResponse UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); #endregion Synchronous Operations #region Asynchronous Operations /// @@ -382,6 +407,31 @@ namespace Org.OpenAPITools.Api /// file to upload (optional) /// Task of ApiResponse (ApiResponse) System.Threading.Tasks.Task> UploadFileAsyncWithHttpInfo (long? petId, string additionalMetadata = null, System.IO.Stream file = null); + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse + System.Threading.Tasks.Task UploadFileWithRequiredFileAsync (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); + + /// + /// uploads an image (required) + /// + /// + /// + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse (ApiResponse) + System.Threading.Tasks.Task> UploadFileWithRequiredFileAsyncWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null); #endregion Asynchronous Operations } @@ -1700,5 +1750,170 @@ namespace Org.OpenAPITools.Api (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); } + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse + public ApiResponse UploadFileWithRequiredFile (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + ApiResponse localVarResponse = UploadFileWithRequiredFileWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// ApiResponse of ApiResponse + public ApiResponse< ApiResponse > UploadFileWithRequiredFileWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + var localVarPath = "/fake/{petId}/uploadImageWithRequiredFile"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "multipart/form-data" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter + if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) this.Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse + public async System.Threading.Tasks.Task UploadFileWithRequiredFileAsync (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + ApiResponse localVarResponse = await UploadFileWithRequiredFileAsyncWithHttpInfo(petId, requiredFile, additionalMetadata); + return localVarResponse.Data; + + } + + /// + /// uploads an image (required) + /// + /// Thrown when fails to make API call + /// ID of pet to update + /// file to upload + /// Additional data to pass to server (optional) + /// Task of ApiResponse (ApiResponse) + public async System.Threading.Tasks.Task> UploadFileWithRequiredFileAsyncWithHttpInfo (long? petId, System.IO.Stream requiredFile, string additionalMetadata = null) + { + // verify the required parameter 'petId' is set + if (petId == null) + throw new ApiException(400, "Missing required parameter 'petId' when calling PetApi->UploadFileWithRequiredFile"); + // verify the required parameter 'requiredFile' is set + if (requiredFile == null) + throw new ApiException(400, "Missing required parameter 'requiredFile' when calling PetApi->UploadFileWithRequiredFile"); + + var localVarPath = "/fake/{petId}/uploadImageWithRequiredFile"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new List>(); + var localVarHeaderParams = new Dictionary(this.Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + "multipart/form-data" + }; + String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + "application/json" + }; + String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (petId != null) localVarPathParams.Add("petId", this.Configuration.ApiClient.ParameterToString(petId)); // path parameter + if (additionalMetadata != null) localVarFormParams.Add("additionalMetadata", this.Configuration.ApiClient.ParameterToString(additionalMetadata)); // form parameter + if (requiredFile != null) localVarFileParams.Add("requiredFile", this.Configuration.ApiClient.ParameterToFile("requiredFile", requiredFile)); + + // authentication (petstore_auth) required + // oauth required + if (!String.IsNullOrEmpty(this.Configuration.AccessToken)) + { + localVarHeaderParams["Authorization"] = "Bearer " + this.Configuration.AccessToken; + } + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await this.Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("UploadFileWithRequiredFile", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (ApiResponse) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(ApiResponse))); + } + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumArrays.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumArrays.cs index 84c963b541d..3e1da9ae80d 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumArrays.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumArrays.cs @@ -39,18 +39,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum JustSymbolEnum { - /// /// Enum GreaterThanOrEqualTo for value: >= /// [EnumMember(Value = ">=")] GreaterThanOrEqualTo = 1, - + /// /// Enum Dollar for value: $ /// [EnumMember(Value = "$")] Dollar = 2 + } /// @@ -64,18 +64,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum ArrayEnumEnum { - /// /// Enum Fish for value: fish /// [EnumMember(Value = "fish")] Fish = 1, - + /// /// Enum Crab for value: crab /// [EnumMember(Value = "crab")] Crab = 2 + } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumClass.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumClass.cs index d9646f5f98a..a5ba8367ede 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumClass.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumClass.cs @@ -34,24 +34,24 @@ namespace Org.OpenAPITools.Model public enum EnumClass { - /// /// Enum Abc for value: _abc /// [EnumMember(Value = "_abc")] Abc = 1, - + /// /// Enum Efg for value: -efg /// [EnumMember(Value = "-efg")] Efg = 2, - + /// /// Enum Xyz for value: (xyz) /// [EnumMember(Value = "(xyz)")] Xyz = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumTest.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumTest.cs index 3df03c5ce07..502347c7ec9 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/EnumTest.cs @@ -39,24 +39,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -70,24 +70,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum EnumStringRequiredEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2, - + /// /// Enum Empty for value: /// [EnumMember(Value = "")] Empty = 3 + } /// @@ -100,18 +100,16 @@ namespace Org.OpenAPITools.Model /// public enum EnumIntegerEnum { - /// /// Enum NUMBER_1 for value: 1 /// - NUMBER_1 = 1, - + /// /// Enum NUMBER_MINUS_1 for value: -1 /// - NUMBER_MINUS_1 = -1 + } /// @@ -125,18 +123,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum EnumNumberEnum { - /// /// Enum NUMBER_1_DOT_1 for value: 1.1 /// [EnumMember(Value = "1.1")] NUMBER_1_DOT_1 = 1, - + /// /// Enum NUMBER_MINUS_1_DOT_2 for value: -1.2 /// [EnumMember(Value = "-1.2")] NUMBER_MINUS_1_DOT_2 = 2 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/File.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/File.cs new file mode 100644 index 00000000000..685931366a4 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/File.cs @@ -0,0 +1,148 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// Must be named `File` for test. + /// + [DataContract] + [ImplementPropertyChanged] + public partial class File : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// Test capitalization. + public File(string sourceURI = default(string)) + { + this.SourceURI = sourceURI; + } + + /// + /// Test capitalization + /// + /// Test capitalization + [DataMember(Name="sourceURI", EmitDefaultValue=false)] + public string SourceURI { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class File {\n"); + sb.Append(" SourceURI: ").Append(SourceURI).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as File); + } + + /// + /// Returns true if File instances are equal + /// + /// Instance of File to be compared + /// Boolean + public bool Equals(File input) + { + if (input == null) + return false; + + return + ( + this.SourceURI == input.SourceURI || + (this.SourceURI != null && + this.SourceURI.Equals(input.SourceURI)) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.SourceURI != null) + hashCode = hashCode * 59 + this.SourceURI.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs new file mode 100644 index 00000000000..dc29a2ba878 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/FileSchemaTestClass.cs @@ -0,0 +1,163 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// FileSchemaTestClass + /// + [DataContract] + [ImplementPropertyChanged] + public partial class FileSchemaTestClass : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// file. + /// files. + public FileSchemaTestClass(System.IO.Stream file = default(System.IO.Stream), List files = default(List)) + { + this.File = file; + this.Files = files; + } + + /// + /// Gets or Sets File + /// + [DataMember(Name="file", EmitDefaultValue=false)] + public System.IO.Stream File { get; set; } + + /// + /// Gets or Sets Files + /// + [DataMember(Name="files", EmitDefaultValue=false)] + public List Files { get; set; } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class FileSchemaTestClass {\n"); + sb.Append(" File: ").Append(File).Append("\n"); + sb.Append(" Files: ").Append(Files).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as FileSchemaTestClass); + } + + /// + /// Returns true if FileSchemaTestClass instances are equal + /// + /// Instance of FileSchemaTestClass to be compared + /// Boolean + public bool Equals(FileSchemaTestClass input) + { + if (input == null) + return false; + + return + ( + this.File == input.File || + (this.File != null && + this.File.Equals(input.File)) + ) && + ( + this.Files == input.Files || + this.Files != null && + this.Files.SequenceEqual(input.Files) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + if (this.File != null) + hashCode = hashCode * 59 + this.File.GetHashCode(); + if (this.Files != null) + hashCode = hashCode * 59 + this.Files.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs index 3605af0dea1..ddaac33ee49 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/MapTest.cs @@ -39,18 +39,18 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum InnerEnum { - /// /// Enum UPPER for value: UPPER /// [EnumMember(Value = "UPPER")] UPPER = 1, - + /// /// Enum Lower for value: lower /// [EnumMember(Value = "lower")] Lower = 2 + } @@ -64,10 +64,14 @@ namespace Org.OpenAPITools.Model /// /// mapMapOfString. /// mapOfEnumString. - public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary)) + /// directMap. + /// indirectMap. + public MapTest(Dictionary> mapMapOfString = default(Dictionary>), Dictionary mapOfEnumString = default(Dictionary), Dictionary directMap = default(Dictionary), StringBooleanMap indirectMap = default(StringBooleanMap)) { this.MapMapOfString = mapMapOfString; this.MapOfEnumString = mapOfEnumString; + this.DirectMap = directMap; + this.IndirectMap = indirectMap; } /// @@ -77,6 +81,18 @@ namespace Org.OpenAPITools.Model public Dictionary> MapMapOfString { get; set; } + /// + /// Gets or Sets DirectMap + /// + [DataMember(Name="direct_map", EmitDefaultValue=false)] + public Dictionary DirectMap { get; set; } + + /// + /// Gets or Sets IndirectMap + /// + [DataMember(Name="indirect_map", EmitDefaultValue=false)] + public StringBooleanMap IndirectMap { get; set; } + /// /// Returns the string presentation of the object /// @@ -87,6 +103,8 @@ namespace Org.OpenAPITools.Model sb.Append("class MapTest {\n"); sb.Append(" MapMapOfString: ").Append(MapMapOfString).Append("\n"); sb.Append(" MapOfEnumString: ").Append(MapOfEnumString).Append("\n"); + sb.Append(" DirectMap: ").Append(DirectMap).Append("\n"); + sb.Append(" IndirectMap: ").Append(IndirectMap).Append("\n"); sb.Append("}\n"); return sb.ToString(); } @@ -130,6 +148,16 @@ namespace Org.OpenAPITools.Model this.MapOfEnumString == input.MapOfEnumString || this.MapOfEnumString != null && this.MapOfEnumString.SequenceEqual(input.MapOfEnumString) + ) && + ( + this.DirectMap == input.DirectMap || + this.DirectMap != null && + this.DirectMap.SequenceEqual(input.DirectMap) + ) && + ( + this.IndirectMap == input.IndirectMap || + (this.IndirectMap != null && + this.IndirectMap.Equals(input.IndirectMap)) ); } @@ -146,6 +174,10 @@ namespace Org.OpenAPITools.Model hashCode = hashCode * 59 + this.MapMapOfString.GetHashCode(); if (this.MapOfEnumString != null) hashCode = hashCode * 59 + this.MapOfEnumString.GetHashCode(); + if (this.DirectMap != null) + hashCode = hashCode * 59 + this.DirectMap.GetHashCode(); + if (this.IndirectMap != null) + hashCode = hashCode * 59 + this.IndirectMap.GetHashCode(); return hashCode; } } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Order.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Order.cs index 7ab47f8c1c3..235777cad54 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Order.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Order.cs @@ -40,24 +40,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/OuterEnum.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/OuterEnum.cs index 3399c560a84..8ac5f891d0e 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/OuterEnum.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/OuterEnum.cs @@ -34,24 +34,24 @@ namespace Org.OpenAPITools.Model public enum OuterEnum { - /// /// Enum Placed for value: placed /// [EnumMember(Value = "placed")] Placed = 1, - + /// /// Enum Approved for value: approved /// [EnumMember(Value = "approved")] Approved = 2, - + /// /// Enum Delivered for value: delivered /// [EnumMember(Value = "delivered")] Delivered = 3 + } } diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Pet.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Pet.cs index 33d8c2ef5eb..f1ffa5540c4 100644 --- a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Pet.cs +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/Pet.cs @@ -40,24 +40,24 @@ namespace Org.OpenAPITools.Model [JsonConverter(typeof(StringEnumConverter))] public enum StatusEnum { - /// /// Enum Available for value: available /// [EnumMember(Value = "available")] Available = 1, - + /// /// Enum Pending for value: pending /// [EnumMember(Value = "pending")] Pending = 2, - + /// /// Enum Sold for value: sold /// [EnumMember(Value = "sold")] Sold = 3 + } /// diff --git a/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/StringBooleanMap.cs b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/StringBooleanMap.cs new file mode 100644 index 00000000000..e8c837ad545 --- /dev/null +++ b/samples/client/petstore/csharp/OpenAPIClientWithPropertyChanged/src/Org.OpenAPITools/Model/StringBooleanMap.cs @@ -0,0 +1,133 @@ +/* + * OpenAPI Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * Generated by: https://github.com/openapitools/openapi-generator.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; +using OpenAPIDateConverter = Org.OpenAPITools.Client.OpenAPIDateConverter; + +namespace Org.OpenAPITools.Model +{ + /// + /// StringBooleanMap + /// + [DataContract] + [ImplementPropertyChanged] + public partial class StringBooleanMap : Dictionary, IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public StringBooleanMap() : base() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class StringBooleanMap {\n"); + sb.Append(" ").Append(base.ToString().Replace("\n", "\n ")).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as StringBooleanMap); + } + + /// + /// Returns true if StringBooleanMap instances are equal + /// + /// Instance of StringBooleanMap to be compared + /// Boolean + public bool Equals(StringBooleanMap input) + { + if (input == null) + return false; + + return base.Equals(input); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = base.GetHashCode(); + return hashCode; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/.gitignore b/samples/client/petstore/dart-jaguar/flutter_petstore/.gitignore new file mode 100644 index 00000000000..eb15c3d27ca --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/.gitignore @@ -0,0 +1,10 @@ +.DS_Store +.atom/ +.idea +.packages +.pub/ +build/ +ios/.generated/ +packages +pubspec.lock +.flutter-plugins diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/.metadata b/samples/client/petstore/dart-jaguar/flutter_petstore/.metadata new file mode 100644 index 00000000000..a700013d0b7 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/.metadata @@ -0,0 +1,8 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 8f65fec5f5f7d7afbb0965f4a44bdb330a28fb19 + channel: alpha diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/README.md b/samples/client/petstore/dart-jaguar/flutter_petstore/README.md new file mode 100644 index 00000000000..608ce5afa7a --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/README.md @@ -0,0 +1,8 @@ +# flutter_petstore + +OpenApi petstore sample flutter + +## Getting Started + +For help getting started with Flutter, view our online +[documentation](http://flutter.io/). diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/.gitignore b/samples/client/petstore/dart-jaguar/flutter_petstore/android/.gitignore new file mode 100644 index 00000000000..1658458c924 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/android/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +GeneratedPluginRegistrant.java diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/build.gradle b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/build.gradle new file mode 100644 index 00000000000..535c29bb389 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/build.gradle @@ -0,0 +1,52 @@ +def localProperties = new Properties() +def localPropertiesFile = rootProject.file('local.properties') +if (localPropertiesFile.exists()) { + localPropertiesFile.withInputStream { stream -> + localProperties.load(stream) + } +} + +def flutterRoot = localProperties.getProperty('flutter.sdk') +if (flutterRoot == null) { + throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") +} + +apply plugin: 'com.android.application' +apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" + +android { + compileSdkVersion 25 + buildToolsVersion '25.0.3' + + lintOptions { + disable 'InvalidPackage' + } + + defaultConfig { + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId "com.yourcompany.flutterpetstore" + minSdkVersion 16 + targetSdkVersion 25 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + // TODO: Add your own signing config for the release build. + // Signing with the debug keys for now, so `flutter run --release` works. + signingConfig signingConfigs.debug + } + } +} + +flutter { + source '../..' +} + +dependencies { + androidTestCompile 'com.android.support:support-annotations:25.4.0' + androidTestCompile 'com.android.support.test:runner:0.5' + androidTestCompile 'com.android.support.test:rules:0.5' +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/AndroidManifest.xml b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..4532f539988 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/java/com/yourcompany/flutterpetstore/MainActivity.java b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/java/com/yourcompany/flutterpetstore/MainActivity.java new file mode 100644 index 00000000000..5c99c848d53 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/java/com/yourcompany/flutterpetstore/MainActivity.java @@ -0,0 +1,14 @@ +package com.yourcompany.flutterpetstore; + +import android.os.Bundle; + +import io.flutter.app.FlutterActivity; +import io.flutter.plugins.GeneratedPluginRegistrant; + +public class MainActivity extends FlutterActivity { + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + GeneratedPluginRegistrant.registerWith(this); + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/drawable/launch_background.xml b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 00000000000..304732f8842 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-hdpi/ic_launcher.png new file mode 100644 index 00000000000..db77bb4b7b0 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-mdpi/ic_launcher.png new file mode 100644 index 00000000000..17987b79bb8 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 00000000000..09d4391482b Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 00000000000..d5f1c8d34e7 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 00000000000..4d6372eebdb Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/values/styles.xml b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/values/styles.xml new file mode 100644 index 00000000000..00fa4417cfb --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/android/app/src/main/res/values/styles.xml @@ -0,0 +1,8 @@ + + + + diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/build.gradle b/samples/client/petstore/dart-jaguar/flutter_petstore/android/build.gradle new file mode 100644 index 00000000000..77cbd091409 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/android/build.gradle @@ -0,0 +1,31 @@ +buildscript { + repositories { + jcenter() + maven { + url "https://maven.google.com" + } + } + + dependencies { + classpath 'com.android.tools.build:gradle:2.3.3' + } +} + +allprojects { + repositories { + jcenter() + maven { + url "https://maven.google.com" + } + } +} + +rootProject.buildDir = '../build' +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" + project.evaluationDependsOn(':app') +} + +task clean(type: Delete) { + delete rootProject.buildDir +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradle.properties b/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradle.properties new file mode 100644 index 00000000000..8bd86f68051 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536M diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..13372aef5e2 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradle/wrapper/gradle-wrapper.properties b/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000000..45e7f14e952 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Jun 23 08:50:38 CEST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradlew b/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradlew new file mode 100755 index 00000000000..9d82f789151 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# 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 +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# 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 + +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" ] ; 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 + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradlew.bat b/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradlew.bat new file mode 100644 index 00000000000..8a0b282aa68 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/android/gradlew.bat @@ -0,0 +1,90 @@ +@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 + +@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 DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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 Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_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=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +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/samples/client/petstore/dart-jaguar/flutter_petstore/android/settings.gradle b/samples/client/petstore/dart-jaguar/flutter_petstore/android/settings.gradle new file mode 100644 index 00000000000..115da6cb4f4 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/android/settings.gradle @@ -0,0 +1,15 @@ +include ':app' + +def flutterProjectRoot = rootProject.projectDir.parentFile.toPath() + +def plugins = new Properties() +def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins') +if (pluginsFile.exists()) { + pluginsFile.withInputStream { stream -> plugins.load(stream) } +} + +plugins.each { name, path -> + def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile() + include ":$name" + project(":$name").projectDir = pluginDirectory +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/.gitignore b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/.gitignore new file mode 100644 index 00000000000..38864eed23e --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/.gitignore @@ -0,0 +1,41 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ +GeneratedPluginRegistrant.h +GeneratedPluginRegistrant.m + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +/Flutter/app.flx +/Flutter/app.zip +/Flutter/App.framework +/Flutter/Flutter.framework +/Flutter/Generated.xcconfig +/ServiceDefinitions.json + +Pods/ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/AppFrameworkInfo.plist b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/AppFrameworkInfo.plist new file mode 100644 index 00000000000..6c2de8086bc --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/AppFrameworkInfo.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + UIRequiredDeviceCapabilities + + arm64 + + MinimumOSVersion + 8.0 + + diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/Debug.xcconfig b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/Debug.xcconfig new file mode 100644 index 00000000000..592ceee85b8 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/Debug.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/Release.xcconfig b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/Release.xcconfig new file mode 100644 index 00000000000..592ceee85b8 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/Release.xcconfig @@ -0,0 +1 @@ +#include "Generated.xcconfig" diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/AssetManifest.json b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/AssetManifest.json new file mode 100644 index 00000000000..03eaddffb9c --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/AssetManifest.json @@ -0,0 +1 @@ +{"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"]} \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/FontManifest.json b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/FontManifest.json new file mode 100644 index 00000000000..34bacb770fc --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/FontManifest.json @@ -0,0 +1 @@ +[{"fonts":[{"asset":"fonts/MaterialIcons-Regular.ttf"}],"family":"MaterialIcons"},{"family":"packages/cupertino_icons/CupertinoIcons","fonts":[{"asset":"packages/cupertino_icons/assets/CupertinoIcons.ttf"}]}] \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/LICENSE b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/LICENSE new file mode 100644 index 00000000000..6c576faae65 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/LICENSE @@ -0,0 +1,12514 @@ +analyzer +args +csslib +logging + +Copyright 2013, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------------------- +async +collection +convert +crypto +mime +package_config +package_resolver +plugin +shelf_static +source_map_stack_trace +stream_channel +typed_data +utf +vm_service_client + +Copyright 2015, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------------------- +auth_header + +Copyright (c) 2016, Ravi Teja Gudapati. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------------------- +boolean_selector +front_end +kernel +meta +shelf_packages_handler +web_socket_channel + +Copyright 2016, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------------------- +boringssl + +Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) +All rights reserved. + +This package is an SSL implementation written +by Eric Young (eay@cryptsoft.com). +The implementation was written so as to conform with Netscapes SSL. + +This library is free for commercial and non-commercial use as long as +the following conditions are aheared to. The following conditions +apply to all code found in this distribution, be it the RC4, RSA, +lhash, DES, etc., code; not just the SSL code. The SSL documentation +included with this distribution is covered by the same copyright terms +except that the holder is Tim Hudson (tjh@cryptsoft.com). + +Copyright remains Eric Young's, and as such any Copyright notices in +the code are not to be removed. +If this package is used in a product, Eric Young should be given attribution +as the author of the parts of the library used. +This can be in the form of a textual message at program startup or +in documentation (online or textual) provided with the package. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + "This product includes cryptographic software written by + Eric Young (eay@cryptsoft.com)" + The word 'cryptographic' can be left out if the rouines from the library + being used are not cryptographic related :-). +4. If you include any Windows specific code (or a derivative thereof) from + the apps directory (application code) you must include an acknowledgement: + "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + +THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +The licence and distribution terms for any publically available version or +derivative of this code cannot be changed. i.e. this code cannot simply be +copied and put under another distribution licence +[including the GNU Public Licence.] +-------------------------------------------------------------------------------- +boringssl + +Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) +All rights reserved. + +This package is an SSL implementation written +by Eric Young (eay@cryptsoft.com). +The implementation was written so as to conform with Netscapes SSL. + +This library is free for commercial and non-commercial use as long as +the following conditions are aheared to. The following conditions +apply to all code found in this distribution, be it the RC4, RSA, +lhash, DES, etc., code; not just the SSL code. The SSL documentation +included with this distribution is covered by the same copyright terms +except that the holder is Tim Hudson (tjh@cryptsoft.com). + +Copyright remains Eric Young's, and as such any Copyright notices in +the code are not to be removed. +If this package is used in a product, Eric Young should be given attribution +as the author of the parts of the library used. +This can be in the form of a textual message at program startup or +in documentation (online or textual) provided with the package. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + "This product includes cryptographic software written by + Eric Young (eay@cryptsoft.com)" + The word 'cryptographic' can be left out if the rouines from the library + being used are not cryptographic related :-). +4. If you include any Windows specific code (or a derivative thereof) from + the apps directory (application code) you must include an acknowledgement: + "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + +THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +The licence and distribution terms for any publically available version or +derivative of this code cannot be changed. i.e. this code cannot simply be +copied and put under another distribution licence +[including the GNU Public Licence.] +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1998-2000 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1998-2003 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1998-2004 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1998-2005 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1999 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1999-2002 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1999-2003 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1999-2004 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2000 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2000-2002 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2000-2003 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2000-2005 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2001 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2001-2011 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2002-2006 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2003 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2004 Kungliga Tekniska Högskolan +(Royal Institute of Technology, Stockholm, Sweden). +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +3. Neither the name of the Institute nor the names of its contributors + may be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2004 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2005 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2006 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2006,2007 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2008 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2010 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2011 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2011 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2012 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2013 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2014 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. All advertising materials mentioning features or use of this software + must display the following acknowledgement: + "This product includes cryptographic software written by + Eric Young (eay@cryptsoft.com)" + The word 'cryptographic' can be left out if the rouines from the library + being used are not cryptographic related :-). +4. If you include any Windows specific code (or a derivative thereof) from + the apps directory (application code) you must include an acknowledgement: + "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + +THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + +The licence and distribution terms for any publically available version or +derivative of this code cannot be changed. i.e. this code cannot simply be +copied and put under another distribution licence +[including the GNU Public Licence.] +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2014, Google Inc. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2015 The OpenSSL Project. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2015, Google Inc. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2015, Intel Inc. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2015-2016 the fiat-crypto authors (see the AUTHORS file). + +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 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. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2015-2016 the fiat-crypto authors (see the AUTHORS file). + +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 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. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2016, Google Inc. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2017, Google Inc. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +-------------------------------------------------------------------------------- +boringssl + +Copyright (c) 2018, Google Inc. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved. + +Licensed under the OpenSSL license (the "License"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file LICENSE in the source distribution or at +https://www.openssl.org/source/license.html +-------------------------------------------------------------------------------- +boringssl + +Copyright 2000-2016 The OpenSSL Project Authors. All Rights Reserved. + +Licensed under the OpenSSL license (the "License"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file LICENSE in the source distribution or at +https://www.openssl.org/source/license.html +-------------------------------------------------------------------------------- +boringssl + +Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + licensing@OpenSSL.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + +4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + +5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + +6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + +THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY +EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR +ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2003 Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2005 Nokia. All rights reserved. + +The portions of the attached software ("Contribution") is developed by +Nokia Corporation and is licensed pursuant to the OpenSSL open source +license. + +The Contribution, originally written by Mika Kousa and Pasi Eronen of +Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites +support (see RFC 4279) to OpenSSL. + +No patent licenses or other rights except those expressly stated in +the OpenSSL open source license shall be deemed granted or received +expressly, by implication, estoppel, or otherwise. + +No assurances are provided by Nokia that the Contribution does not +infringe the patent or other intellectual property rights of any third +party or that the license provides you with all the necessary rights +to make use of the Contribution. + +THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN +ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA +SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY +OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR +OTHERWISE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2005, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2006, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2006-2017 The OpenSSL Project Authors. All Rights Reserved. + +Licensed under the OpenSSL license (the "License"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file LICENSE in the source distribution or at +https://www.openssl.org/source/license.html +-------------------------------------------------------------------------------- +boringssl + +Copyright 2007, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2007-2016 The OpenSSL Project Authors. All Rights Reserved. + +Licensed under the OpenSSL license (the "License"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file LICENSE in the source distribution or at +https://www.openssl.org/source/license.html +-------------------------------------------------------------------------------- +boringssl + +Copyright 2008 Google Inc. +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2008, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2009 Google Inc. +All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2009 Google Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2009, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2012-2016 The OpenSSL Project Authors. All Rights Reserved. + +Licensed under the OpenSSL license (the "License"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file LICENSE in the source distribution or at +https://www.openssl.org/source/license.html +-------------------------------------------------------------------------------- +boringssl + +Copyright 2013-2016 The OpenSSL Project Authors. All Rights Reserved. +Copyright (c) 2012, Intel Corporation. All Rights Reserved. + +Licensed under the OpenSSL license (the "License"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file LICENSE in the source distribution or at +https://www.openssl.org/source/license.html +-------------------------------------------------------------------------------- +boringssl + +Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved. + +Licensed under the OpenSSL license (the "License"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file LICENSE in the source distribution or at +https://www.openssl.org/source/license.html +-------------------------------------------------------------------------------- +boringssl + +Copyright 2014-2016 The OpenSSL Project Authors. All Rights Reserved. +Copyright (c) 2014, Intel Corporation. All Rights Reserved. + +Licensed under the OpenSSL license (the "License"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file LICENSE in the source distribution or at +https://www.openssl.org/source/license.html +-------------------------------------------------------------------------------- +boringssl + +Copyright 2015, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl + +Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. + +Licensed under the OpenSSL license (the "License"). You may not use +this file except in compliance with the License. You can obtain a copy +in the file LICENSE in the source distribution or at +https://www.openssl.org/source/license.html +-------------------------------------------------------------------------------- +boringssl + +Copyright 2016 Brian Smith. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION +OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +-------------------------------------------------------------------------------- +boringssl + +The MIT License (MIT) + +Copyright (c) 2015-2016 the fiat-crypto authors (see +https://github.com/mit-plv/fiat-crypto/blob/master/AUTHORS). + +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 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. +-------------------------------------------------------------------------------- +boringssl +dart + +OpenSSL License + + ==================================================================== + Copyright (c) 1998-2011 The OpenSSL Project. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + 3. All advertising materials mentioning features or use of this + software must display the following acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit. (http://www.openssl.org/)" + + 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + endorse or promote products derived from this software without + prior written permission. For written permission, please contact + openssl-core@openssl.org. + + 5. Products derived from this software may not be called "OpenSSL" + nor may "OpenSSL" appear in their names without prior written + permission of the OpenSSL Project. + + 6. Redistributions of any form whatsoever must retain the following + acknowledgment: + "This product includes software developed by the OpenSSL Project + for use in the OpenSSL Toolkit (http://www.openssl.org/)" + + THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + OF THE POSSIBILITY OF SUCH DAMAGE. + ==================================================================== + + This product includes cryptographic software written by Eric Young + (eay@cryptsoft.com). This product includes software written by Tim + Hudson (tjh@cryptsoft.com). + +Original SSLeay License + +* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) +* All rights reserved. + +* This package is an SSL implementation written +* by Eric Young (eay@cryptsoft.com). +* The implementation was written so as to conform with Netscapes SSL. + +* This library is free for commercial and non-commercial use as long as +* the following conditions are aheared to. The following conditions +* apply to all code found in this distribution, be it the RC4, RSA, +* lhash, DES, etc., code; not just the SSL code. The SSL documentation +* included with this distribution is covered by the same copyright terms +* except that the holder is Tim Hudson (tjh@cryptsoft.com). + +* Copyright remains Eric Young's, and as such any Copyright notices in +* the code are not to be removed. +* If this package is used in a product, Eric Young should be given attribution +* as the author of the parts of the library used. +* This can be in the form of a textual message at program startup or +* in documentation (online or textual) provided with the package. + +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* 3. All advertising materials mentioning features or use of this software +* must display the following acknowledgement: +* "This product includes cryptographic software written by +* Eric Young (eay@cryptsoft.com)" +* The word 'cryptographic' can be left out if the rouines from the library +* being used are not cryptographic related :-). +* 4. If you include any Windows specific code (or a derivative thereof) from +* the apps directory (application code) you must include an acknowledgement: +* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + +* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. + +* The licence and distribution terms for any publically available version or +* derivative of this code cannot be changed. i.e. this code cannot simply be +* copied and put under another distribution licence +* [including the GNU Public Licence.] + +ISC license used for completely new code in BoringSSL: + +/* Copyright (c) 2015, Google Inc. + + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY + * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +The code in third_party/fiat carries the MIT license: + +Copyright (c) 2015-2016 the fiat-crypto authors (see +https://github.com/mit-plv/fiat-crypto/blob/master/AUTHORS). + +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 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. + +Licenses for support code + +Parts of the TLS test suite are under the Go license. This code is not included +in BoringSSL (i.e. libcrypto and libssl) when compiled, however, so +distributing code linked against BoringSSL does not trigger this license: + +Copyright (c) 2009 The Go Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +boringssl +observatory_pub_packages +skia +txt +vulkan + +Apache License +Version 2.0, January 2004 +http://www.apache.org/licenses + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +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. +-------------------------------------------------------------------------------- +charcode +glob +http +http_multi_server +http_parser +json_rpc_2 +matcher +path +pool +pub_semver +shelf +shelf_web_socket +source_maps +source_span +stack_trace +string_scanner +test +watcher +yaml + +Copyright 2014, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------------------- +client_cookie + +Copyright (c) 2017, teja. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------------------- +colorama + +Copyright (c) 2010 Jonathan Hartley +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holders, nor those of its contributors + may be used to endorse or promote products derived from this software without + specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +cupertino_icons + + +The MIT License (MIT) + +Copyright (c) 2016 Drifty (http://drifty.com/) + +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 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. +-------------------------------------------------------------------------------- +dart + +Copyright (c) 2003-2005 Tom Wu +Copyright (c) 2012 Adam Singer (adam@solvr.io) +All Rights Reserved. + +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 SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, +INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF +THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +In addition, the following condition applies: + +All redistributions must retain an intact copy of this copyright notice +and disclaimer. +-------------------------------------------------------------------------------- +dart + +Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +dart + +Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +dart + +Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +dart + +Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +dart + +Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +dart + +Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +dart + +Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +dart + +Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +dart + +Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +dart + +Copyright 2009 The Go Authors. All rights reserved. +Use of this source code is governed by a BSD-style +license that can be found in the LICENSE file +-------------------------------------------------------------------------------- +dart + +Copyright 2012, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +double-conversion +icu + +Copyright 2006-2008 the V8 project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +double-conversion +icu + +Copyright 2010 the V8 project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +double-conversion +icu + +Copyright 2012 the V8 project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +engine + +Copyright (c) 2013 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +engine + +Copyright 2017 The Flutter Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +engine + +Copyright 2018 The Flutter Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +engine +garnet + +Copyright 2013 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +engine +garnet +icu +skia +topaz + +Copyright 2015 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +engine +garnet +icu +topaz + +Copyright 2014 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +engine +garnet +tonic +topaz + +Copyright 2016 The Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +engine +garnet +tonic +topaz + +Copyright 2017 The Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +engine +garnet +topaz +txt + +Copyright 2017 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +engine +icu +skia +topaz + +Copyright 2016 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +engine +skia +topaz + +Copyright 2018 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +files + +Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd + +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 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. +-------------------------------------------------------------------------------- +files + +Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd + +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 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. +-------------------------------------------------------------------------------- +files + +Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd + and Clark Cooper +Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers. + +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 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. +-------------------------------------------------------------------------------- +files + +Copyright 2000, Clark Cooper +All rights reserved. + +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 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +freetype2 + +Copyright (C) 1995-2002 Jean-loup Gailly. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +freetype2 + +Copyright (C) 1995-2002 Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +freetype2 + +Copyright (C) 2000, 2001, 2002, 2003, 2006, 2010 by +Francesco Zappa Nardelli + +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 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright (C) 2000-2004, 2006-2011, 2013, 2014 by +Francesco Zappa Nardelli + +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 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright (C) 2001, 2002 by +Francesco Zappa Nardelli + +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 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright (C) 2001, 2002, 2003, 2004 by +Francesco Zappa Nardelli + +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 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright (C) 2001-2008, 2011, 2013, 2014 by +Francesco Zappa Nardelli + +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 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright 1990, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +documentation for any purpose is hereby granted without fee, provided that +the above copyright notice appear in all copies and that both that +copyright notice and this permission notice appear in supporting +documentation. + +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 +OPEN GROUP 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. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. +-------------------------------------------------------------------------------- +freetype2 + +Copyright 2000 Computing Research Labs, New Mexico State University +Copyright 2001-2004, 2011 Francesco Zappa Nardelli + +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 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 COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright 2000 Computing Research Labs, New Mexico State University +Copyright 2001-2014 + Francesco Zappa Nardelli + +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 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 COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright 2000 Computing Research Labs, New Mexico State University +Copyright 2001-2015 + Francesco Zappa Nardelli + +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 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 COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright 2000, 2001, 2004 by +Francesco Zappa Nardelli + +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 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright 2000-2001, 2002 by +Francesco Zappa Nardelli + +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 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright 2000-2001, 2003 by +Francesco Zappa Nardelli + +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 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright 2000-2010, 2012-2014 by +Francesco Zappa Nardelli + +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 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright 2001, 2002, 2012 Francesco Zappa Nardelli + +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 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 COMPUTING RESEARCH LAB OR NEW MEXICO STATE UNIVERSITY 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. +-------------------------------------------------------------------------------- +freetype2 + +Copyright 2003 by +Francesco Zappa Nardelli + +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 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. +-------------------------------------------------------------------------------- +freetype2 + +The FreeType Project LICENSE + + 2006-Jan-27 + +Copyright 1996-2002, 2006 by +David Turner, Robert Wilhelm, and Werner Lemberg + +Introduction +============ + + The FreeType Project is distributed in several archive packages; + some of them may contain, in addition to the FreeType font engine, + various tools and contributions which rely on, or relate to, the + FreeType Project. + + This license applies to all files found in such packages, and + which do not fall under their own explicit license. The license + affects thus the FreeType font engine, the test programs, + documentation and makefiles, at the very least. + + This license was inspired by the BSD, Artistic, and IJG + (Independent JPEG Group) licenses, which all encourage inclusion + and use of free software in commercial and freeware products + alike. As a consequence, its main points are that: + + o We don't promise that this software works. However, we will be + interested in any kind of bug reports. (`as is' distribution) + + o You can use this software for whatever you want, in parts or + full form, without having to pay us. (`royalty-free' usage) + + o You may not pretend that you wrote this software. If you use + it, or only parts of it, in a program, you must acknowledge + somewhere in your documentation that you have used the + FreeType code. (`credits') + + We specifically permit and encourage the inclusion of this + software, with or without modifications, in commercial products. + We disclaim all warranties covering The FreeType Project and + assume no liability related to The FreeType Project. + + Finally, many people asked us for a preferred form for a + credit/disclaimer to use in compliance with this license. We thus + encourage you to use the following text: + + Portions of this software are copyright © The FreeType + Project (www.freetype.org). All rights reserved. + + Please replace with the value from the FreeType version you + actually use. + +Legal Terms +=========== + +0. Definitions + + Throughout this license, the terms `package', `FreeType Project', + and `FreeType archive' refer to the set of files originally + distributed by the authors (David Turner, Robert Wilhelm, and + Werner Lemberg) as the `FreeType Project', be they named as alpha, + beta or final release. + + `You' refers to the licensee, or person using the project, where + `using' is a generic term including compiling the project's source + code as well as linking it to form a `program' or `executable'. + This program is referred to as `a program using the FreeType + engine'. + + This license applies to all files distributed in the original + FreeType Project, including all source code, binaries and + documentation, unless otherwise stated in the file in its + original, unmodified form as distributed in the original archive. + If you are unsure whether or not a particular file is covered by + this license, you must contact us to verify this. + + The FreeType Project is copyright (C) 1996-2000 by David Turner, + Robert Wilhelm, and Werner Lemberg. All rights reserved except as + specified below. + +1. No Warranty + + THE FREETYPE PROJECT IS PROVIDED `AS IS' WITHOUT WARRANTY OF ANY + KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS + BE LIABLE FOR ANY DAMAGES CAUSED BY THE USE OR THE INABILITY TO + USE, OF THE FREETYPE PROJECT. + +2. Redistribution + + This license grants a worldwide, royalty-free, perpetual and + irrevocable right and license to use, execute, perform, compile, + display, copy, create derivative works of, distribute and + sublicense the FreeType Project (in both source and object code + forms) and derivative works thereof for any purpose; and to + authorize others to exercise some or all of the rights granted + herein, subject to the following conditions: + + o Redistribution of source code must retain this license file + (`FTL.TXT') unaltered; any additions, deletions or changes to + the original files must be clearly indicated in accompanying + documentation. The copyright notices of the unaltered, + original files must be preserved in all copies of source + files. + + o Redistribution in binary form must provide a disclaimer that + states that the software is based in part of the work of the + FreeType Team, in the distribution documentation. We also + encourage you to put an URL to the FreeType web page in your + documentation, though this isn't mandatory. + + These conditions apply to any software derived from or based on + the FreeType Project, not just the unmodified files. If you use + our work, you must acknowledge us. However, no fee need be paid + to us. + +3. Advertising + + Neither the FreeType authors and contributors nor you shall use + the name of the other for commercial, advertising, or promotional + purposes without specific prior written permission. + + We suggest, but do not require, that you use one or more of the + following phrases to refer to this software in your documentation + or advertising materials: `FreeType Project', `FreeType Engine', + `FreeType library', or `FreeType Distribution'. + + As you have not signed this license, you are not required to + accept it. However, as the FreeType Project is copyrighted + material, only this license, or another one contracted with the + authors, grants you the right to use, distribute, and modify it. + Therefore, by using, distributing, or modifying the FreeType + Project, you indicate that you understand and accept all the terms + of this license. + +4. Contacts + + There are two mailing lists related to FreeType: + + o freetype@nongnu.org + + Discusses general use and applications of FreeType, as well as + future and wanted additions to the library and distribution. + If you are looking for support, start in this list if you + haven't found anything to help you in the documentation. + + o freetype-devel@nongnu.org + + Discusses bugs, as well as engine internals, design issues, + specific licenses, porting, etc. + + Our home page can be found at + + https://www.freetype.org + +--- end of FTL.TXT --- +-------------------------------------------------------------------------------- +garnet + +Copyright 2013 The Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +garnet + +Copyright 2014 The Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +garnet + +Copyright 2017 The Fuchsia Authors.All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +garnet +tonic +topaz + +Copyright 2015 The Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +garnet +tonic +topaz + +Copyright 2018 The Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +gif + +GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! +-------------------------------------------------------------------------------- +gif + +The Graphics Interchange Format(c) is the copyright property of CompuServe +Incorporated. Only CompuServe Incorporated is authorized to define, redefine, +enhance, alter, modify or change in any way the definition of the format. + +CompuServe Incorporated hereby grants a limited, non-exclusive, royalty-free +license for the use of the Graphics Interchange Format(sm) in computer +software; computer software utilizing GIF(sm) must acknowledge ownership of the +Graphics Interchange Format and its Service Mark by CompuServe Incorporated, in +User and Technical Documentation. Computer software utilizing GIF, which is +distributed or may be distributed without User or Technical Documentation must +display to the screen or printer a message acknowledging ownership of the +Graphics Interchange Format and the Service Mark by CompuServe Incorporated; in +this case, the acknowledgement may be displayed in an opening screen or leading +banner, or a closing screen or trailing banner. A message such as the following +may be used: + + "The Graphics Interchange Format(c) is the Copyright property of + CompuServe Incorporated. GIF(sm) is a Service Mark property of + CompuServe Incorporated." +-------------------------------------------------------------------------------- +harfbuzz + +Copyright (C) 2012 Grigori Goronzy + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 1998-2004 David Turner and Werner Lemberg +Copyright © 2004,2007,2009 Red Hat, Inc. +Copyright © 2011,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 1998-2004 David Turner and Werner Lemberg +Copyright © 2004,2007,2009,2010 Red Hat, Inc. +Copyright © 2011,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 1998-2004 David Turner and Werner Lemberg +Copyright © 2006 Behdad Esfahbod +Copyright © 2007,2008,2009 Red Hat, Inc. +Copyright © 2012,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2007 Chris Wilson +Copyright © 2009,2010 Red Hat, Inc. +Copyright © 2011,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2007,2008,2009 Red Hat, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2007,2008,2009 Red Hat, Inc. +Copyright © 2010,2011,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2007,2008,2009 Red Hat, Inc. +Copyright © 2010,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2007,2008,2009 Red Hat, Inc. +Copyright © 2011,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2007,2008,2009 Red Hat, Inc. +Copyright © 2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2007,2008,2009 Red Hat, Inc. +Copyright © 2012,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2007,2008,2009,2010 Red Hat, Inc. +Copyright © 2010,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2007,2008,2009,2010 Red Hat, Inc. +Copyright © 2010,2012,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2007,2008,2009,2010 Red Hat, Inc. +Copyright © 2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2007,2008,2009,2010 Red Hat, Inc. +Copyright © 2012,2018 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009 Red Hat, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009 Red Hat, Inc. +Copyright © 2009 Keith Stribley +Copyright © 2011 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009 Red Hat, Inc. +Copyright © 2009 Keith Stribley +Copyright © 2015 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009 Red Hat, Inc. +Copyright © 2011 Codethink Limited +Copyright © 2010,2011,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009 Red Hat, Inc. +Copyright © 2011 Codethink Limited +Copyright © 2011,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009 Red Hat, Inc. +Copyright © 2011 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009 Red Hat, Inc. +Copyright © 2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009 Red Hat, Inc. +Copyright © 2015 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009 Red Hat, Inc. +Copyright © 2018 Ebrahim Byagowi + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009 Red Hat, Inc. +Copyright © 2018 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009,2010 Red Hat, Inc. +Copyright © 2010,2011,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009,2010 Red Hat, Inc. +Copyright © 2010,2011,2012,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009,2010 Red Hat, Inc. +Copyright © 2010,2011,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2009,2010 Red Hat, Inc. +Copyright © 2011,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2010 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2010 Red Hat, Inc. +Copyright © 2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2010,2011 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2010,2011,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2010,2011,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2010,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2011 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2011 Martin Hosken +Copyright © 2011 SIL International + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2011 Martin Hosken +Copyright © 2011 SIL International +Copyright © 2011,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2011,2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2011,2012,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2011,2012,2014 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2011,2014 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2012 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2012 Mozilla Foundation. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2012,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2012,2013 Mozilla Foundation. +Copyright © 2012,2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2012,2017 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2013 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2013 Red Hat, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2014 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2015 Ebrahim Byagowi + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2015 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2015 Mozilla Foundation. +Copyright © 2015 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2015-2018 Ebrahim Byagowi + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2016 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2016 Google, Inc. +Copyright © 2018 Ebrahim Byagowi + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2016 Igalia S.L. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2016 Elie Roux +Copyright © 2018 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2017 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2018 Ebrahim Byagowi + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2018 Ebrahim Byagowi +Copyright © 2018 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +Copyright © 2018 Google, Inc. + + This is part of HarfBuzz, a text shaping library. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +HarfBuzz is licensed under the so-called "Old MIT" license. Details follow. +For parts of HarfBuzz that are licensed under different licenses see individual +files names COPYING in subdirectories where applicable. + +Copyright © 2010,2011,2012 Google, Inc. +Copyright © 2012 Mozilla Foundation +Copyright © 2011 Codethink Limited +Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies) +Copyright © 2009 Keith Stribley +Copyright © 2009 Martin Hosken and SIL International +Copyright © 2007 Chris Wilson +Copyright © 2006 Behdad Esfahbod +Copyright © 2005 David Turner +Copyright © 2004,2007,2008,2009,2010 Red Hat, Inc. +Copyright © 1998-2004 David Turner and Werner Lemberg + +For full copyright notices consult the individual files in the package. + +Permission is hereby granted, without written agreement and without +license or royalty fees, to use, copy, modify, and distribute this +software and its documentation for any purpose, provided that the +above copyright notice and the following two paragraphs appear in +all copies of this software. + +IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES +ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN +IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, +BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +-------------------------------------------------------------------------------- +harfbuzz + +The contents of this directory are licensed under the following terms: + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted, provided that the above +copyright notice and this permission notice appear in all copies. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +-------------------------------------------------------------------------------- +html + +Copyright (c) 2006-2012 The Authors + +Contributors: +James Graham - jg307@cam.ac.uk +Anne van Kesteren - annevankesteren@gmail.com +Lachlan Hunt - lachlan.hunt@lachy.id.au +Matt McDonald - kanashii@kanashii.ca +Sam Ruby - rubys@intertwingly.net +Ian Hickson (Google) - ian@hixie.ch +Thomas Broyer - t.broyer@ltgt.net +Jacques Distler - distler@golem.ph.utexas.edu +Henri Sivonen - hsivonen@iki.fi +Adam Barth - abarth@webkit.org +Eric Seidel - eric@webkit.org +The Mozilla Foundation (contributions from Henri Sivonen since 2008) +David Flanagan (Mozilla) - dflanagan@mozilla.com +Google Inc. (contributed the Dart port) - misc@dartlang.org + +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 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. + +-------------------------------------------------------------------------------- +icu + +Copyright (c) 1995-2016 International Business Machines Corporation and others +All rights reserved. + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY +SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +All trademarks and registered trademarks mentioned herein are the +property of their respective owners. +-------------------------------------------------------------------------------- +icu + +Copyright (c) 1998 - 1999 Unicode, Inc. All Rights reserved. + Copyright (C) 2002-2005, International Business Machines + Corporation and others. All Rights Reserved. + +This file is provided as-is by Unicode, Inc. (The Unicode Consortium). +No claims are made as to fitness for any particular purpose. No +warranties of any kind are expressed or implied. The recipient +agrees to determine applicability of information provided. If this +file has been provided on optical media by Unicode, Inc., the sole +remedy for any claim will be exchange of defective media within 90 +days of receipt. + +Unicode, Inc. hereby grants the right to freely use the information +supplied in this file in the creation of products supporting the +Unicode Standard, and to make copies of this file in any form for +internal or external distribution as long as this notice remains +attached. +-------------------------------------------------------------------------------- +icu + +Copyright (c) 1999 Computer Systems and Communication Lab, + Institute of Information Science, Academia + * Sinica. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. +. Neither the name of the Computer Systems and Communication Lab + nor the names of its contributors may be used to endorse or + promote products derived from this software without specific + prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu + +Copyright (c) 1999 TaBE Project. +Copyright (c) 1999 Pai-Hsiang Hsiao. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. +. Neither the name of the TaBE Project nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu + +Copyright (c) 1999 Unicode, Inc. All Rights reserved. + Copyright (C) 2002-2005, International Business Machines + Corporation and others. All Rights Reserved. + +This file is provided as-is by Unicode, Inc. (The Unicode Consortium). +No claims are made as to fitness for any particular purpose. No +warranties of any kind are expressed or implied. The recipient +agrees to determine applicability of information provided. If this +file has been provided on optical media by Unicode, Inc., the sole +remedy for any claim will be exchange of defective media within 90 +days of receipt. + +Unicode, Inc. hereby grants the right to freely use the information +supplied in this file in the creation of products supporting the +Unicode Standard, and to make copies of this file in any form for +internal or external distribution as long as this notice remains +attached. +-------------------------------------------------------------------------------- +icu + +Copyright (c) 2002 Unicode, Inc. All Rights reserved. + Copyright (C) 2002-2005, International Business Machines + Corporation and others. All Rights Reserved. + +This file is provided as-is by Unicode, Inc. (The Unicode Consortium). +No claims are made as to fitness for any particular purpose. No +warranties of any kind are expressed or implied. The recipient +agrees to determine applicability of information provided. If this +file has been provided on optical media by Unicode, Inc., the sole +remedy for any claim will be exchange of defective media within 90 +days of receipt. + +Unicode, Inc. hereby grants the right to freely use the information +supplied in this file in the creation of products supporting the +Unicode Standard, and to make copies of this file in any form for +internal or external distribution as long as this notice remains +attached. +-------------------------------------------------------------------------------- +icu + +Copyright (c) 2013 International Business Machines Corporation +and others. All Rights Reserved. + +Project: http://code.google.com/p/lao-dictionary +Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt +License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt + (copied below) + + This file is derived from the above dictionary, with slight + modifications. + + Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell. + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, + are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. Redistributions in + binary form must reproduce the above copyright notice, this list of + conditions and the following disclaimer in the documentation and/or + other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS +FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE +COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED +OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu + +Copyright (c) 2014 International Business Machines Corporation +and others. All Rights Reserved. + +This list is part of a project hosted at: + github.com/kanyawtech/myanmar-karen-word-lists + +Copyright (c) 2013, LeRoy Benjamin Sharon +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: Redistributions of source code must retain the above +copyright notice, this list of conditions and the following +disclaimer. Redistributions in binary form must reproduce the +above copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided +with the distribution. + + Neither the name Myanmar Karen Word Lists, nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR +TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu + +Copyright (c) IBM Corporation, 2000-2010. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu + +Copyright (c) IBM Corporation, 2000-2011. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu + +Copyright (c) IBM Corporation, 2000-2012. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu + +Copyright (c) IBM Corporation, 2000-2014. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu + +Copyright (c) IBM Corporation, 2000-2016. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu + +Copyright 1996 Chih-Hao Tsai @ Beckman Institute, + University of Illinois +c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4 +-------------------------------------------------------------------------------- +icu + +Copyright 2000, 2001, 2002, 2003 Nara Institute of Science +and Technology. All Rights Reserved. + +Use, reproduction, and distribution of this software is permitted. +Any copy of this software, whether in its original form or modified, +must include both the above copyright notice and the following +paragraphs. + +Nara Institute of Science and Technology (NAIST), +the copyright holders, disclaims all warranties with regard to this +software, including all implied warranties of merchantability and +fitness, in no event shall NAIST be liable for +any special, indirect or consequential damages or any damages +whatsoever resulting from loss of use, data or profits, whether in an +action of contract, negligence or other tortuous action, arising out +of or in connection with the use or performance of this software. + +A large portion of the dictionary entries +originate from ICOT Free Software. The following conditions for ICOT +Free Software applies to the current dictionary as well. + +Each User may also freely distribute the Program, whether in its +original form or modified, to any third party or parties, PROVIDED +that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear +on, or be attached to, the Program, which is distributed substantially +in the same form as set out herein and that such intended +distribution, if actually made, will neither violate or otherwise +contravene any of the laws and regulations of the countries having +jurisdiction over the User or the intended distribution itself. + +NO WARRANTY + +The program was produced on an experimental basis in the course of the +research and development conducted during the project and is provided +to users as so produced on an experimental basis. Accordingly, the +program is provided without any warranty whatsoever, whether express, +implied, statutory or otherwise. The term "warranty" used herein +includes, but is not limited to, any warranty of the quality, +performance, merchantability and fitness for a particular purpose of +the program and the nonexistence of any infringement or violation of +any right of any third party. + +Each user of the program will agree and understand, and be deemed to +have agreed and understood, that there is no warranty whatsoever for +the program and, accordingly, the entire risk arising from or +otherwise connected with the program is assumed by the user. + +Therefore, neither ICOT, the copyright holder, or any other +organization that participated in or was otherwise related to the +development of the program and their respective officials, directors, +officers and other employees shall be held liable for any and all +damages, including, without limitation, general, special, incidental +and consequential damages, arising out of or otherwise in connection +with the use or inability to use the program or any product, material +or result produced or otherwise obtained by using the program, +regardless of whether they have been advised of, or otherwise had +knowledge of, the possibility of such damages at any time during the +project or thereafter. Each user will be deemed to have agreed to the +foregoing by his or her commencement of use of the program. The term +"use" as used herein includes, but is not limited to, the use, +modification, copying and distribution of the program and the +production of secondary products from the program. + +In the case where the program, whether in its original form or +modified, was distributed or delivered to or received by a user from +any person, organization or entity other than ICOT, unless it makes or +grants independently of ICOT any specific warranty to the user in +writing, such person, organization or entity, will also be exempted +from and not be held liable to the user for any such damages as noted +above as far as the program is concerned. +-------------------------------------------------------------------------------- +icu + +Copyright 2006-2011, the V8 project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu + +Copyright © 1991-2018 Unicode, Inc. All rights reserved. +Distributed under the Terms of Use in http://www.unicode.org/copyright.html. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Unicode data files and any associated documentation +(the "Data Files") or Unicode software and any associated documentation +(the "Software") to deal in the Data Files or Software +without restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, and/or sell copies of +the Data Files or Software, and to permit persons to whom the Data Files +or Software are furnished to do so, provided that either +(a) this copyright and permission notice appear with all copies +of the Data Files or Software, or +(b) this copyright and permission notice appear in associated +Documentation. + +THE DATA FILES AND SOFTWARE ARE 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 OF THIRD PARTY RIGHTS. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS +NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL +DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THE DATA FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in these Data Files or Software without prior +written authorization of the copyright holder. +-------------------------------------------------------------------------------- +icu + +ICU License - ICU 1.8.1 and later + +COPYRIGHT AND PERMISSION NOTICE + +Copyright (c) 1995-2009 International Business Machines Corporation and others + +All rights reserved. + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY +SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN +CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. +-------------------------------------------------------------------------------- +icu + +The BSD License +http://opensource.org/licenses/bsd-license.php +Copyright (C) 2006-2008, Google Inc. + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following +disclaimer in the documentation and/or other materials provided with +the distribution. + Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND +CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +icu + +Unicode® Terms of Use +For the general privacy policy governing access to this site, see the Unicode Privacy Policy. For trademark usage, see the Unicode® Consortium Name and Trademark Usage Policy. + +A. Unicode Copyright. +1. Copyright © 1991-2017 Unicode, Inc. All rights reserved. +2. Certain documents and files on this website contain a legend indicating that "Modification is permitted." Any person is hereby authorized, without fee, to modify such documents and files to create derivative works conforming to the Unicode® Standard, subject to Terms and Conditions herein. +3. Any person is hereby authorized, without fee, to view, use, reproduce, and distribute all documents and files solely for informational purposes and in the creation of products supporting the Unicode Standard, subject to the Terms and Conditions herein. +4. Further specifications of rights and restrictions pertaining to the use of the particular set of data files known as the "Unicode Character Database" can be found in the License. +5. Each version of the Unicode Standard has further specifications of rights and restrictions of use. For the book editions (Unicode 5.0 and earlier), these are found on the back of the title page. The online code charts carry specific restrictions. All other files, including online documentation of the core specification for Unicode 6.0 and later, are covered under these general Terms of Use. +6. No license is granted to "mirror" the Unicode website where a fee is charged for access to the "mirror" site. +7. Modification is not permitted with respect to this document. All copies of this document must be verbatim. +B. Restricted Rights Legend. Any technical data or software which is licensed to the United States of America, its agencies and/or instrumentalities under this Agreement is commercial technical data or commercial computer software developed exclusively at private expense as defined in FAR 2.101, or DFARS 252.227-7014 (June 1995), as applicable. For technical data, use, duplication, or disclosure by the Government is subject to restrictions as set forth in DFARS 202.227-7015 Technical Data, Commercial and Items (Nov 1995) and this Agreement. For Software, in accordance with FAR 12-212 or DFARS 227-7202, as applicable, use, duplication or disclosure by the Government is subject to the restrictions set forth in this Agreement. +C. Warranties and Disclaimers. +1. This publication and/or website may include technical or typographical errors or other inaccuracies . Changes are periodically added to the information herein; these changes will be incorporated in new editions of the publication and/or website. Unicode may make improvements and/or changes in the product(s) and/or program(s) described in this publication and/or website at any time. +2. If this file has been purchased on magnetic or optical media from Unicode, Inc. the sole and exclusive remedy for any claim will be exchange of the defective media within ninety (90) days of original purchase. +3. EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UNICODE AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR OMISSIONS IN THIS PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH ARE REFERENCED BY OR LINKED TO THIS PUBLICATION OR THE UNICODE WEBSITE. +D. Waiver of Damages. In no event shall Unicode or its licensors be liable for any special, incidental, indirect or consequential damages of any kind, or any damages whatsoever, whether or not Unicode was advised of the possibility of the damage, including, without limitation, those resulting from the following: loss of use, data or profits, in connection with the use, modification or distribution of this information or its derivatives. +E. Trademarks & Logos. +1. The Unicode Word Mark and the Unicode Logo are trademarks of Unicode, Inc. “The Unicode Consortium” and “Unicode, Inc.” are trade names of Unicode, Inc. Use of the information and materials found on this website indicates your acknowledgement of Unicode, Inc.’s exclusive worldwide rights in the Unicode Word Mark, the Unicode Logo, and the Unicode trade names. +2. The Unicode Consortium Name and Trademark Usage Policy (“Trademark Policy”) are incorporated herein by reference and you agree to abide by the provisions of the Trademark Policy, which may be changed from time to time in the sole discretion of Unicode, Inc. +3. All third party trademarks referenced herein are the property of their respective owners. +F. Miscellaneous. +1. Jurisdiction and Venue. This server is operated from a location in the State of California, United States of America. Unicode makes no representation that the materials are appropriate for use in other locations. If you access this server from other locations, you are responsible for compliance with local laws. This Agreement, all use of this site and any claims and damages resulting from use of this site are governed solely by the laws of the State of California without regard to any principles which would apply the laws of a different jurisdiction. The user agrees that any disputes regarding this site shall be resolved solely in the courts located in Santa Clara County, California. The user agrees said courts have personal jurisdiction and agree to waive any right to transfer the dispute to any other forum. +2. Modification by Unicode Unicode shall have the right to modify this Agreement at any time by posting it to this site. The user may not assign any part of this Agreement without Unicode’s prior written consent. +3. Taxes. The user agrees to pay any taxes arising from access to this website or use of the information herein, except for those based on Unicode’s net income. +4. Severability. If any provision of this Agreement is declared invalid or unenforceable, the remaining provisions of this Agreement shall remain in effect. +5. Entire Agreement. This Agreement constitutes the entire agreement between the parties. + +EXHIBIT 1 +UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE + +Unicode Data Files include all data files under the directories +http://www.unicode.org/Public/, http://www.unicode.org/reports/, +http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and +http://www.unicode.org/utility/trac/browser/. + +Unicode Data Files do not include PDF online code charts under the +directory http://www.unicode.org/Public/. + +Software includes any source code published in the Unicode Standard +or under the directories +http://www.unicode.org/Public/, http://www.unicode.org/reports/, +http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and +http://www.unicode.org/utility/trac/browser/. + +NOTICE TO USER: Carefully read the following legal agreement. +BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S +DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), +YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE +TERMS AND CONDITIONS OF THIS AGREEMENT. +IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE +THE DATA FILES OR SOFTWARE. + +COPYRIGHT AND PERMISSION NOTICE + +Copyright © 1991-2017 Unicode, Inc. All rights reserved. +Distributed under the Terms of Use in http://www.unicode.org/copyright.html. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Unicode data files and any associated documentation +(the "Data Files") or Unicode software and any associated documentation +(the "Software") to deal in the Data Files or Software +without restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, and/or sell copies of +the Data Files or Software, and to permit persons to whom the Data Files +or Software are furnished to do so, provided that either +(a) this copyright and permission notice appear with all copies +of the Data Files or Software, or +(b) this copyright and permission notice appear in associated +Documentation. + +THE DATA FILES AND SOFTWARE ARE 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 OF THIRD PARTY RIGHTS. +IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS +NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL +DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THE DATA FILES OR SOFTWARE. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, +use or other dealings in these Data Files or Software without prior +written authorization of the copyright holder. +-------------------------------------------------------------------------------- +io +multi_server_socket +term_glyph + +Copyright 2017, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------------------- +jaguar_resty + +BSD 3-Clause License + +Copyright (c) 2017, Ravi Teja Gudapati +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +jaguar_retrofit + +Copyright (c) 2016, Jaguar Authors. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of Jaguar Authors nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL Jaguar Authors BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------------------- +js + +Copyright 2012, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C) 2009, D. R. Commander. + +Based on the x86 SIMD extension for IJG JPEG library +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C) 2009-2011, 2014-2016, D. R. Commander. +Copyright (C) 2015, Matthieu Darbois. + +Based on the x86 SIMD extension for IJG JPEG library +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C) 2009-2011, Nokia Corporation and/or its subsidiary(-ies). +All Rights Reserved. +Author: Siarhei Siamashka +Copyright (C) 2013-2014, Linaro Limited. All Rights Reserved. +Author: Ragesh Radhakrishnan +Copyright (C) 2014-2016, D. R. Commander. All Rights Reserved. +Copyright (C) 2015-2016, Matthieu Darbois. All Rights Reserved. +Copyright (C) 2016, Siarhei Siamashka. All Rights Reserved. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C) 2009-2011, Nokia Corporation and/or its subsidiary(-ies). +All Rights Reserved. +Author: Siarhei Siamashka +Copyright (C) 2014, Siarhei Siamashka. All Rights Reserved. +Copyright (C) 2014, Linaro Limited. All Rights Reserved. +Copyright (C) 2015, D. R. Commander. All Rights Reserved. +Copyright (C) 2015-2016, Matthieu Darbois. All Rights Reserved. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C) 2011, D. R. Commander. + +Based on the x86 SIMD extension for IJG JPEG library +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C) 2013, MIPS Technologies, Inc., California. +All Rights Reserved. +Authors: Teodora Novkovic (teodora.novkovic@imgtec.com) + Darko Laus (darko.laus@imgtec.com) +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C) 2013-2014, MIPS Technologies, Inc., California. +All Rights Reserved. +Authors: Teodora Novkovic (teodora.novkovic@imgtec.com) + Darko Laus (darko.laus@imgtec.com) +Copyright (C) 2015, D. R. Commander. All Rights Reserved. +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C) 2014, D. R. Commander. All Rights Reserved. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C) 2014-2015, D. R. Commander. All Rights Reserved. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C) 2014-2015, D. R. Commander. All Rights Reserved. +Copyright (C) 2014, Jay Foad. All Rights Reserved. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C) 2015, D. R. Commander. All Rights Reserved. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C)2009-2014 D. R. Commander. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +- Neither the name of the libjpeg-turbo Project nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C)2009-2015 D. R. Commander. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +- Neither the name of the libjpeg-turbo Project nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C)2009-2016 D. R. Commander. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +- Neither the name of the libjpeg-turbo Project nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C)2011 D. R. Commander. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +- Neither the name of the libjpeg-turbo Project nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C)2011, 2015 D. R. Commander. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +- Neither the name of the libjpeg-turbo Project nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright (C)2011-2016 D. R. Commander. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +- Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. +- Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. +- Neither the name of the libjpeg-turbo Project nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS", +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB + +Based on the x86 SIMD extension for IJG JPEG library +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB + +Based on the x86 SIMD extension for IJG JPEG library, +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB +Copyright (C) 2009, D. R. Commander. + +Based on the x86 SIMD extension for IJG JPEG library +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB +Copyright (C) 2009-2011, 2013-2014, 2016, D. R. Commander. +Copyright (C) 2015, Matthieu Darbois. + +Based on the x86 SIMD extension for IJG JPEG library, +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB +Copyright (C) 2009-2011, 2013-2014, 2016, D. R. Commander. +Copyright (C) 2015-2016, Matthieu Darbois. + +Based on the x86 SIMD extension for IJG JPEG library, +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB +Copyright (C) 2009-2011, 2014, 2016, D. R. Commander. +Copyright (C) 2015, Matthieu Darbois. + +Based on the x86 SIMD extension for IJG JPEG library, +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB +Copyright (C) 2009-2011, 2014, D. R. Commander. +Copyright (C) 2013-2014, MIPS Technologies, Inc., California. +Copyright (C) 2015, Matthieu Darbois. + +Based on the x86 SIMD extension for IJG JPEG library, +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB +Copyright (C) 2009-2011, 2014, D. R. Commander. +Copyright (C) 2015, Matthieu Darbois. + +Based on the x86 SIMD extension for IJG JPEG library, +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB +Copyright (C) 2009-2011, 2014-2015, D. R. Commander. +Copyright (C) 2015, Matthieu Darbois. + +Based on the x86 SIMD extension for IJG JPEG library, +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB +Copyright (C) 2010, D. R. Commander. + +Based on the x86 SIMD extension for IJG JPEG library - version 1.02 + +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB +Copyright (C) 2011, 2014, D. R. Commander. +Copyright (C) 2015, Matthieu Darbois. + +Based on the x86 SIMD extension for IJG JPEG library, +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB +Copyright (C) 2011, 2014-2016, D. R. Commander. +Copyright (C) 2013-2014, MIPS Technologies, Inc., California. +Copyright (C) 2014, Linaro Limited. +Copyright (C) 2015-2016, Matthieu Darbois. + +Based on the x86 SIMD extension for IJG JPEG library, +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009 Pierre Ossman for Cendio AB +Copyright (C) 2011, D. R. Commander. + +Based on the x86 SIMD extension for IJG JPEG library +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009, 2012 Pierre Ossman for Cendio AB +Copyright (C) 2009, 2012, D. R. Commander. + +Based on the x86 SIMD extension for IJG JPEG library +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +Copyright 2009, 2012 Pierre Ossman for Cendio AB +Copyright (C) 2012, D. R. Commander. + +Based on the x86 SIMD extension for IJG JPEG library +Copyright (C) 1999-2006, MIYASAKA Masaru. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +libjpeg-turbo + +libjpeg-turbo note: This file has been modified by The libjpeg-turbo Project +to include only information relevant to libjpeg-turbo, to wordsmith certain +sections, and to remove impolitic language that existed in the libjpeg v8 +README. It is included only for reference. Please see README.md for +information specific to libjpeg-turbo. + +The Independent JPEG Group's JPEG software +========================================== + +This distribution contains a release of the Independent JPEG Group's free JPEG +software. You are welcome to redistribute this software and to use it for any +purpose, subject to the conditions under LEGAL ISSUES, below. + +This software is the work of Tom Lane, Guido Vollbeding, Philip Gladstone, +Bill Allombert, Jim Boucher, Lee Crocker, Bob Friesenhahn, Ben Jackson, +Julian Minguillon, Luis Ortiz, George Phillips, Davide Rossi, Ge' Weijers, +and other members of the Independent JPEG Group. + +IJG is not affiliated with the ISO/IEC JTC1/SC29/WG1 standards committee +(also known as JPEG, together with ITU-T SG16). + +DOCUMENTATION ROADMAP +===================== + +This file contains the following sections: + +OVERVIEW General description of JPEG and the IJG software. +LEGAL ISSUES Copyright, lack of warranty, terms of distribution. +REFERENCES Where to learn more about JPEG. +ARCHIVE LOCATIONS Where to find newer versions of this software. +FILE FORMAT WARS Software *not* to get. +TO DO Plans for future IJG releases. + +Other documentation files in the distribution are: + +User documentation: + usage.txt Usage instructions for cjpeg, djpeg, jpegtran, + rdjpgcom, and wrjpgcom. + *.1 Unix-style man pages for programs (same info as usage.txt). + wizard.txt Advanced usage instructions for JPEG wizards only. + change.log Version-to-version change highlights. +Programmer and internal documentation: + libjpeg.txt How to use the JPEG library in your own programs. + example.c Sample code for calling the JPEG library. + structure.txt Overview of the JPEG library's internal structure. + coderules.txt Coding style rules --- please read if you contribute code. + +Please read at least usage.txt. Some information can also be found in the JPEG +FAQ (Frequently Asked Questions) article. See ARCHIVE LOCATIONS below to find +out where to obtain the FAQ article. + +If you want to understand how the JPEG code works, we suggest reading one or +more of the REFERENCES, then looking at the documentation files (in roughly +the order listed) before diving into the code. + +OVERVIEW +======== + +This package contains C software to implement JPEG image encoding, decoding, +and transcoding. JPEG (pronounced "jay-peg") is a standardized compression +method for full-color and grayscale images. JPEG's strong suit is compressing +photographic images or other types of images that have smooth color and +brightness transitions between neighboring pixels. Images with sharp lines or +other abrupt features may not compress well with JPEG, and a higher JPEG +quality may have to be used to avoid visible compression artifacts with such +images. + +JPEG is lossy, meaning that the output pixels are not necessarily identical to +the input pixels. However, on photographic content and other "smooth" images, +very good compression ratios can be obtained with no visible compression +artifacts, and extremely high compression ratios are possible if you are +willing to sacrifice image quality (by reducing the "quality" setting in the +compressor.) + +This software implements JPEG baseline, extended-sequential, and progressive +compression processes. Provision is made for supporting all variants of these +processes, although some uncommon parameter settings aren't implemented yet. +We have made no provision for supporting the hierarchical or lossless +processes defined in the standard. + +We provide a set of library routines for reading and writing JPEG image files, +plus two sample applications "cjpeg" and "djpeg", which use the library to +perform conversion between JPEG and some other popular image file formats. +The library is intended to be reused in other applications. + +In order to support file conversion and viewing software, we have included +considerable functionality beyond the bare JPEG coding/decoding capability; +for example, the color quantization modules are not strictly part of JPEG +decoding, but they are essential for output to colormapped file formats or +colormapped displays. These extra functions can be compiled out of the +library if not required for a particular application. + +We have also included "jpegtran", a utility for lossless transcoding between +different JPEG processes, and "rdjpgcom" and "wrjpgcom", two simple +applications for inserting and extracting textual comments in JFIF files. + +The emphasis in designing this software has been on achieving portability and +flexibility, while also making it fast enough to be useful. In particular, +the software is not intended to be read as a tutorial on JPEG. (See the +REFERENCES section for introductory material.) Rather, it is intended to +be reliable, portable, industrial-strength code. We do not claim to have +achieved that goal in every aspect of the software, but we strive for it. + +We welcome the use of this software as a component of commercial products. +No royalty is required, but we do ask for an acknowledgement in product +documentation, as described under LEGAL ISSUES. + +LEGAL ISSUES +============ + +In plain English: + +1. We don't promise that this software works. (But if you find any bugs, + please let us know!) +2. You can use this software for whatever you want. You don't have to pay us. +3. You may not pretend that you wrote this software. If you use it in a + program, you must acknowledge somewhere in your documentation that + you've used the IJG code. + +In legalese: + +The authors make NO WARRANTY or representation, either express or implied, +with respect to this software, its quality, accuracy, merchantability, or +fitness for a particular purpose. This software is provided "AS IS", and you, +its user, assume the entire risk as to its quality and accuracy. + +This software is copyright (C) 1991-2016, Thomas G. Lane, Guido Vollbeding. +All Rights Reserved except as specified below. + +Permission is hereby granted to use, copy, modify, and distribute this +software (or portions thereof) for any purpose, without fee, subject to these +conditions: +(1) If any part of the source code for this software is distributed, then this +README file must be included, with this copyright and no-warranty notice +unaltered; and any additions, deletions, or changes to the original files +must be clearly indicated in accompanying documentation. +(2) If only executable code is distributed, then the accompanying +documentation must state that "this software is based in part on the work of +the Independent JPEG Group". +(3) Permission for use of this software is granted only if the user accepts +full responsibility for any undesirable consequences; the authors accept +NO LIABILITY for damages of any kind. + +These conditions apply to any software derived from or based on the IJG code, +not just to the unmodified library. If you use our work, you ought to +acknowledge us. + +Permission is NOT granted for the use of any IJG author's name or company name +in advertising or publicity relating to this software or products derived from +it. This software may be referred to only as "the Independent JPEG Group's +software". + +We specifically permit and encourage the use of this software as the basis of +commercial products, provided that all warranty or liability claims are +assumed by the product vendor. + +The Unix configuration script "configure" was produced with GNU Autoconf. +It is copyright by the Free Software Foundation but is freely distributable. +The same holds for its supporting scripts (config.guess, config.sub, +ltmain.sh). Another support script, install-sh, is copyright by X Consortium +but is also freely distributable. + +The IJG distribution formerly included code to read and write GIF files. +To avoid entanglement with the Unisys LZW patent (now expired), GIF reading +support has been removed altogether, and the GIF writer has been simplified +to produce "uncompressed GIFs". This technique does not use the LZW +algorithm; the resulting GIF files are larger than usual, but are readable +by all standard GIF decoders. + +We are required to state that + "The Graphics Interchange Format(c) is the Copyright property of + CompuServe Incorporated. GIF(sm) is a Service Mark property of + CompuServe Incorporated." + +REFERENCES +========== + +We recommend reading one or more of these references before trying to +understand the innards of the JPEG software. + +The best short technical introduction to the JPEG compression algorithm is + Wallace, Gregory K. "The JPEG Still Picture Compression Standard", + Communications of the ACM, April 1991 (vol. 34 no. 4), pp. 30-44. +(Adjacent articles in that issue discuss MPEG motion picture compression, +applications of JPEG, and related topics.) If you don't have the CACM issue +handy, a PDF file containing a revised version of Wallace's article is +available at http://www.ijg.org/files/Wallace.JPEG.pdf. The file (actually +a preprint for an article that appeared in IEEE Trans. Consumer Electronics) +omits the sample images that appeared in CACM, but it includes corrections +and some added material. Note: the Wallace article is copyright ACM and IEEE, +and it may not be used for commercial purposes. + +A somewhat less technical, more leisurely introduction to JPEG can be found in +"The Data Compression Book" by Mark Nelson and Jean-loup Gailly, published by +M&T Books (New York), 2nd ed. 1996, ISBN 1-55851-434-1. This book provides +good explanations and example C code for a multitude of compression methods +including JPEG. It is an excellent source if you are comfortable reading C +code but don't know much about data compression in general. The book's JPEG +sample code is far from industrial-strength, but when you are ready to look +at a full implementation, you've got one here... + +The best currently available description of JPEG is the textbook "JPEG Still +Image Data Compression Standard" by William B. Pennebaker and Joan L. +Mitchell, published by Van Nostrand Reinhold, 1993, ISBN 0-442-01272-1. +Price US$59.95, 638 pp. The book includes the complete text of the ISO JPEG +standards (DIS 10918-1 and draft DIS 10918-2). + +The original JPEG standard is divided into two parts, Part 1 being the actual +specification, while Part 2 covers compliance testing methods. Part 1 is +titled "Digital Compression and Coding of Continuous-tone Still Images, +Part 1: Requirements and guidelines" and has document numbers ISO/IEC IS +10918-1, ITU-T T.81. Part 2 is titled "Digital Compression and Coding of +Continuous-tone Still Images, Part 2: Compliance testing" and has document +numbers ISO/IEC IS 10918-2, ITU-T T.83. + +The JPEG standard does not specify all details of an interchangeable file +format. For the omitted details we follow the "JFIF" conventions, revision +1.02. JFIF 1.02 has been adopted as an Ecma International Technical Report +and thus received a formal publication status. It is available as a free +download in PDF format from +http://www.ecma-international.org/publications/techreports/E-TR-098.htm. +A PostScript version of the JFIF document is available at +http://www.ijg.org/files/jfif.ps.gz. There is also a plain text version at +http://www.ijg.org/files/jfif.txt.gz, but it is missing the figures. + +The TIFF 6.0 file format specification can be obtained by FTP from +ftp://ftp.sgi.com/graphics/tiff/TIFF6.ps.gz. The JPEG incorporation scheme +found in the TIFF 6.0 spec of 3-June-92 has a number of serious problems. +IJG does not recommend use of the TIFF 6.0 design (TIFF Compression tag 6). +Instead, we recommend the JPEG design proposed by TIFF Technical Note #2 +(Compression tag 7). Copies of this Note can be obtained from +http://www.ijg.org/files/. It is expected that the next revision +of the TIFF spec will replace the 6.0 JPEG design with the Note's design. +Although IJG's own code does not support TIFF/JPEG, the free libtiff library +uses our library to implement TIFF/JPEG per the Note. + +ARCHIVE LOCATIONS +================= + +The "official" archive site for this software is www.ijg.org. +The most recent released version can always be found there in +directory "files". + +The JPEG FAQ (Frequently Asked Questions) article is a source of some +general information about JPEG. +It is available on the World Wide Web at http://www.faqs.org/faqs/jpeg-faq +and other news.answers archive sites, including the official news.answers +archive at rtfm.mit.edu: ftp://rtfm.mit.edu/pub/usenet/news.answers/jpeg-faq/. +If you don't have Web or FTP access, send e-mail to mail-server@rtfm.mit.edu +with body + send usenet/news.answers/jpeg-faq/part1 + send usenet/news.answers/jpeg-faq/part2 + +FILE FORMAT WARS +================ + +The ISO/IEC JTC1/SC29/WG1 standards committee (also known as JPEG, together +with ITU-T SG16) currently promotes different formats containing the name +"JPEG" which are incompatible with original DCT-based JPEG. IJG therefore does +not support these formats (see REFERENCES). Indeed, one of the original +reasons for developing this free software was to help force convergence on +common, interoperable format standards for JPEG files. +Don't use an incompatible file format! +(In any case, our decoder will remain capable of reading existing JPEG +image files indefinitely.) + +TO DO +===== + +Please send bug reports, offers of help, etc. to jpeg-info@jpegclub.org. +-------------------------------------------------------------------------------- +libsdl +skia + +Copyright 2016 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libwebp + +Copyright (c) 2010, Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libwebp + +Copyright 2010 Google Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libwebp + +Copyright 2011 Google Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libwebp + +Copyright 2012 Google Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libwebp + +Copyright 2013 Google Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libwebp + +Copyright 2014 Google Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libwebp + +Copyright 2015 Google Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libwebp + +Copyright 2016 Google Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +libwebp + +Copyright 2017 Google Inc. All Rights Reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + * Neither the name of Google nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +node_preamble + +The MIT License (MIT) + +Copyright (c) 2015 Michael Bullington + +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 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. + +=== + +Copyright 2012, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright (c) 2013, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + +* Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright (c) 2014, Michael Bostock and Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived from this + software without specific prior written permission + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT, +INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, +BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, +EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright (c) 2014, the Dart project authors. +Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright (c) 2017, the Dart project authors. +Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright 2013, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright 2014, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright 2015, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages + +Copyright 2016, the Dart project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +observatory_pub_packages +pkg + +Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +quiver + + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. +-------------------------------------------------------------------------------- +rapidjson + +Copyright (c) 2006-2013 Alexander Chemeris + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the product nor the names of its contributors may + be used to endorse or promote products derived from this software + without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED +WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +rapidjson + +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 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. +-------------------------------------------------------------------------------- +root_certificates + +Mozilla Public License +Version 2.0 + +1. Definitions + +1.1. “Contributor” + +means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. + +1.2. “Contributor Version” + +means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor’s Contribution. + +1.3. “Contribution” + +means Covered Software of a particular Contributor. + +1.4. “Covered Software” + +means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. + +1.5. “Incompatible With Secondary Licenses” + +means + + a. that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or + + b. that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. + +1.6. “Executable Form” + +means any form of the work other than Source Code Form. + +1.7. “Larger Work” + +means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. + +1.8. “License” + +means this document. + +1.9. “Licensable” + +means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. + +1.10. “Modifications” + +means any of the following: + + a. any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or + + b. any new file in Source Code Form that contains any Covered Software. + +1.11. “Patent Claims” of a Contributor + +means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. + +1.12. “Secondary License” + +means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. + +1.13. “Source Code Form” + +means the form of the work preferred for making modifications. + +1.14. “You” (or “Your”) + +means an individual or a legal entity exercising rights under this License. For legal entities, “You” includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, “control” means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. + +2. License Grants and Conditions + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: + + a. under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and + + b. under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: + + a. for any code that a Contributor has removed from Covered Software; or + + b. for infringements caused by: (i) Your and any other third party’s modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or + + c. under Patent Claims infringed by Covered Software in the absence of its Contributions. + +This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. + +3. Responsibilities + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients’ rights in the Source Code Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + + a. such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and + + b. You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients’ rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + +If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. + +6. Disclaimer of Warranty + + Covered Software is provided under this License on an “as is” basis, without warranty of any kind, either expressed, implied, or statutory, including, without limitation, warranties that the Covered Software is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the Covered Software is with You. Should any Covered Software prove defective in any respect, You (not any Contributor) assume the cost of any necessary servicing, repair, or correction. This disclaimer of warranty constitutes an essential part of this License. No use of any Covered Software is authorized under this License except under this disclaimer. + +7. Limitation of Liability + + Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall any Contributor, or anyone who distributes Covered Software as permitted above, be liable to You for any direct, indirect, special, incidental, or consequential damages of any character including, without limitation, damages for lost profits, loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party’s negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You. + +8. Litigation + +Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party’s ability to bring cross-claims or counter-claims. + +9. Miscellaneous + +This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. + +10. Versions of the License + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses + +If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - “Incompatible With Secondary Licenses” Notice + + This Source Code Form is “Incompatible With Secondary Licenses”, as defined by the Mozilla Public License, v. 2.0. +-------------------------------------------------------------------------------- +root_certificates + +Mozilla Public License Version 2.0 +================================== + +1. Definitions + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +* 6. Disclaimer of Warranty + +* Covered Software is provided under this License on an "as is" +* basis, without warranty of any kind, either expressed, implied, or +* statutory, including, without limitation, warranties that the +* Covered Software is free of defects, merchantable, fit for a +* particular purpose or non-infringing. The entire risk as to the +* quality and performance of the Covered Software is with You. +* Should any Covered Software prove defective in any respect, You +* (not any Contributor) assume the cost of any necessary servicing, +* repair, or correction. This disclaimer of warranty constitutes an +* essential part of this License. No use of any Covered Software is +* authorized under this License except under this disclaimer. + +* 7. Limitation of Liability + +* Under no circumstances and under no legal theory, whether tort +* (including negligence), contract, or otherwise, shall any +* Contributor, or anyone who distributes Covered Software as +* permitted above, be liable to You for any direct, indirect, +* special, incidental, or consequential damages of any character +* including, without limitation, damages for lost profits, loss of +* goodwill, work stoppage, computer failure or malfunction, or any +* and all other commercial damages or losses, even if such party +* shall have been informed of the possibility of such damages. This +* limitation of liability shall not apply to liability for death or +* personal injury resulting from such party's negligence to the +* extent applicable law prohibits such limitation. Some +* jurisdictions do not allow the exclusion or limitation of +* incidental or consequential damages, so this exclusion and +* limitation may not apply to You. + +8. Litigation + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. +-------------------------------------------------------------------------------- +skcms + +Copyright (c) 2018 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skcms +skia +vulkan +vulkanmemoryallocator + +Copyright 2018 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR +CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright (C) 2014 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright (c) 2011 Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright (c) 2014 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright (c) 2014-2016 The Khronos Group Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and/or associated documentation files (the "Materials"), +to deal in the Materials without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Materials, and to permit persons to whom the +Materials are 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 Materials. +-------------------------------------------------------------------------------- +skia + +Copyright (c) 2015 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2005 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2006 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2006-2012 The Android Open Source Project +Copyright 2012 Mozilla Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2007 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2008 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2008 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2009 Motorola + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2009 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2009-2015 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2010 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2010 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2011 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2011 Google Inc. +Copyright 2012 Mozilla Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2011 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2012 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2012 Intel Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2012 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2013 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2013 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2014 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2014 Google Inc. +Copyright 2017 ARM Ltd. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2014 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2015 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2015 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2016 Mozilla Foundation + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2016 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2017 ARM Ltd. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2017 Google Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2018 Google LLC + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2018 Google LLC. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2018 Google, LLC + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +Copyright 2018 The Android Open Source Project + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +skia + +NEON optimized code (C) COPYRIGHT 2009 Motorola + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +tcmalloc + +Copyright (c) 2003, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +tcmalloc + +Copyright (c) 2005, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +topaz + +Copyright 2016 The Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +topaz + +Copyright 2017 Th%e Fuchsia Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +topaz + +Copyright 2017, the Flutter project authors. Please see the AUTHORS file +for details. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +vector_math + +Copyright 2015, Google Inc. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------------------- +vulkanmemoryallocator + +Copyright (c) 2017-2018 Advanced Micro Devices, Inc. All rights reserved. + +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 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. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2003, 2010 Jean-loup Gailly. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2003, 2010 Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2005 Jean-loup Gailly. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2005, 2010 Jean-loup Gailly. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2005, 2010 Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2006, 2010 Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2007 Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2008, 2010 Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2009 Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2010 Jean-loup Gailly + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2010 Jean-loup Gailly +detect_data_type() function provided freely by Cosmin Truta, 2006 + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2010 Jean-loup Gailly. + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1995-2010 Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) + +Modifications for Zip64 support +Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) + +For more info read MiniZip_info.txt + +Condition of use and distribution are the same than zlib : + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 1998-2010 Gilles Vollant (minizip) ( http://www.winimage.com/zLibDll/minizip.html ) + +Modifications of Unzip for Zip64 +Copyright (C) 2007-2008 Even Rouault + +Modifications for Zip64 support on both zip and unzip +Copyright (C) 2009-2010 Mathias Svensson ( http://result42.com ) + +For more info read MiniZip_info.txt + +Condition of use and distribution are the same than zlib : + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 2004, 2005, 2010 Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 2004, 2010 Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 2013 Intel Corporation +Authors: + Arjan van de Ven + Jim Kukunas + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 2013 Intel Corporation Jim Kukunas + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 2013 Intel Corporation. All rights reserved. +Author: + Jim Kukunas + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 2013 Intel Corporation. All rights reserved. +Authors: + Wajdi Feghali + Jim Guilford + Vinodh Gopal + Erdinc Ozturk + Jim Kukunas + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (C) 2014 Intel Corporation + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +-------------------------------------------------------------------------------- +zlib + +Copyright (c) 2011 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +zlib + +Copyright (c) 2012 The Chromium Authors. All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. + * Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +-------------------------------------------------------------------------------- +zlib + +zlib.h -- interface of the 'zlib' general purpose compression library +version 1.2.4, March 14th, 2010 + +Copyright (C) 1995-2010 Jean-loup Gailly and Mark Adler + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. + +Jean-loup Gailly +Mark Adler diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/fonts/MaterialIcons-Regular.ttf b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/fonts/MaterialIcons-Regular.ttf new file mode 100644 index 00000000000..9519e1d75e8 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/fonts/MaterialIcons-Regular.ttf differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/isolate_snapshot_data b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/isolate_snapshot_data new file mode 100644 index 00000000000..bd2b61b191f Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/isolate_snapshot_data differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/kernel_blob.bin b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/kernel_blob.bin new file mode 100644 index 00000000000..01682c7b423 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/kernel_blob.bin differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/platform_strong.dill b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/platform_strong.dill new file mode 100644 index 00000000000..4b1ea432898 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/platform_strong.dill differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/vm_snapshot_data b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/vm_snapshot_data new file mode 100644 index 00000000000..6c10cae0dd2 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Flutter/flutter_assets/vm_snapshot_data differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner.xcodeproj/project.pbxproj b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner.xcodeproj/project.pbxproj new file mode 100644 index 00000000000..efd7d0a1e7f --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner.xcodeproj/project.pbxproj @@ -0,0 +1,436 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; + 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; }; + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; + 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 9705A1C41CF9048500538489 /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */, + 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; + 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; + 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; + 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; + 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; + 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; + 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 97C146EB1CF9000F007C117D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, + 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 9740EEB11CF90186004384FC /* Flutter */ = { + isa = PBXGroup; + children = ( + 3B80C3931E831B6300D905FE /* App.framework */, + 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, + 9740EEBA1CF902C7004384FC /* Flutter.framework */, + 9740EEB21CF90195004384FC /* Debug.xcconfig */, + 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, + 9740EEB31CF90195004384FC /* Generated.xcconfig */, + ); + name = Flutter; + sourceTree = ""; + }; + 97C146E51CF9000F007C117D = { + isa = PBXGroup; + children = ( + 9740EEB11CF90186004384FC /* Flutter */, + 97C146F01CF9000F007C117D /* Runner */, + 97C146EF1CF9000F007C117D /* Products */, + CF3B75C9A7D2FA2A4C99F110 /* Frameworks */, + ); + sourceTree = ""; + }; + 97C146EF1CF9000F007C117D /* Products */ = { + isa = PBXGroup; + children = ( + 97C146EE1CF9000F007C117D /* Runner.app */, + ); + name = Products; + sourceTree = ""; + }; + 97C146F01CF9000F007C117D /* Runner */ = { + isa = PBXGroup; + children = ( + 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */, + 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */, + 97C146FA1CF9000F007C117D /* Main.storyboard */, + 97C146FD1CF9000F007C117D /* Assets.xcassets */, + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */, + 97C147021CF9000F007C117D /* Info.plist */, + 97C146F11CF9000F007C117D /* Supporting Files */, + 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */, + 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */, + ); + path = Runner; + sourceTree = ""; + }; + 97C146F11CF9000F007C117D /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 97C146F21CF9000F007C117D /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 97C146ED1CF9000F007C117D /* Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; + buildPhases = ( + 9740EEB61CF901F6004384FC /* Run Script */, + 97C146EA1CF9000F007C117D /* Sources */, + 97C146EB1CF9000F007C117D /* Frameworks */, + 97C146EC1CF9000F007C117D /* Resources */, + 9705A1C41CF9048500538489 /* Embed Frameworks */, + 3B06AD1E1E4923F5004D2608 /* Thin Binary */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Runner; + productName = Runner; + productReference = 97C146EE1CF9000F007C117D /* Runner.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 97C146E61CF9000F007C117D /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0910; + ORGANIZATIONNAME = "The Chromium Authors"; + TargetAttributes = { + 97C146ED1CF9000F007C117D = { + CreatedOnToolsVersion = 7.3.1; + }; + }; + }; + buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 97C146E51CF9000F007C117D; + productRefGroup = 97C146EF1CF9000F007C117D /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 97C146ED1CF9000F007C117D /* Runner */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 97C146EC1CF9000F007C117D /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, + 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */, + 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, + 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, + 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, + 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Thin Binary"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin"; + }; + 9740EEB61CF901F6004384FC /* Run Script */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Script"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 97C146EA1CF9000F007C117D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */, + 97C146F31CF9000F007C117D /* main.m in Sources */, + 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 97C146FA1CF9000F007C117D /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C146FB1CF9000F007C117D /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = { + isa = PBXVariantGroup; + children = ( + 97C147001CF9000F007C117D /* Base */, + ); + name = LaunchScreen.storyboard; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 97C147031CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + 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_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + 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_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_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + 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; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 97C147041CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + 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_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + 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_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_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + 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; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 97C147061CF9000F007C117D /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ARCHS = arm64; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.flutterPetstore; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 97C147071CF9000F007C117D /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; + buildSettings = { + ARCHS = arm64; + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.yourcompany.flutterPetstore; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147031CF9000F007C117D /* Debug */, + 97C147041CF9000F007C117D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 97C147061CF9000F007C117D /* Debug */, + 97C147071CF9000F007C117D /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 97C146E61CF9000F007C117D /* Project object */; +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..1d526a16ed0 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme new file mode 100644 index 00000000000..1263ac84b10 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -0,0 +1,93 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner.xcworkspace/contents.xcworkspacedata b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000000..1d526a16ed0 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/AppDelegate.h b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/AppDelegate.h new file mode 100644 index 00000000000..cf210d213f2 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/AppDelegate.h @@ -0,0 +1,6 @@ +#import +#import + +@interface AppDelegate : FlutterAppDelegate + +@end diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/AppDelegate.m b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/AppDelegate.m new file mode 100644 index 00000000000..112becd13b3 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/AppDelegate.m @@ -0,0 +1,12 @@ +#include "AppDelegate.h" +#include "GeneratedPluginRegistrant.h" + +@implementation AppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + [GeneratedPluginRegistrant registerWithRegistry:self]; + // Override point for customization after application launch. + return [super application:application didFinishLaunchingWithOptions:launchOptions]; +} + +@end diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000000..d22f10b2ab6 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,116 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "Icon-App-20x20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "Icon-App-29x29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "Icon-App-40x40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "Icon-App-60x60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@1x.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "Icon-App-20x20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@1x.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "Icon-App-29x29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@1x.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "Icon-App-40x40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@1x.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "Icon-App-76x76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-App-83.5x83.5@2x.png", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png new file mode 100644 index 00000000000..28c6bf03016 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png new file mode 100644 index 00000000000..2ccbfd967d9 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png new file mode 100644 index 00000000000..f091b6b0bca Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png new file mode 100644 index 00000000000..4cde12118dd Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png new file mode 100644 index 00000000000..d0ef06e7edb Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png new file mode 100644 index 00000000000..dcdc2306c28 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png new file mode 100644 index 00000000000..2ccbfd967d9 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png new file mode 100644 index 00000000000..c8f9ed8f5ce Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png new file mode 100644 index 00000000000..a6d6b8609df Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png new file mode 100644 index 00000000000..a6d6b8609df Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png new file mode 100644 index 00000000000..75b2d164a5a Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png new file mode 100644 index 00000000000..c4df70d39da Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png new file mode 100644 index 00000000000..6a84f41e14e Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png new file mode 100644 index 00000000000..d0e1f585360 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json new file mode 100644 index 00000000000..0bedcf2fd46 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchImage.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchImage@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png new file mode 100644 index 00000000000..9da19eacad3 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png new file mode 100644 index 00000000000..9da19eacad3 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png new file mode 100644 index 00000000000..9da19eacad3 Binary files /dev/null and b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md new file mode 100644 index 00000000000..89c2725b70f --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md @@ -0,0 +1,5 @@ +# Launch Screen Assets + +You can customize the launch screen with your own desired assets by replacing the image files in this directory. + +You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images. \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Base.lproj/LaunchScreen.storyboard b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Base.lproj/LaunchScreen.storyboard new file mode 100644 index 00000000000..f2e259c7c93 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Base.lproj/Main.storyboard b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Base.lproj/Main.storyboard new file mode 100644 index 00000000000..f3c28516fb3 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Base.lproj/Main.storyboard @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Info.plist b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Info.plist new file mode 100644 index 00000000000..b5a04ef774f --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/Info.plist @@ -0,0 +1,49 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + flutter_petstore + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + arm64 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UIViewControllerBasedStatusBarAppearance + + + diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/main.m b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/main.m new file mode 100644 index 00000000000..0ccc450011c --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/ios/Runner/main.m @@ -0,0 +1,9 @@ +#import +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/lib/main.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/lib/main.dart new file mode 100644 index 00000000000..bacf47c5dca --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/lib/main.dart @@ -0,0 +1,172 @@ +import 'package:flutter/material.dart'; +import 'package:http/http.dart'; +import 'package:openapi/api.dart'; +import 'package:openapi/model/order.dart'; +import 'package:openapi/model/pet.dart'; +import 'package:openapi/model/user.dart'; +import 'package:jaguar_resty/jaguar_resty.dart'; + + +void main() { + globalClient = IOClient(); + runApp(MyApp()); +} + +class MyApp extends StatelessWidget { + // This widget is the root of your application. + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Flutter Demo', + theme: ThemeData( + // This is the theme of your application. + // + // Try running your application with "flutter run". You'll see the + // application has a blue toolbar. Then, without quitting the app, try + // changing the primarySwatch below to Colors.green and then invoke + // "hot reload" (press "r" in the console where you ran "flutter run", + // or press Run > Flutter Hot Reload in IntelliJ). Notice that the + // counter didn't reset back to zero; the application is not restarted. + primarySwatch: Colors.blue, + ), + home: MyHomePage(title: 'Flutter Demo Home Page'), + ); + } +} + +class MyHomePage extends StatefulWidget { + MyHomePage({Key key, this.title}) : super(key: key); + + // This widget is the home page of your application. It is stateful, meaning + // that it has a State object (defined below) that contains fields that affect + // how it looks. + + // This class is the configuration for the state. It holds the values (in this + // case the title) provided by the parent (in this case the App widget) and + // used by the build method of the State. Fields in a Widget subclass are + // always marked "final". + + final String title; + + @override + _MyHomePageState createState() => _MyHomePageState(); +} + +class _MyHomePageState extends State { + int _counter = 0; + JaguarApiGen jaguarApiGen = JaguarApiGen(); + + void _incrementCounter() { + setState(() { + // This call to setState tells the Flutter framework that something has + // changed in this State, which causes it to rerun the build method below + // so that the display can reflect the updated values. If we changed + // _counter without calling setState(), then the build method would not be + // called again, and so nothing would appear to happen. + _counter++; + }); + } + + @override + void initState() { + super.initState(); + fetchPets(); + fetchStoreInventory(); + fetchUser(); + } + + void fetchPets() { + print('fetching pets by status...'); + var statuses = List(); + statuses.add('available'); + jaguarApiGen.getPetApi().findPetsByStatus(statuses) + .then((List pets) { + print('pets received: '); + print(pets); + var order = Order(petId: pets[0].id, quantity: 1); + jaguarApiGen.getStoreApi().placeOrder(order) + .then((Order order) => print(order)); + }).catchError((error) { + print('error fetching pets'); + throw error; + }); + } + + void fetchStoreInventory() { + print('fetching inventory...'); + jaguarApiGen.getStoreApi().getInventory() + .then((Map inventory) { + print('inventory received: '); + print(inventory); + }).catchError((error) { + print('error fetching inventory'); + throw error; + }); + } + + void fetchUser() { + print('fetching user1...'); + jaguarApiGen.getUserApi().getUserByName('user1') + .then((User user) { + print('user received: '); + print(user); + }).catchError((error) { + print('error fetching user'); + throw error; + }); + } + + @override + Widget build(BuildContext context) { + // This method is rerun every time setState is called, for instance as done + // by the _incrementCounter method above. + // + // The Flutter framework has been optimized to make rerunning build methods + // fast, so that you can just rebuild anything that needs updating rather + // than having to individually change instances of widgets. + return Scaffold( + appBar: AppBar( + // Here we take the value from the MyHomePage object that was created by + // the App.build method, and use it to set our appbar title. + title: Text(widget.title), + ), + body: Center( + // Center is a layout widget. It takes a single child and positions it + // in the middle of the parent. + child: Column( + // Column is also layout widget. It takes a list of children and + // arranges them vertically. By default, it sizes itself to fit its + // children horizontally, and tries to be as tall as its parent. + // + // Invoke "debug paint" (press "p" in the console where you ran + // "flutter run", or select "Toggle Debug Paint" from the Flutter tool + // window in IntelliJ) to see the wireframe for each widget. + // + // Column has various properties to control how it sizes itself and + // how it positions its children. Here we use mainAxisAlignment to + // center the children vertically; the main axis here is the vertical + // axis because Columns are vertical (the cross axis would be + // horizontal). + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'You have pushed the button this many times:', + ), + Text( + '$_counter', + style: Theme + .of(context) + .textTheme + .display1, + ), + ], + ), + ), + floatingActionButton: FloatingActionButton( + onPressed: _incrementCounter, + tooltip: 'Increment', + child: Icon(Icons.add), + ), // This trailing comma makes auto-formatting nicer for build methods. + ); + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/.analysis_options b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/.analysis_options new file mode 100644 index 00000000000..518eb901a6f --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/.gitignore b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/.gitignore new file mode 100644 index 00000000000..7c280441649 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/.gitignore @@ -0,0 +1,27 @@ +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/.openapi-generator-ignore b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/.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/dart-jaguar/flutter_petstore/openapi/.openapi-generator/VERSION b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/.openapi-generator/VERSION new file mode 100644 index 00000000000..f4cb97d56ce --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/README.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/README.md new file mode 100644 index 00000000000..4e85ae7a928 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/README.md @@ -0,0 +1,131 @@ +# openapi +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +This Dart package is automatically generated by the [Open API Codegen](https://github.com/OpenAPITools/openapi-generator) project: + +- API version: 1.0.0 +- Build date: 2018-10-08T15:27:22.304+08:00[Asia/Hong_Kong] +- Build package: org.openapitools.codegen.languages.DartJaguarClientCodegen + +## Requirements + +Dart 2 or later OR Flutter 0.7.0 or later. + +Once your code is generated, you need to run the build_runner command to let Jaguar implement your API: + +```sh +flutter packages pub run build_runner build +or +pub run build_runner build +``` + +## Installation & Usage + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +``` +name: openapi +version: 1.0.0 +description: OpenAPI API client +dependencies: + openapi: + git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + version: 'any' +``` + +### Local +To use the package in your local drive, please include the following in pubspec.yaml +``` +dependencies: + openapi: + path: /path/to/openapi +``` + +## Tests + +TODO + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/api.dart'; + +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +final jaguarApiGen = JaguarApiGen(); +var api_instance = jaguarApiGen.getPetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print("Exception when calling PetApi->addPet: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*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 +*StoreApi* | [**deleteOrder**](docs//StoreApi.md#deleteorder) | **Delete** /store/order/:orderId | 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/:orderId | 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 + + - [ApiResponse](docs//ApiResponse.md) + - [Category](docs//Category.md) + - [Order](docs//Order.md) + - [Pet](docs//Pet.md) + - [Tag](docs//Tag.md) + - [User](docs//User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## 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/dart-jaguar/flutter_petstore/openapi/analysis_options.yaml b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/analysis_options.yaml new file mode 100644 index 00000000000..518eb901a6f --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/analysis_options.yaml @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/ApiResponse.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/ApiResponse.md @@ -0,0 +1,17 @@ +# openapi.model.ApiResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] [default to null] +**type** | **String** | | [optional] [default to null] +**message** | **String** | | [optional] [default to null] + +[[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/dart-jaguar/flutter_petstore/openapi/docs/Category.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**name** | **String** | | [optional] [default to null] + +[[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/dart-jaguar/flutter_petstore/openapi/docs/Order.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**petId** | **int** | | [optional] [default to null] +**quantity** | **int** | | [optional] [default to null] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] +**status** | **String** | Order Status | [optional] [default to null] +**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/dart-jaguar/flutter_petstore/openapi/docs/Pet.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Pet.md new file mode 100644 index 00000000000..ce5708cc134 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**category** | [**Category**](Category.md) | | [optional] [default to null] +**name** | **String** | | [default to null] +**photoUrls** | **List<String>** | | [default to const []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to const []] +**status** | **String** | pet status in the store | [optional] [default to null] + +[[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/dart-jaguar/flutter_petstore/openapi/docs/PetApi.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/PetApi.md new file mode 100644 index 00000000000..cf3e3652d48 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/PetApi.md @@ -0,0 +1,379 @@ +# openapi.api.PetApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> addPet(pet) + +Add a new pet to the store + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print("Exception when calling PetApi->addPet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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** +> deletePet(petId, apiKey) + +Deletes a pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | Pet id to delete +var apiKey = apiKey_example; // String | + +try { + api_instance.deletePet(petId, apiKey); +} catch (e) { + print("Exception when calling PetApi->deletePet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| Pet id to delete | [default to null] + **apiKey** | **String**| | [optional] [default to null] + +### 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** +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var status = []; // List | Status values that need to be considered for filter + +try { + var result = api_instance.findPetsByStatus(status); + print(result); +} catch (e) { + print("Exception when calling PetApi->findPetsByStatus: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] + +### Return type + +[**List**](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** +> List findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var tags = []; // List | Tags to filter by + +try { + var result = api_instance.findPetsByTags(tags); + print(result); +} catch (e) { + print("Exception when calling PetApi->findPetsByTags: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] + +### Return type + +[**List**](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** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to return + +try { + var result = api_instance.getPetById(petId); + print(result); +} catch (e) { + print("Exception when calling PetApi->getPetById: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to return | [default to null] + +### 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** +> updatePet(pet) + +Update an existing pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.updatePet(pet); +} catch (e) { + print("Exception when calling PetApi->updatePet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet that needs to be updated +var name = name_example; // String | Updated name of the pet +var status = status_example; // String | Updated status of the pet + +try { + api_instance.updatePetWithForm(petId, name, status); +} catch (e) { + print("Exception when calling PetApi->updatePetWithForm: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet that needs to be updated | [default to null] + **name** | **String**| Updated name of the pet | [optional] [default to null] + **status** | **String**| Updated status of the pet | [optional] [default to null] + +### 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** +> ApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to update +var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +var file = BINARY_DATA_HERE; // MultipartFile | file to upload + +try { + var result = api_instance.uploadFile(petId, additionalMetadata, file); + print(result); +} catch (e) { + print("Exception when calling PetApi->uploadFile: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **file** | **MultipartFile****MultipartFile**| file to upload | [optional] [default to null] + +### 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/dart-jaguar/flutter_petstore/openapi/docs/StoreApi.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/StoreApi.md new file mode 100644 index 00000000000..3616adc6336 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/StoreApi.md @@ -0,0 +1,186 @@ +# openapi.api.StoreApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> 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 +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var orderId = orderId_example; // String | ID of the order that needs to be deleted + +try { + api_instance.deleteOrder(orderId); +} catch (e) { + print("Exception when calling StoreApi->deleteOrder: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | [default to null] + +### 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** +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; + +var api_instance = new StoreApi(); + +try { + var result = api_instance.getInventory(); + print(result); +} catch (e) { + print("Exception when calling StoreApi->getInventory: $e\n"); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Map** + +### 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** +> 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 +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var orderId = 789; // int | ID of pet that needs to be fetched + +try { + var result = api_instance.getOrderById(orderId); + print(result); +} catch (e) { + print("Exception when calling StoreApi->getOrderById: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **int**| ID of pet that needs to be fetched | [default to null] + +### 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** +> Order placeOrder(order) + +Place an order for a pet + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var order = new Order(); // Order | order placed for purchasing the pet + +try { + var result = api_instance.placeOrder(order); + print(result); +} catch (e) { + print("Exception when calling StoreApi->placeOrder: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**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/dart-jaguar/flutter_petstore/openapi/docs/Tag.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**name** | **String** | | [optional] [default to null] + +[[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/dart-jaguar/flutter_petstore/openapi/docs/User.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**username** | **String** | | [optional] [default to null] +**firstName** | **String** | | [optional] [default to null] +**lastName** | **String** | | [optional] [default to null] +**email** | **String** | | [optional] [default to null] +**password** | **String** | | [optional] [default to null] +**phone** | **String** | | [optional] [default to null] +**userStatus** | **int** | User Status | [optional] [default to null] + +[[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/dart-jaguar/flutter_petstore/openapi/docs/UserApi.md b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/UserApi.md new file mode 100644 index 00000000000..eef7344a19c --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/docs/UserApi.md @@ -0,0 +1,349 @@ +# openapi.api.UserApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = new User(); // User | Created user object + +try { + api_instance.createUser(user); +} catch (e) { + print("Exception when calling UserApi->createUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**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** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = [new List<User>()]; // List | List of user object + +try { + api_instance.createUsersWithArrayInput(user); +} catch (e) { + print("Exception when calling UserApi->createUsersWithArrayInput: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](List.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** +> createUsersWithListInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = [new List<User>()]; // List | List of user object + +try { + api_instance.createUsersWithListInput(user); +} catch (e) { + print("Exception when calling UserApi->createUsersWithListInput: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](List.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** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The name that needs to be deleted + +try { + api_instance.deleteUser(username); +} catch (e) { + print("Exception when calling UserApi->deleteUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | [default to null] + +### 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** +> User getUserByName(username) + +Get user by user name + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + +try { + var result = api_instance.getUserByName(username); + print(result); +} catch (e) { + print("Exception when calling UserApi->getUserByName: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] + +### 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** +> String loginUser(username, password) + +Logs user into the system + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The user name for login +var password = password_example; // String | The password for login in clear text + +try { + var result = api_instance.loginUser(username, password); + print(result); +} catch (e) { + print("Exception when calling UserApi->loginUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | [default to null] + **password** | **String**| The password for login in clear text | [default to null] + +### 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** +> logoutUser() + +Logs out current logged in user session + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); + +try { + api_instance.logoutUser(); +} catch (e) { + print("Exception when calling UserApi->logoutUser: $e\n"); +} +``` + +### 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** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | name that need to be deleted +var user = new User(); // User | Updated user object + +try { + api_instance.updateUser(username, user); +} catch (e) { + print("Exception when calling UserApi->updateUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | [default to null] + **user** | [**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/dart-jaguar/flutter_petstore/openapi/git_push.sh b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/git_push.sh new file mode 100644 index 00000000000..83553a63a41 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +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://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api.dart new file mode 100644 index 00000000000..e1aa03d6840 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api.dart @@ -0,0 +1,117 @@ +library openapi.api; + +import 'package:http/http.dart'; +import 'package:jaguar_serializer/jaguar_serializer.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; +import 'package:openapi/auth/api_key_auth.dart'; +import 'package:openapi/auth/basic_auth.dart'; +import 'package:openapi/auth/oauth.dart'; + +import 'package:openapi/api/pet_api.dart'; +import 'package:openapi/api/store_api.dart'; +import 'package:openapi/api/user_api.dart'; + +import 'package:openapi/model/api_response.dart'; +import 'package:openapi/model/category.dart'; +import 'package:openapi/model/order.dart'; +import 'package:openapi/model/pet.dart'; +import 'package:openapi/model/tag.dart'; +import 'package:openapi/model/user.dart'; + +final jsonJaguarRepo = JsonRepo() + ..add(ApiResponseSerializer()) + ..add(CategorySerializer()) + ..add(OrderSerializer()) + ..add(PetSerializer()) + ..add(TagSerializer()) + ..add(UserSerializer()); + +final _defaultInterceptors = [ + OAuthInterceptor(), + BasicAuthInterceptor(), + ApiKeyAuthInterceptor() +]; + +class JaguarApiGen { + List interceptors; + String basePath = "http://petstore.swagger.io/v2"; + Route _baseRoute; + + /** + * Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added) + */ + JaguarApiGen( + {List interceptors, + bool overrideInterceptors = false, + String baseUrl}) { + _baseRoute = + Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient()); + if (interceptors == null) { + this.interceptors = _defaultInterceptors; + } else if (overrideInterceptors) { + this.interceptors = interceptors; + } else { + this.interceptors = List.from(_defaultInterceptors)..addAll(interceptors); + } + + this.interceptors.forEach((interceptor) { + _baseRoute.before(interceptor.before); + _baseRoute.after(interceptor.after); + }); + } + + void setOAuthToken(String name, String token) { + (_defaultInterceptors[0] as OAuthInterceptor).tokens[name] = token; + } + + void setBasicAuth(String name, String username, String password) { + (_defaultInterceptors[1] as BasicAuthInterceptor).authInfo[name] = + BasicAuthInfo(username, password); + } + + void setApiKey(String name, String apiKey) { + (_defaultInterceptors[2] as ApiKeyAuthInterceptor).apiKeys[name] = apiKey; + } + + /** + * Get PetApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + PetApi getPetApi({Route base, SerializerRepo serializers}) { + if (base == null) { + base = _baseRoute; + } + if (serializers == null) { + serializers = jsonJaguarRepo; + } + return PetApi(base: base, serializers: serializers); + } + + /** + * Get StoreApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + StoreApi getStoreApi({Route base, SerializerRepo serializers}) { + if (base == null) { + base = _baseRoute; + } + if (serializers == null) { + serializers = jsonJaguarRepo; + } + return StoreApi(base: base, serializers: serializers); + } + + /** + * Get UserApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + UserApi getUserApi({Route base, SerializerRepo serializers}) { + if (base == null) { + base = _baseRoute; + } + if (serializers == null) { + serializers = jsonJaguarRepo; + } + return UserApi(base: base, serializers: serializers); + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/pet_api.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/pet_api.dart new file mode 100644 index 00000000000..ae5f7e9c158 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/pet_api.dart @@ -0,0 +1,99 @@ +import 'package:jaguar_retrofit/annotations/annotations.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; +import 'package:jaguar_serializer/jaguar_serializer.dart'; +import 'package:jaguar_serializer/src/repo/repo.dart'; +import 'dart:async'; + +import 'package:openapi/model/pet.dart'; +import 'package:openapi/model/api_response.dart'; + + +part 'pet_api.jretro.dart'; + +@GenApiClient() +class PetApi extends _$PetApiClient implements ApiClient { + final Route base; + final SerializerRepo serializers; + + PetApi({this.base, this.serializers}); + + /// Add a new pet to the store + /// + /// + @PostReq(path: "/pet", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future addPet( + + @AsJson() Pet pet + ); + + /// Deletes a pet + /// + /// + @DeleteReq(path: "/pet/:petId", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future deletePet( + @PathParam("petId") int petId + , + @Header("api_key") String apiKey + ); + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + @GetReq(path: "/pet/findByStatus", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future> findPetsByStatus( + + @QueryParam("status") List status + ); + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + @GetReq(path: "/pet/findByTags", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future> findPetsByTags( + + @QueryParam("tags") List tags + ); + + /// Find pet by ID + /// + /// Returns a single pet + @GetReq(path: "/pet/:petId", metadata: {"auth": [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }]}) + Future getPetById( + @PathParam("petId") int petId + ); + + /// Update an existing pet + /// + /// + @PutReq(path: "/pet", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future updatePet( + + @AsJson() Pet pet + ); + + /// Updates a pet in the store with form data + /// + /// + @PostReq(path: "/pet/:petId", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future updatePetWithForm( + @PathParam("petId") int petId + , + @AsFormField() String name, + + @AsFormField() String status + ); + + /// uploads an image + /// + /// + @PostReq(path: "/pet/:petId/uploadImage", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future uploadFile( + @PathParam("petId") int petId + , + @AsMultipartField() String additionalMetadata, + + @AsMultipartField() MultipartFile file + ); + + +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/pet_api.jretro.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/pet_api.jretro.dart new file mode 100644 index 00000000000..2abc826f194 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/pet_api.jretro.dart @@ -0,0 +1,146 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'pet_api.dart'; + +// ************************************************************************** +// JaguarHttpGenerator +// ************************************************************************** + +abstract class _$PetApiClient implements ApiClient { + final String basePath = ""; + Future addPet(Pet pet) async { + var req = base.post + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet") + .json(serializers.to(pet)); + await req.go(); + } + + Future deletePet(int petId, String apiKey) async { + var req = base.delete + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet/:petId") + .pathParams("petId", petId) + .header("api_key", apiKey); + await req.go(); + } + + Future> findPetsByStatus(List status) async { + var req = base.get + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet/findByStatus") + .query("status", status); + return req.list(convert: serializers.oneFrom); + } + + Future> findPetsByTags(List tags) async { + var req = base.get + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet/findByTags") + .query("tags", tags); + return req.list(convert: serializers.oneFrom); + } + + Future getPetById(int petId) async { + var req = base.get + .metadata({ + "auth": [ + { + "type": "apiKey", + "name": "api_key", + "keyName": "api_key", + "where": "header", + } + ], + }) + .path(basePath) + .path("/pet/:petId") + .pathParams("petId", petId); + return req.one(convert: serializers.oneFrom); + } + + Future updatePet(Pet pet) async { + var req = base.put + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet") + .json(serializers.to(pet)); + await req.go(); + } + + Future updatePetWithForm(int petId, String name, String status) async { + var req = base.post + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet/:petId") + .pathParams("petId", petId) + .urlEncodedFormField(name, name) + .urlEncodedFormField(status, status); + await req.go(); + } + + Future uploadFile( + int petId, String additionalMetadata, MultipartFile file) async { + var req = base.post + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet/:petId/uploadImage") + .pathParams("petId", petId) + .multipart({"additionalMetadata": additionalMetadata}) + .multipart({"file": file}); + return req.one(convert: serializers.oneFrom); + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/store_api.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/store_api.dart new file mode 100644 index 00000000000..b0e40104275 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/store_api.dart @@ -0,0 +1,52 @@ +import 'package:jaguar_retrofit/annotations/annotations.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; +import 'package:jaguar_serializer/jaguar_serializer.dart'; +import 'package:jaguar_serializer/src/repo/repo.dart'; +import 'dart:async'; + +import 'package:openapi/model/order.dart'; + + +part 'store_api.jretro.dart'; + +@GenApiClient() +class StoreApi extends _$StoreApiClient implements ApiClient { + final Route base; + final SerializerRepo serializers; + + StoreApi({this.base, this.serializers}); + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + @DeleteReq(path: "/store/order/:orderId") + Future deleteOrder( + @PathParam("orderId") String orderId + ); + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + @GetReq(path: "/store/inventory", metadata: {"auth": [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }]}) + Future> getInventory( + ); + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + @GetReq(path: "/store/order/:orderId") + Future getOrderById( + @PathParam("orderId") int orderId + ); + + /// Place an order for a pet + /// + /// + @PostReq(path: "/store/order") + Future placeOrder( + + @AsJson() Order order + ); + + +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/store_api.jretro.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/store_api.jretro.dart new file mode 100644 index 00000000000..f3d3468b34b --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/store_api.jretro.dart @@ -0,0 +1,51 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'store_api.dart'; + +// ************************************************************************** +// JaguarHttpGenerator +// ************************************************************************** + +abstract class _$StoreApiClient implements ApiClient { + final String basePath = ""; + Future deleteOrder(String orderId) async { + var req = base.delete + .path(basePath) + .path("/store/order/:orderId") + .pathParams("orderId", orderId); + await req.go(); + } + + Future> getInventory() async { + var req = base.get + .metadata({ + "auth": [ + { + "type": "apiKey", + "name": "api_key", + "keyName": "api_key", + "where": "header", + } + ], + }) + .path(basePath) + .path("/store/inventory"); + return req.one().then((v) => serializers.mapFrom(v)); + } + + Future getOrderById(int orderId) async { + var req = base.get + .path(basePath) + .path("/store/order/:orderId") + .pathParams("orderId", orderId); + return req.one(convert: serializers.oneFrom); + } + + Future placeOrder(Order order) async { + var req = base.post + .path(basePath) + .path("/store/order") + .json(serializers.to(order)); + return req.one(convert: serializers.oneFrom); + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/user_api.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/user_api.dart new file mode 100644 index 00000000000..337375075c2 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/user_api.dart @@ -0,0 +1,91 @@ +import 'package:jaguar_retrofit/annotations/annotations.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; +import 'package:jaguar_serializer/jaguar_serializer.dart'; +import 'package:jaguar_serializer/src/repo/repo.dart'; +import 'dart:async'; + +import 'package:openapi/model/user.dart'; + + +part 'user_api.jretro.dart'; + +@GenApiClient() +class UserApi extends _$UserApiClient implements ApiClient { + final Route base; + final SerializerRepo serializers; + + UserApi({this.base, this.serializers}); + + /// Create user + /// + /// This can only be done by the logged in user. + @PostReq(path: "/user") + Future createUser( + + @AsJson() User user + ); + + /// Creates list of users with given input array + /// + /// + @PostReq(path: "/user/createWithArray") + Future createUsersWithArrayInput( + + @AsJson() List user + ); + + /// Creates list of users with given input array + /// + /// + @PostReq(path: "/user/createWithList") + Future createUsersWithListInput( + + @AsJson() List user + ); + + /// Delete user + /// + /// This can only be done by the logged in user. + @DeleteReq(path: "/user/:username") + Future deleteUser( + @PathParam("username") String username + ); + + /// Get user by user name + /// + /// + @GetReq(path: "/user/:username") + Future getUserByName( + @PathParam("username") String username + ); + + /// Logs user into the system + /// + /// + @GetReq(path: "/user/login") + Future loginUser( + + @QueryParam("username") String username, + + @QueryParam("password") String password + ); + + /// Logs out current logged in user session + /// + /// + @GetReq(path: "/user/logout") + Future logoutUser( + ); + + /// Updated user + /// + /// This can only be done by the logged in user. + @PutReq(path: "/user/:username") + Future updateUser( + @PathParam("username") String username + , + @AsJson() User user + ); + + +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/user_api.jretro.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/user_api.jretro.dart new file mode 100644 index 00000000000..5b68c3b0faf --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/api/user_api.jretro.dart @@ -0,0 +1,70 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_api.dart'; + +// ************************************************************************** +// JaguarHttpGenerator +// ************************************************************************** + +abstract class _$UserApiClient implements ApiClient { + final String basePath = ""; + Future createUser(User user) async { + var req = base.post.path(basePath).path("/user").json(serializers.to(user)); + await req.go(); + } + + Future createUsersWithArrayInput(List user) async { + var req = base.post + .path(basePath) + .path("/user/createWithArray") + .json(serializers.to(user)); + await req.go(); + } + + Future createUsersWithListInput(List user) async { + var req = base.post + .path(basePath) + .path("/user/createWithList") + .json(serializers.to(user)); + await req.go(); + } + + Future deleteUser(String username) async { + var req = base.delete + .path(basePath) + .path("/user/:username") + .pathParams("username", username); + await req.go(); + } + + Future getUserByName(String username) async { + var req = base.get + .path(basePath) + .path("/user/:username") + .pathParams("username", username); + return req.one(convert: serializers.oneFrom); + } + + Future loginUser(String username, String password) async { + var req = base.get + .path(basePath) + .path("/user/login") + .query("username", username) + .query("password", password); + return req.one(); + } + + Future logoutUser() async { + var req = base.get.path(basePath).path("/user/logout"); + await req.go(); + } + + Future updateUser(String username, User user) async { + var req = base.put + .path(basePath) + .path("/user/:username") + .pathParams("username", username) + .json(serializers.to(user)); + await req.go(); + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/auth/api_key_auth.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/auth/api_key_auth.dart new file mode 100644 index 00000000000..82c9499ae83 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/auth/api_key_auth.dart @@ -0,0 +1,33 @@ +import 'dart:async'; +import 'package:openapi/auth/auth.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + Map apiKeys = {}; + + @override + FutureOr before(RouteBase route) { + final authInfo = getAuthInfo(route, "apiKey"); + for (var info in authInfo) { + final authName = info["name"]; + final authKeyName = info["keyName"]; + final authWhere = info["where"]; + final apiKey = apiKeys[authName]; + if(apiKey != null) { + if(authWhere == 'query'){ + route.query(authKeyName, apiKey); + } + else { + route.header(authKeyName, apiKey); + } + break; + } + } + return super.before(route); + } + + @override + FutureOr after(StringResponse response) { + return Future.value(response); + } +} \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/auth/auth.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/auth/auth.dart new file mode 100644 index 00000000000..0df893561a6 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/auth/auth.dart @@ -0,0 +1,23 @@ +import 'dart:async'; + +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; + +abstract class AuthInterceptor extends Interceptor { + /* + * Get auth information on given route for the given type + * Can return null if type is not present on auth data or if route doesn't need authentication + */ + List> getAuthInfo(RouteBase route, String type) { + if (route.metadataMap.containsKey("auth")) { + final auth = route.metadataMap["auth"]; + List> results = []; + for (var info in auth) { + if (info["type"] == type) { + results.add(info); + } + } + return results; + } + return []; + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/auth/basic_auth.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/auth/basic_auth.dart new file mode 100644 index 00000000000..c5a7bc6c34b --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/auth/basic_auth.dart @@ -0,0 +1,34 @@ +import 'dart:async'; +import 'package:openapi/auth/auth.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); + +} + +class BasicAuthInterceptor extends AuthInterceptor { + Map authInfo = {}; + + @override + FutureOr before(RouteBase route) { + final metadataAuthInfo = getAuthInfo(route, "basic"); + for (var info in metadataAuthInfo) { + final authName = info["name"]; + final basicAuthInfo = authInfo[authName]; + if(basicAuthInfo != null) { + route.basicAuth(basicAuthInfo.username, basicAuthInfo.password); + break; + } + } + return super.before(route); + } + + @override + FutureOr after(StringResponse response) { + return Future.value(response); + } +} \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/auth/oauth.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/auth/oauth.dart new file mode 100644 index 00000000000..ea9c4023fde --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/auth/oauth.dart @@ -0,0 +1,25 @@ +import 'dart:async'; +import 'package:openapi/auth/auth.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; + +class OAuthInterceptor extends AuthInterceptor { + Map tokens = {}; + + @override + FutureOr before(RouteBase route) { + final authInfo = getAuthInfo(route, "oauth"); + for (var info in authInfo) { + final token = tokens[info["name"]]; + if(token != null) { + route.header("Authorization", "Bearer ${token}"); + break; + } + } + return super.before(route); + } + + @override + FutureOr after(StringResponse response) { + return Future.value(response); + } +} \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/api_response.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/api_response.dart new file mode 100644 index 00000000000..d0709e397a3 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/api_response.dart @@ -0,0 +1,25 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'api_response.jser.dart'; + +class ApiResponse { + @Alias('code') + final int code; + + @Alias('type') + final String type; + + @Alias('message') + final String message; + + ApiResponse({this.code = null, this.type = null, this.message = null}); + + @override + String toString() { + return 'ApiResponse[code=$code, type=$type, message=$message, ]'; + } +} + +@GenSerializer() +class ApiResponseSerializer extends Serializer + with _$ApiResponseSerializer {} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/api_response.jser.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/api_response.jser.dart new file mode 100644 index 00000000000..b4b6c090975 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/api_response.jser.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'api_response.dart'; + +// ************************************************************************** +// JaguarSerializerGenerator +// ************************************************************************** + +abstract class _$ApiResponseSerializer implements Serializer { + @override + Map toMap(ApiResponse model) { + if (model == null) return null; + Map ret = {}; + setMapValue(ret, 'code', model.code); + setMapValue(ret, 'type', model.type); + setMapValue(ret, 'message', model.message); + return ret; + } + + @override + ApiResponse fromMap(Map map) { + if (map == null) return null; + final obj = new ApiResponse( + code: map['code'] as int ?? getJserDefault('code'), + type: map['type'] as String ?? getJserDefault('type'), + message: map['message'] as String ?? getJserDefault('message')); + return obj; + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/category.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/category.dart new file mode 100644 index 00000000000..0462782e68c --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/category.dart @@ -0,0 +1,22 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'category.jser.dart'; + +class Category { + @Alias('id') + final int id; + + @Alias('name') + final String name; + + Category({this.id = null, this.name = null}); + + @override + String toString() { + return 'Category[id=$id, name=$name, ]'; + } +} + +@GenSerializer() +class CategorySerializer extends Serializer + with _$CategorySerializer {} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/category.jser.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/category.jser.dart new file mode 100644 index 00000000000..763bcd3dd6e --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/category.jser.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'category.dart'; + +// ************************************************************************** +// JaguarSerializerGenerator +// ************************************************************************** + +abstract class _$CategorySerializer implements Serializer { + @override + Map toMap(Category model) { + if (model == null) return null; + Map ret = {}; + setMapValue(ret, 'id', model.id); + setMapValue(ret, 'name', model.name); + return ret; + } + + @override + Category fromMap(Map map) { + if (map == null) return null; + final obj = new Category( + id: map['id'] as int ?? getJserDefault('id'), + name: map['name'] as String ?? getJserDefault('name')); + return obj; + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/order.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/order.dart new file mode 100644 index 00000000000..ccf82bb5d8d --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/order.dart @@ -0,0 +1,39 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'order.jser.dart'; + +class Order { + @Alias('id') + final int id; + + @Alias('petId') + final int petId; + + @Alias('quantity') + final int quantity; + + @Alias('shipDate') + final DateTime shipDate; + /* Order Status */ + @Alias('status') + final String status; + //enum statusEnum { placed, approved, delivered, }; + @Alias('complete') + final bool complete; + + Order( + {this.id = null, + this.petId = null, + this.quantity = null, + this.shipDate = null, + this.status = null, + this.complete = false}); + + @override + String toString() { + return 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete, ]'; + } +} + +@GenSerializer() +class OrderSerializer extends Serializer with _$OrderSerializer {} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/order.jser.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/order.jser.dart new file mode 100644 index 00000000000..52e5d7a01ba --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/order.jser.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'order.dart'; + +// ************************************************************************** +// JaguarSerializerGenerator +// ************************************************************************** + +abstract class _$OrderSerializer implements Serializer { + @override + Map toMap(Order model) { + if (model == null) return null; + Map ret = {}; + setMapValue(ret, 'id', model.id); + setMapValue(ret, 'petId', model.petId); + setMapValue(ret, 'quantity', model.quantity); + setMapValue( + ret, 'shipDate', dateTimeUtcProcessor.serialize(model.shipDate)); + setMapValue(ret, 'status', model.status); + setMapValue(ret, 'complete', model.complete); + return ret; + } + + @override + Order fromMap(Map map) { + if (map == null) return null; + final obj = new Order( + id: map['id'] as int ?? getJserDefault('id'), + petId: map['petId'] as int ?? getJserDefault('petId'), + quantity: map['quantity'] as int ?? getJserDefault('quantity'), + shipDate: dateTimeUtcProcessor.deserialize(map['shipDate'] as String) ?? + getJserDefault('shipDate'), + status: map['status'] as String ?? getJserDefault('status'), + complete: map['complete'] as bool ?? getJserDefault('complete')); + return obj; + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/pet.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/pet.dart new file mode 100644 index 00000000000..eaf4dac08d6 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/pet.dart @@ -0,0 +1,42 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +import 'package:openapi/model/tag.dart'; +import 'package:openapi/model/category.dart'; +part 'pet.jser.dart'; + +class Pet { + @Alias('id') + final int id; + + @Alias('category') + final Category category; + + @Alias('name') + final String name; + + @Alias('photoUrls') + final List photoUrls; + + @Alias('tags') + final List tags; + /* pet status in the store */ + @Alias('status') + final String status; + //enum statusEnum { available, pending, sold, }; + + Pet( + {this.id = null, + this.category = null, + this.name = null, + this.photoUrls = const [], + this.tags = const [], + this.status = null}); + + @override + String toString() { + return 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status, ]'; + } +} + +@GenSerializer() +class PetSerializer extends Serializer with _$PetSerializer {} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/pet.jser.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/pet.jser.dart new file mode 100644 index 00000000000..ce4f22f9686 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/pet.jser.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'pet.dart'; + +// ************************************************************************** +// JaguarSerializerGenerator +// ************************************************************************** + +abstract class _$PetSerializer implements Serializer { + Serializer __categorySerializer; + Serializer get _categorySerializer => + __categorySerializer ??= new CategorySerializer(); + Serializer __tagSerializer; + Serializer get _tagSerializer => __tagSerializer ??= new TagSerializer(); + @override + Map toMap(Pet model) { + if (model == null) return null; + Map ret = {}; + setMapValue(ret, 'id', model.id); + setMapValue(ret, 'category', _categorySerializer.toMap(model.category)); + setMapValue(ret, 'name', model.name); + setMapValue(ret, 'photoUrls', + codeIterable(model.photoUrls, (val) => val as String)); + setMapValue(ret, 'tags', + codeIterable(model.tags, (val) => _tagSerializer.toMap(val as Tag))); + setMapValue(ret, 'status', model.status); + return ret; + } + + @override + Pet fromMap(Map map) { + if (map == null) return null; + final obj = new Pet( + id: map['id'] as int ?? getJserDefault('id'), + category: _categorySerializer.fromMap(map['category'] as Map) ?? + getJserDefault('category'), + name: map['name'] as String ?? getJserDefault('name'), + photoUrls: codeIterable( + map['photoUrls'] as Iterable, (val) => val as String) ?? + getJserDefault('photoUrls'), + tags: codeIterable(map['tags'] as Iterable, + (val) => _tagSerializer.fromMap(val as Map)) ?? + getJserDefault('tags'), + status: map['status'] as String ?? getJserDefault('status')); + return obj; + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/tag.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/tag.dart new file mode 100644 index 00000000000..6182f362972 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/tag.dart @@ -0,0 +1,21 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'tag.jser.dart'; + +class Tag { + @Alias('id') + final int id; + + @Alias('name') + final String name; + + Tag({this.id = null, this.name = null}); + + @override + String toString() { + return 'Tag[id=$id, name=$name, ]'; + } +} + +@GenSerializer() +class TagSerializer extends Serializer with _$TagSerializer {} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/tag.jser.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/tag.jser.dart new file mode 100644 index 00000000000..cdb14e1783e --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/tag.jser.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'tag.dart'; + +// ************************************************************************** +// JaguarSerializerGenerator +// ************************************************************************** + +abstract class _$TagSerializer implements Serializer { + @override + Map toMap(Tag model) { + if (model == null) return null; + Map ret = {}; + setMapValue(ret, 'id', model.id); + setMapValue(ret, 'name', model.name); + return ret; + } + + @override + Tag fromMap(Map map) { + if (map == null) return null; + final obj = new Tag( + id: map['id'] as int ?? getJserDefault('id'), + name: map['name'] as String ?? getJserDefault('name')); + return obj; + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/user.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/user.dart new file mode 100644 index 00000000000..9ad7df784c8 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/user.dart @@ -0,0 +1,47 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'user.jser.dart'; + +class User { + @Alias('id') + final int id; + + @Alias('username') + final String username; + + @Alias('firstName') + final String firstName; + + @Alias('lastName') + final String lastName; + + @Alias('email') + final String email; + + @Alias('password') + final String password; + + @Alias('phone') + final String phone; + /* User Status */ + @Alias('userStatus') + final int userStatus; + + User( + {this.id = null, + this.username = null, + this.firstName = null, + this.lastName = null, + this.email = null, + this.password = null, + this.phone = null, + this.userStatus = null}); + + @override + String toString() { + return 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus, ]'; + } +} + +@GenSerializer() +class UserSerializer extends Serializer with _$UserSerializer {} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/user.jser.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/user.jser.dart new file mode 100644 index 00000000000..0eced9472d0 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/lib/model/user.jser.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user.dart'; + +// ************************************************************************** +// JaguarSerializerGenerator +// ************************************************************************** + +abstract class _$UserSerializer implements Serializer { + @override + Map toMap(User model) { + if (model == null) return null; + Map ret = {}; + setMapValue(ret, 'id', model.id); + setMapValue(ret, 'username', model.username); + setMapValue(ret, 'firstName', model.firstName); + setMapValue(ret, 'lastName', model.lastName); + setMapValue(ret, 'email', model.email); + setMapValue(ret, 'password', model.password); + setMapValue(ret, 'phone', model.phone); + setMapValue(ret, 'userStatus', model.userStatus); + return ret; + } + + @override + User fromMap(Map map) { + if (map == null) return null; + final obj = new User( + id: map['id'] as int ?? getJserDefault('id'), + username: map['username'] as String ?? getJserDefault('username'), + firstName: map['firstName'] as String ?? getJserDefault('firstName'), + lastName: map['lastName'] as String ?? getJserDefault('lastName'), + email: map['email'] as String ?? getJserDefault('email'), + password: map['password'] as String ?? getJserDefault('password'), + phone: map['phone'] as String ?? getJserDefault('phone'), + userStatus: map['userStatus'] as int ?? getJserDefault('userStatus')); + return obj; + } +} diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/pom.xml b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/pom.xml new file mode 100644 index 00000000000..044ee71a678 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + org.openapitools + DartJaguarFlutterTests + pom + 1.0.0-SNAPSHOT + DartJaguarFlutterClient + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + pub-get + pre-integration-test + + exec + + + pub + + get + + + + + pub-test + integration-test + + exec + + + pub + + run + build_runner + build + --delete-conflicting-outputs + + + + + + + + diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/pubspec.yaml b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/pubspec.yaml new file mode 100644 index 00000000000..001a842f966 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/openapi/pubspec.yaml @@ -0,0 +1,12 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +environment: + sdk: ">=2.0.0 <3.0.0" +dependencies: + jaguar_retrofit: '^2.5.4' + jaguar_serializer: '^2.2.2' +dev_dependencies: + jaguar_retrofit_gen: '^2.5.2' + jaguar_serializer_cli: '^2.2.1' + build_runner: '^0.10.0' \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/pubspec.yaml b/samples/client/petstore/dart-jaguar/flutter_petstore/pubspec.yaml new file mode 100644 index 00000000000..91824c47042 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/pubspec.yaml @@ -0,0 +1,59 @@ +name: flutter_petstore +description: OpenApi petstore sample flutter + +dependencies: + flutter: + sdk: flutter + openapi: + path: ./openapi + + # The following adds the Cupertino Icons font to your application. + # Use with the CupertinoIcons class for iOS style icons. + cupertino_icons: ^0.1.0 + +dev_dependencies: + flutter_test: + sdk: flutter + + +# For information on the generic Dart part of this file, see the +# following page: https://www.dartlang.org/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + + # The following line ensures that the Material Icons font is + # included with your application, so that you can use the icons in + # the material Icons class. + uses-material-design: true + + # To add assets to your application, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.io/assets-and-images/#resolution-aware. + + # For details regarding adding assets from package dependencies, see + # https://flutter.io/assets-and-images/#from-packages + + # To add custom fonts to your application, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts from package dependencies, + # see https://flutter.io/custom-fonts/#from-packages diff --git a/samples/client/petstore/dart-jaguar/flutter_petstore/test/widget_test.dart b/samples/client/petstore/dart-jaguar/flutter_petstore/test/widget_test.dart new file mode 100644 index 00000000000..ae01c7b8e72 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/flutter_petstore/test/widget_test.dart @@ -0,0 +1,29 @@ +// This is a basic Flutter widget test. +// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter +// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to +// find child widgets in the widget tree, read text, and verify that the values of widget properties +// are correct. + +import 'package:flutter/material.dart'; +import 'package:flutter_test/flutter_test.dart'; + +import 'package:flutter_petstore/main.dart'; + +void main() { + testWidgets('Counter increments smoke test', (WidgetTester tester) async { + // Build our app and trigger a frame. + await tester.pumpWidget(new MyApp()); + + // Verify that our counter starts at 0. + expect(find.text('0'), findsOneWidget); + expect(find.text('1'), findsNothing); + + // Tap the '+' icon and trigger a frame. + await tester.tap(find.byIcon(Icons.add)); + await tester.pump(); + + // Verify that our counter has incremented. + expect(find.text('0'), findsNothing); + expect(find.text('1'), findsOneWidget); + }); +} diff --git a/samples/client/petstore/dart-jaguar/openapi/.analysis_options b/samples/client/petstore/dart-jaguar/openapi/.analysis_options new file mode 100644 index 00000000000..518eb901a6f --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/openapi/.gitignore b/samples/client/petstore/dart-jaguar/openapi/.gitignore new file mode 100644 index 00000000000..7c280441649 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/.gitignore @@ -0,0 +1,27 @@ +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock diff --git a/samples/client/petstore/dart-jaguar/openapi/.openapi-generator-ignore b/samples/client/petstore/dart-jaguar/openapi/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/.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/dart-jaguar/openapi/.openapi-generator/VERSION b/samples/client/petstore/dart-jaguar/openapi/.openapi-generator/VERSION new file mode 100644 index 00000000000..f4cb97d56ce --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/openapi/README.md b/samples/client/petstore/dart-jaguar/openapi/README.md new file mode 100644 index 00000000000..7b71cf72e98 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/README.md @@ -0,0 +1,131 @@ +# openapi +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +This Dart package is automatically generated by the [Open API Codegen](https://github.com/OpenAPITools/openapi-generator) project: + +- API version: 1.0.0 +- Build date: 2018-10-08T15:27:15.700+08:00[Asia/Hong_Kong] +- Build package: org.openapitools.codegen.languages.DartJaguarClientCodegen + +## Requirements + +Dart 2 or later OR Flutter 0.7.0 or later. + +Once your code is generated, you need to run the build_runner command to let Jaguar implement your API: + +```sh +flutter packages pub run build_runner build +or +pub run build_runner build +``` + +## Installation & Usage + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +``` +name: openapi +version: 1.0.0 +description: OpenAPI API client +dependencies: + openapi: + git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + version: 'any' +``` + +### Local +To use the package in your local drive, please include the following in pubspec.yaml +``` +dependencies: + openapi: + path: /path/to/openapi +``` + +## Tests + +TODO + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/api.dart'; + +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +final jaguarApiGen = JaguarApiGen(); +var api_instance = jaguarApiGen.getPetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print("Exception when calling PetApi->addPet: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*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 +*StoreApi* | [**deleteOrder**](docs//StoreApi.md#deleteorder) | **Delete** /store/order/:orderId | 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/:orderId | 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 + + - [ApiResponse](docs//ApiResponse.md) + - [Category](docs//Category.md) + - [Order](docs//Order.md) + - [Pet](docs//Pet.md) + - [Tag](docs//Tag.md) + - [User](docs//User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## 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/dart-jaguar/openapi/analysis_options.yaml b/samples/client/petstore/dart-jaguar/openapi/analysis_options.yaml new file mode 100644 index 00000000000..518eb901a6f --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/analysis_options.yaml @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/openapi/docs/ApiResponse.md b/samples/client/petstore/dart-jaguar/openapi/docs/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/docs/ApiResponse.md @@ -0,0 +1,17 @@ +# openapi.model.ApiResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] [default to null] +**type** | **String** | | [optional] [default to null] +**message** | **String** | | [optional] [default to null] + +[[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/dart-jaguar/openapi/docs/Category.md b/samples/client/petstore/dart-jaguar/openapi/docs/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/docs/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**name** | **String** | | [optional] [default to null] + +[[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/dart-jaguar/openapi/docs/Order.md b/samples/client/petstore/dart-jaguar/openapi/docs/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/docs/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**petId** | **int** | | [optional] [default to null] +**quantity** | **int** | | [optional] [default to null] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] +**status** | **String** | Order Status | [optional] [default to null] +**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/dart-jaguar/openapi/docs/Pet.md b/samples/client/petstore/dart-jaguar/openapi/docs/Pet.md new file mode 100644 index 00000000000..ce5708cc134 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/docs/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**category** | [**Category**](Category.md) | | [optional] [default to null] +**name** | **String** | | [default to null] +**photoUrls** | **List<String>** | | [default to const []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to const []] +**status** | **String** | pet status in the store | [optional] [default to null] + +[[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/dart-jaguar/openapi/docs/PetApi.md b/samples/client/petstore/dart-jaguar/openapi/docs/PetApi.md new file mode 100644 index 00000000000..cf3e3652d48 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/docs/PetApi.md @@ -0,0 +1,379 @@ +# openapi.api.PetApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> addPet(pet) + +Add a new pet to the store + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print("Exception when calling PetApi->addPet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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** +> deletePet(petId, apiKey) + +Deletes a pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | Pet id to delete +var apiKey = apiKey_example; // String | + +try { + api_instance.deletePet(petId, apiKey); +} catch (e) { + print("Exception when calling PetApi->deletePet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| Pet id to delete | [default to null] + **apiKey** | **String**| | [optional] [default to null] + +### 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** +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var status = []; // List | Status values that need to be considered for filter + +try { + var result = api_instance.findPetsByStatus(status); + print(result); +} catch (e) { + print("Exception when calling PetApi->findPetsByStatus: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to const []] + +### Return type + +[**List**](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** +> List findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var tags = []; // List | Tags to filter by + +try { + var result = api_instance.findPetsByTags(tags); + print(result); +} catch (e) { + print("Exception when calling PetApi->findPetsByTags: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to const []] + +### Return type + +[**List**](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** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to return + +try { + var result = api_instance.getPetById(petId); + print(result); +} catch (e) { + print("Exception when calling PetApi->getPetById: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to return | [default to null] + +### 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** +> updatePet(pet) + +Update an existing pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.updatePet(pet); +} catch (e) { + print("Exception when calling PetApi->updatePet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet that needs to be updated +var name = name_example; // String | Updated name of the pet +var status = status_example; // String | Updated status of the pet + +try { + api_instance.updatePetWithForm(petId, name, status); +} catch (e) { + print("Exception when calling PetApi->updatePetWithForm: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet that needs to be updated | [default to null] + **name** | **String**| Updated name of the pet | [optional] [default to null] + **status** | **String**| Updated status of the pet | [optional] [default to null] + +### 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** +> ApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to update +var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +var file = BINARY_DATA_HERE; // MultipartFile | file to upload + +try { + var result = api_instance.uploadFile(petId, additionalMetadata, file); + print(result); +} catch (e) { + print("Exception when calling PetApi->uploadFile: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **file** | **MultipartFile****MultipartFile**| file to upload | [optional] [default to null] + +### 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/dart-jaguar/openapi/docs/StoreApi.md b/samples/client/petstore/dart-jaguar/openapi/docs/StoreApi.md new file mode 100644 index 00000000000..3616adc6336 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/docs/StoreApi.md @@ -0,0 +1,186 @@ +# openapi.api.StoreApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> 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 +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var orderId = orderId_example; // String | ID of the order that needs to be deleted + +try { + api_instance.deleteOrder(orderId); +} catch (e) { + print("Exception when calling StoreApi->deleteOrder: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | [default to null] + +### 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** +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; + +var api_instance = new StoreApi(); + +try { + var result = api_instance.getInventory(); + print(result); +} catch (e) { + print("Exception when calling StoreApi->getInventory: $e\n"); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Map** + +### 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** +> 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 +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var orderId = 789; // int | ID of pet that needs to be fetched + +try { + var result = api_instance.getOrderById(orderId); + print(result); +} catch (e) { + print("Exception when calling StoreApi->getOrderById: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **int**| ID of pet that needs to be fetched | [default to null] + +### 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** +> Order placeOrder(order) + +Place an order for a pet + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var order = new Order(); // Order | order placed for purchasing the pet + +try { + var result = api_instance.placeOrder(order); + print(result); +} catch (e) { + print("Exception when calling StoreApi->placeOrder: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**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/dart-jaguar/openapi/docs/Tag.md b/samples/client/petstore/dart-jaguar/openapi/docs/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/docs/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**name** | **String** | | [optional] [default to null] + +[[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/dart-jaguar/openapi/docs/User.md b/samples/client/petstore/dart-jaguar/openapi/docs/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/docs/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**username** | **String** | | [optional] [default to null] +**firstName** | **String** | | [optional] [default to null] +**lastName** | **String** | | [optional] [default to null] +**email** | **String** | | [optional] [default to null] +**password** | **String** | | [optional] [default to null] +**phone** | **String** | | [optional] [default to null] +**userStatus** | **int** | User Status | [optional] [default to null] + +[[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/dart-jaguar/openapi/docs/UserApi.md b/samples/client/petstore/dart-jaguar/openapi/docs/UserApi.md new file mode 100644 index 00000000000..eef7344a19c --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/docs/UserApi.md @@ -0,0 +1,349 @@ +# openapi.api.UserApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = new User(); // User | Created user object + +try { + api_instance.createUser(user); +} catch (e) { + print("Exception when calling UserApi->createUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**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** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = [new List<User>()]; // List | List of user object + +try { + api_instance.createUsersWithArrayInput(user); +} catch (e) { + print("Exception when calling UserApi->createUsersWithArrayInput: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](List.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** +> createUsersWithListInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = [new List<User>()]; // List | List of user object + +try { + api_instance.createUsersWithListInput(user); +} catch (e) { + print("Exception when calling UserApi->createUsersWithListInput: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](List.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** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The name that needs to be deleted + +try { + api_instance.deleteUser(username); +} catch (e) { + print("Exception when calling UserApi->deleteUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | [default to null] + +### 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** +> User getUserByName(username) + +Get user by user name + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + +try { + var result = api_instance.getUserByName(username); + print(result); +} catch (e) { + print("Exception when calling UserApi->getUserByName: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] + +### 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** +> String loginUser(username, password) + +Logs user into the system + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The user name for login +var password = password_example; // String | The password for login in clear text + +try { + var result = api_instance.loginUser(username, password); + print(result); +} catch (e) { + print("Exception when calling UserApi->loginUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | [default to null] + **password** | **String**| The password for login in clear text | [default to null] + +### 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** +> logoutUser() + +Logs out current logged in user session + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); + +try { + api_instance.logoutUser(); +} catch (e) { + print("Exception when calling UserApi->logoutUser: $e\n"); +} +``` + +### 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** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | name that need to be deleted +var user = new User(); // User | Updated user object + +try { + api_instance.updateUser(username, user); +} catch (e) { + print("Exception when calling UserApi->updateUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | [default to null] + **user** | [**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/dart-jaguar/openapi/git_push.sh b/samples/client/petstore/dart-jaguar/openapi/git_push.sh new file mode 100644 index 00000000000..83553a63a41 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +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://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/api.dart b/samples/client/petstore/dart-jaguar/openapi/lib/api.dart new file mode 100644 index 00000000000..e1aa03d6840 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/api.dart @@ -0,0 +1,117 @@ +library openapi.api; + +import 'package:http/http.dart'; +import 'package:jaguar_serializer/jaguar_serializer.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; +import 'package:openapi/auth/api_key_auth.dart'; +import 'package:openapi/auth/basic_auth.dart'; +import 'package:openapi/auth/oauth.dart'; + +import 'package:openapi/api/pet_api.dart'; +import 'package:openapi/api/store_api.dart'; +import 'package:openapi/api/user_api.dart'; + +import 'package:openapi/model/api_response.dart'; +import 'package:openapi/model/category.dart'; +import 'package:openapi/model/order.dart'; +import 'package:openapi/model/pet.dart'; +import 'package:openapi/model/tag.dart'; +import 'package:openapi/model/user.dart'; + +final jsonJaguarRepo = JsonRepo() + ..add(ApiResponseSerializer()) + ..add(CategorySerializer()) + ..add(OrderSerializer()) + ..add(PetSerializer()) + ..add(TagSerializer()) + ..add(UserSerializer()); + +final _defaultInterceptors = [ + OAuthInterceptor(), + BasicAuthInterceptor(), + ApiKeyAuthInterceptor() +]; + +class JaguarApiGen { + List interceptors; + String basePath = "http://petstore.swagger.io/v2"; + Route _baseRoute; + + /** + * Add custom global interceptors, put overrideInterceptors to true to set your interceptors only (auth interceptors will not be added) + */ + JaguarApiGen( + {List interceptors, + bool overrideInterceptors = false, + String baseUrl}) { + _baseRoute = + Route(baseUrl ?? basePath).withClient(globalClient ?? IOClient()); + if (interceptors == null) { + this.interceptors = _defaultInterceptors; + } else if (overrideInterceptors) { + this.interceptors = interceptors; + } else { + this.interceptors = List.from(_defaultInterceptors)..addAll(interceptors); + } + + this.interceptors.forEach((interceptor) { + _baseRoute.before(interceptor.before); + _baseRoute.after(interceptor.after); + }); + } + + void setOAuthToken(String name, String token) { + (_defaultInterceptors[0] as OAuthInterceptor).tokens[name] = token; + } + + void setBasicAuth(String name, String username, String password) { + (_defaultInterceptors[1] as BasicAuthInterceptor).authInfo[name] = + BasicAuthInfo(username, password); + } + + void setApiKey(String name, String apiKey) { + (_defaultInterceptors[2] as ApiKeyAuthInterceptor).apiKeys[name] = apiKey; + } + + /** + * Get PetApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + PetApi getPetApi({Route base, SerializerRepo serializers}) { + if (base == null) { + base = _baseRoute; + } + if (serializers == null) { + serializers = jsonJaguarRepo; + } + return PetApi(base: base, serializers: serializers); + } + + /** + * Get StoreApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + StoreApi getStoreApi({Route base, SerializerRepo serializers}) { + if (base == null) { + base = _baseRoute; + } + if (serializers == null) { + serializers = jsonJaguarRepo; + } + return StoreApi(base: base, serializers: serializers); + } + + /** + * Get UserApi instance, base route and serializer can be overridden by a given but be careful, + * by doing that all interceptors will not be executed + */ + UserApi getUserApi({Route base, SerializerRepo serializers}) { + if (base == null) { + base = _baseRoute; + } + if (serializers == null) { + serializers = jsonJaguarRepo; + } + return UserApi(base: base, serializers: serializers); + } +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/api/pet_api.dart b/samples/client/petstore/dart-jaguar/openapi/lib/api/pet_api.dart new file mode 100644 index 00000000000..ae5f7e9c158 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/api/pet_api.dart @@ -0,0 +1,99 @@ +import 'package:jaguar_retrofit/annotations/annotations.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; +import 'package:jaguar_serializer/jaguar_serializer.dart'; +import 'package:jaguar_serializer/src/repo/repo.dart'; +import 'dart:async'; + +import 'package:openapi/model/pet.dart'; +import 'package:openapi/model/api_response.dart'; + + +part 'pet_api.jretro.dart'; + +@GenApiClient() +class PetApi extends _$PetApiClient implements ApiClient { + final Route base; + final SerializerRepo serializers; + + PetApi({this.base, this.serializers}); + + /// Add a new pet to the store + /// + /// + @PostReq(path: "/pet", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future addPet( + + @AsJson() Pet pet + ); + + /// Deletes a pet + /// + /// + @DeleteReq(path: "/pet/:petId", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future deletePet( + @PathParam("petId") int petId + , + @Header("api_key") String apiKey + ); + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + @GetReq(path: "/pet/findByStatus", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future> findPetsByStatus( + + @QueryParam("status") List status + ); + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + @GetReq(path: "/pet/findByTags", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future> findPetsByTags( + + @QueryParam("tags") List tags + ); + + /// Find pet by ID + /// + /// Returns a single pet + @GetReq(path: "/pet/:petId", metadata: {"auth": [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }]}) + Future getPetById( + @PathParam("petId") int petId + ); + + /// Update an existing pet + /// + /// + @PutReq(path: "/pet", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future updatePet( + + @AsJson() Pet pet + ); + + /// Updates a pet in the store with form data + /// + /// + @PostReq(path: "/pet/:petId", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future updatePetWithForm( + @PathParam("petId") int petId + , + @AsFormField() String name, + + @AsFormField() String status + ); + + /// uploads an image + /// + /// + @PostReq(path: "/pet/:petId/uploadImage", metadata: {"auth": [ {"type": "oauth2", "name": "petstore_auth" }]}) + Future uploadFile( + @PathParam("petId") int petId + , + @AsMultipartField() String additionalMetadata, + + @AsMultipartField() MultipartFile file + ); + + +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/api/pet_api.jretro.dart b/samples/client/petstore/dart-jaguar/openapi/lib/api/pet_api.jretro.dart new file mode 100644 index 00000000000..2abc826f194 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/api/pet_api.jretro.dart @@ -0,0 +1,146 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'pet_api.dart'; + +// ************************************************************************** +// JaguarHttpGenerator +// ************************************************************************** + +abstract class _$PetApiClient implements ApiClient { + final String basePath = ""; + Future addPet(Pet pet) async { + var req = base.post + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet") + .json(serializers.to(pet)); + await req.go(); + } + + Future deletePet(int petId, String apiKey) async { + var req = base.delete + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet/:petId") + .pathParams("petId", petId) + .header("api_key", apiKey); + await req.go(); + } + + Future> findPetsByStatus(List status) async { + var req = base.get + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet/findByStatus") + .query("status", status); + return req.list(convert: serializers.oneFrom); + } + + Future> findPetsByTags(List tags) async { + var req = base.get + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet/findByTags") + .query("tags", tags); + return req.list(convert: serializers.oneFrom); + } + + Future getPetById(int petId) async { + var req = base.get + .metadata({ + "auth": [ + { + "type": "apiKey", + "name": "api_key", + "keyName": "api_key", + "where": "header", + } + ], + }) + .path(basePath) + .path("/pet/:petId") + .pathParams("petId", petId); + return req.one(convert: serializers.oneFrom); + } + + Future updatePet(Pet pet) async { + var req = base.put + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet") + .json(serializers.to(pet)); + await req.go(); + } + + Future updatePetWithForm(int petId, String name, String status) async { + var req = base.post + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet/:petId") + .pathParams("petId", petId) + .urlEncodedFormField(name, name) + .urlEncodedFormField(status, status); + await req.go(); + } + + Future uploadFile( + int petId, String additionalMetadata, MultipartFile file) async { + var req = base.post + .metadata({ + "auth": [ + { + "type": "oauth2", + "name": "petstore_auth", + } + ], + }) + .path(basePath) + .path("/pet/:petId/uploadImage") + .pathParams("petId", petId) + .multipart({"additionalMetadata": additionalMetadata}) + .multipart({"file": file}); + return req.one(convert: serializers.oneFrom); + } +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/api/store_api.dart b/samples/client/petstore/dart-jaguar/openapi/lib/api/store_api.dart new file mode 100644 index 00000000000..b0e40104275 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/api/store_api.dart @@ -0,0 +1,52 @@ +import 'package:jaguar_retrofit/annotations/annotations.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; +import 'package:jaguar_serializer/jaguar_serializer.dart'; +import 'package:jaguar_serializer/src/repo/repo.dart'; +import 'dart:async'; + +import 'package:openapi/model/order.dart'; + + +part 'store_api.jretro.dart'; + +@GenApiClient() +class StoreApi extends _$StoreApiClient implements ApiClient { + final Route base; + final SerializerRepo serializers; + + StoreApi({this.base, this.serializers}); + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + @DeleteReq(path: "/store/order/:orderId") + Future deleteOrder( + @PathParam("orderId") String orderId + ); + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + @GetReq(path: "/store/inventory", metadata: {"auth": [ {"type": "apiKey", "name": "api_key", "keyName": "api_key", "where": "header" }]}) + Future> getInventory( + ); + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + @GetReq(path: "/store/order/:orderId") + Future getOrderById( + @PathParam("orderId") int orderId + ); + + /// Place an order for a pet + /// + /// + @PostReq(path: "/store/order") + Future placeOrder( + + @AsJson() Order order + ); + + +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/api/store_api.jretro.dart b/samples/client/petstore/dart-jaguar/openapi/lib/api/store_api.jretro.dart new file mode 100644 index 00000000000..f3d3468b34b --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/api/store_api.jretro.dart @@ -0,0 +1,51 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'store_api.dart'; + +// ************************************************************************** +// JaguarHttpGenerator +// ************************************************************************** + +abstract class _$StoreApiClient implements ApiClient { + final String basePath = ""; + Future deleteOrder(String orderId) async { + var req = base.delete + .path(basePath) + .path("/store/order/:orderId") + .pathParams("orderId", orderId); + await req.go(); + } + + Future> getInventory() async { + var req = base.get + .metadata({ + "auth": [ + { + "type": "apiKey", + "name": "api_key", + "keyName": "api_key", + "where": "header", + } + ], + }) + .path(basePath) + .path("/store/inventory"); + return req.one().then((v) => serializers.mapFrom(v)); + } + + Future getOrderById(int orderId) async { + var req = base.get + .path(basePath) + .path("/store/order/:orderId") + .pathParams("orderId", orderId); + return req.one(convert: serializers.oneFrom); + } + + Future placeOrder(Order order) async { + var req = base.post + .path(basePath) + .path("/store/order") + .json(serializers.to(order)); + return req.one(convert: serializers.oneFrom); + } +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/api/user_api.dart b/samples/client/petstore/dart-jaguar/openapi/lib/api/user_api.dart new file mode 100644 index 00000000000..337375075c2 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/api/user_api.dart @@ -0,0 +1,91 @@ +import 'package:jaguar_retrofit/annotations/annotations.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; +import 'package:jaguar_serializer/jaguar_serializer.dart'; +import 'package:jaguar_serializer/src/repo/repo.dart'; +import 'dart:async'; + +import 'package:openapi/model/user.dart'; + + +part 'user_api.jretro.dart'; + +@GenApiClient() +class UserApi extends _$UserApiClient implements ApiClient { + final Route base; + final SerializerRepo serializers; + + UserApi({this.base, this.serializers}); + + /// Create user + /// + /// This can only be done by the logged in user. + @PostReq(path: "/user") + Future createUser( + + @AsJson() User user + ); + + /// Creates list of users with given input array + /// + /// + @PostReq(path: "/user/createWithArray") + Future createUsersWithArrayInput( + + @AsJson() List user + ); + + /// Creates list of users with given input array + /// + /// + @PostReq(path: "/user/createWithList") + Future createUsersWithListInput( + + @AsJson() List user + ); + + /// Delete user + /// + /// This can only be done by the logged in user. + @DeleteReq(path: "/user/:username") + Future deleteUser( + @PathParam("username") String username + ); + + /// Get user by user name + /// + /// + @GetReq(path: "/user/:username") + Future getUserByName( + @PathParam("username") String username + ); + + /// Logs user into the system + /// + /// + @GetReq(path: "/user/login") + Future loginUser( + + @QueryParam("username") String username, + + @QueryParam("password") String password + ); + + /// Logs out current logged in user session + /// + /// + @GetReq(path: "/user/logout") + Future logoutUser( + ); + + /// Updated user + /// + /// This can only be done by the logged in user. + @PutReq(path: "/user/:username") + Future updateUser( + @PathParam("username") String username + , + @AsJson() User user + ); + + +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/api/user_api.jretro.dart b/samples/client/petstore/dart-jaguar/openapi/lib/api/user_api.jretro.dart new file mode 100644 index 00000000000..5b68c3b0faf --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/api/user_api.jretro.dart @@ -0,0 +1,70 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user_api.dart'; + +// ************************************************************************** +// JaguarHttpGenerator +// ************************************************************************** + +abstract class _$UserApiClient implements ApiClient { + final String basePath = ""; + Future createUser(User user) async { + var req = base.post.path(basePath).path("/user").json(serializers.to(user)); + await req.go(); + } + + Future createUsersWithArrayInput(List user) async { + var req = base.post + .path(basePath) + .path("/user/createWithArray") + .json(serializers.to(user)); + await req.go(); + } + + Future createUsersWithListInput(List user) async { + var req = base.post + .path(basePath) + .path("/user/createWithList") + .json(serializers.to(user)); + await req.go(); + } + + Future deleteUser(String username) async { + var req = base.delete + .path(basePath) + .path("/user/:username") + .pathParams("username", username); + await req.go(); + } + + Future getUserByName(String username) async { + var req = base.get + .path(basePath) + .path("/user/:username") + .pathParams("username", username); + return req.one(convert: serializers.oneFrom); + } + + Future loginUser(String username, String password) async { + var req = base.get + .path(basePath) + .path("/user/login") + .query("username", username) + .query("password", password); + return req.one(); + } + + Future logoutUser() async { + var req = base.get.path(basePath).path("/user/logout"); + await req.go(); + } + + Future updateUser(String username, User user) async { + var req = base.put + .path(basePath) + .path("/user/:username") + .pathParams("username", username) + .json(serializers.to(user)); + await req.go(); + } +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/auth/api_key_auth.dart b/samples/client/petstore/dart-jaguar/openapi/lib/auth/api_key_auth.dart new file mode 100644 index 00000000000..82c9499ae83 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/auth/api_key_auth.dart @@ -0,0 +1,33 @@ +import 'dart:async'; +import 'package:openapi/auth/auth.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; + +class ApiKeyAuthInterceptor extends AuthInterceptor { + Map apiKeys = {}; + + @override + FutureOr before(RouteBase route) { + final authInfo = getAuthInfo(route, "apiKey"); + for (var info in authInfo) { + final authName = info["name"]; + final authKeyName = info["keyName"]; + final authWhere = info["where"]; + final apiKey = apiKeys[authName]; + if(apiKey != null) { + if(authWhere == 'query'){ + route.query(authKeyName, apiKey); + } + else { + route.header(authKeyName, apiKey); + } + break; + } + } + return super.before(route); + } + + @override + FutureOr after(StringResponse response) { + return Future.value(response); + } +} \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/auth/auth.dart b/samples/client/petstore/dart-jaguar/openapi/lib/auth/auth.dart new file mode 100644 index 00000000000..0df893561a6 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/auth/auth.dart @@ -0,0 +1,23 @@ +import 'dart:async'; + +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; + +abstract class AuthInterceptor extends Interceptor { + /* + * Get auth information on given route for the given type + * Can return null if type is not present on auth data or if route doesn't need authentication + */ + List> getAuthInfo(RouteBase route, String type) { + if (route.metadataMap.containsKey("auth")) { + final auth = route.metadataMap["auth"]; + List> results = []; + for (var info in auth) { + if (info["type"] == type) { + results.add(info); + } + } + return results; + } + return []; + } +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/auth/basic_auth.dart b/samples/client/petstore/dart-jaguar/openapi/lib/auth/basic_auth.dart new file mode 100644 index 00000000000..c5a7bc6c34b --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/auth/basic_auth.dart @@ -0,0 +1,34 @@ +import 'dart:async'; +import 'package:openapi/auth/auth.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; + +class BasicAuthInfo { + final String username; + final String password; + + const BasicAuthInfo(this.username, this.password); + +} + +class BasicAuthInterceptor extends AuthInterceptor { + Map authInfo = {}; + + @override + FutureOr before(RouteBase route) { + final metadataAuthInfo = getAuthInfo(route, "basic"); + for (var info in metadataAuthInfo) { + final authName = info["name"]; + final basicAuthInfo = authInfo[authName]; + if(basicAuthInfo != null) { + route.basicAuth(basicAuthInfo.username, basicAuthInfo.password); + break; + } + } + return super.before(route); + } + + @override + FutureOr after(StringResponse response) { + return Future.value(response); + } +} \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/auth/oauth.dart b/samples/client/petstore/dart-jaguar/openapi/lib/auth/oauth.dart new file mode 100644 index 00000000000..ea9c4023fde --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/auth/oauth.dart @@ -0,0 +1,25 @@ +import 'dart:async'; +import 'package:openapi/auth/auth.dart'; +import 'package:jaguar_retrofit/jaguar_retrofit.dart'; + +class OAuthInterceptor extends AuthInterceptor { + Map tokens = {}; + + @override + FutureOr before(RouteBase route) { + final authInfo = getAuthInfo(route, "oauth"); + for (var info in authInfo) { + final token = tokens[info["name"]]; + if(token != null) { + route.header("Authorization", "Bearer ${token}"); + break; + } + } + return super.before(route); + } + + @override + FutureOr after(StringResponse response) { + return Future.value(response); + } +} \ No newline at end of file diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/model/api_response.dart b/samples/client/petstore/dart-jaguar/openapi/lib/model/api_response.dart new file mode 100644 index 00000000000..d0709e397a3 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/api_response.dart @@ -0,0 +1,25 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'api_response.jser.dart'; + +class ApiResponse { + @Alias('code') + final int code; + + @Alias('type') + final String type; + + @Alias('message') + final String message; + + ApiResponse({this.code = null, this.type = null, this.message = null}); + + @override + String toString() { + return 'ApiResponse[code=$code, type=$type, message=$message, ]'; + } +} + +@GenSerializer() +class ApiResponseSerializer extends Serializer + with _$ApiResponseSerializer {} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/model/api_response.jser.dart b/samples/client/petstore/dart-jaguar/openapi/lib/model/api_response.jser.dart new file mode 100644 index 00000000000..b4b6c090975 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/api_response.jser.dart @@ -0,0 +1,29 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'api_response.dart'; + +// ************************************************************************** +// JaguarSerializerGenerator +// ************************************************************************** + +abstract class _$ApiResponseSerializer implements Serializer { + @override + Map toMap(ApiResponse model) { + if (model == null) return null; + Map ret = {}; + setMapValue(ret, 'code', model.code); + setMapValue(ret, 'type', model.type); + setMapValue(ret, 'message', model.message); + return ret; + } + + @override + ApiResponse fromMap(Map map) { + if (map == null) return null; + final obj = new ApiResponse( + code: map['code'] as int ?? getJserDefault('code'), + type: map['type'] as String ?? getJserDefault('type'), + message: map['message'] as String ?? getJserDefault('message')); + return obj; + } +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/model/category.dart b/samples/client/petstore/dart-jaguar/openapi/lib/model/category.dart new file mode 100644 index 00000000000..0462782e68c --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/category.dart @@ -0,0 +1,22 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'category.jser.dart'; + +class Category { + @Alias('id') + final int id; + + @Alias('name') + final String name; + + Category({this.id = null, this.name = null}); + + @override + String toString() { + return 'Category[id=$id, name=$name, ]'; + } +} + +@GenSerializer() +class CategorySerializer extends Serializer + with _$CategorySerializer {} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/model/category.jser.dart b/samples/client/petstore/dart-jaguar/openapi/lib/model/category.jser.dart new file mode 100644 index 00000000000..763bcd3dd6e --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/category.jser.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'category.dart'; + +// ************************************************************************** +// JaguarSerializerGenerator +// ************************************************************************** + +abstract class _$CategorySerializer implements Serializer { + @override + Map toMap(Category model) { + if (model == null) return null; + Map ret = {}; + setMapValue(ret, 'id', model.id); + setMapValue(ret, 'name', model.name); + return ret; + } + + @override + Category fromMap(Map map) { + if (map == null) return null; + final obj = new Category( + id: map['id'] as int ?? getJserDefault('id'), + name: map['name'] as String ?? getJserDefault('name')); + return obj; + } +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/model/order.dart b/samples/client/petstore/dart-jaguar/openapi/lib/model/order.dart new file mode 100644 index 00000000000..ccf82bb5d8d --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/order.dart @@ -0,0 +1,39 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'order.jser.dart'; + +class Order { + @Alias('id') + final int id; + + @Alias('petId') + final int petId; + + @Alias('quantity') + final int quantity; + + @Alias('shipDate') + final DateTime shipDate; + /* Order Status */ + @Alias('status') + final String status; + //enum statusEnum { placed, approved, delivered, }; + @Alias('complete') + final bool complete; + + Order( + {this.id = null, + this.petId = null, + this.quantity = null, + this.shipDate = null, + this.status = null, + this.complete = false}); + + @override + String toString() { + return 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete, ]'; + } +} + +@GenSerializer() +class OrderSerializer extends Serializer with _$OrderSerializer {} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/model/order.jser.dart b/samples/client/petstore/dart-jaguar/openapi/lib/model/order.jser.dart new file mode 100644 index 00000000000..52e5d7a01ba --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/order.jser.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'order.dart'; + +// ************************************************************************** +// JaguarSerializerGenerator +// ************************************************************************** + +abstract class _$OrderSerializer implements Serializer { + @override + Map toMap(Order model) { + if (model == null) return null; + Map ret = {}; + setMapValue(ret, 'id', model.id); + setMapValue(ret, 'petId', model.petId); + setMapValue(ret, 'quantity', model.quantity); + setMapValue( + ret, 'shipDate', dateTimeUtcProcessor.serialize(model.shipDate)); + setMapValue(ret, 'status', model.status); + setMapValue(ret, 'complete', model.complete); + return ret; + } + + @override + Order fromMap(Map map) { + if (map == null) return null; + final obj = new Order( + id: map['id'] as int ?? getJserDefault('id'), + petId: map['petId'] as int ?? getJserDefault('petId'), + quantity: map['quantity'] as int ?? getJserDefault('quantity'), + shipDate: dateTimeUtcProcessor.deserialize(map['shipDate'] as String) ?? + getJserDefault('shipDate'), + status: map['status'] as String ?? getJserDefault('status'), + complete: map['complete'] as bool ?? getJserDefault('complete')); + return obj; + } +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/model/pet.dart b/samples/client/petstore/dart-jaguar/openapi/lib/model/pet.dart new file mode 100644 index 00000000000..eaf4dac08d6 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/pet.dart @@ -0,0 +1,42 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +import 'package:openapi/model/tag.dart'; +import 'package:openapi/model/category.dart'; +part 'pet.jser.dart'; + +class Pet { + @Alias('id') + final int id; + + @Alias('category') + final Category category; + + @Alias('name') + final String name; + + @Alias('photoUrls') + final List photoUrls; + + @Alias('tags') + final List tags; + /* pet status in the store */ + @Alias('status') + final String status; + //enum statusEnum { available, pending, sold, }; + + Pet( + {this.id = null, + this.category = null, + this.name = null, + this.photoUrls = const [], + this.tags = const [], + this.status = null}); + + @override + String toString() { + return 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status, ]'; + } +} + +@GenSerializer() +class PetSerializer extends Serializer with _$PetSerializer {} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/model/pet.jser.dart b/samples/client/petstore/dart-jaguar/openapi/lib/model/pet.jser.dart new file mode 100644 index 00000000000..ce4f22f9686 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/pet.jser.dart @@ -0,0 +1,47 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'pet.dart'; + +// ************************************************************************** +// JaguarSerializerGenerator +// ************************************************************************** + +abstract class _$PetSerializer implements Serializer { + Serializer __categorySerializer; + Serializer get _categorySerializer => + __categorySerializer ??= new CategorySerializer(); + Serializer __tagSerializer; + Serializer get _tagSerializer => __tagSerializer ??= new TagSerializer(); + @override + Map toMap(Pet model) { + if (model == null) return null; + Map ret = {}; + setMapValue(ret, 'id', model.id); + setMapValue(ret, 'category', _categorySerializer.toMap(model.category)); + setMapValue(ret, 'name', model.name); + setMapValue(ret, 'photoUrls', + codeIterable(model.photoUrls, (val) => val as String)); + setMapValue(ret, 'tags', + codeIterable(model.tags, (val) => _tagSerializer.toMap(val as Tag))); + setMapValue(ret, 'status', model.status); + return ret; + } + + @override + Pet fromMap(Map map) { + if (map == null) return null; + final obj = new Pet( + id: map['id'] as int ?? getJserDefault('id'), + category: _categorySerializer.fromMap(map['category'] as Map) ?? + getJserDefault('category'), + name: map['name'] as String ?? getJserDefault('name'), + photoUrls: codeIterable( + map['photoUrls'] as Iterable, (val) => val as String) ?? + getJserDefault('photoUrls'), + tags: codeIterable(map['tags'] as Iterable, + (val) => _tagSerializer.fromMap(val as Map)) ?? + getJserDefault('tags'), + status: map['status'] as String ?? getJserDefault('status')); + return obj; + } +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/model/tag.dart b/samples/client/petstore/dart-jaguar/openapi/lib/model/tag.dart new file mode 100644 index 00000000000..6182f362972 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/tag.dart @@ -0,0 +1,21 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'tag.jser.dart'; + +class Tag { + @Alias('id') + final int id; + + @Alias('name') + final String name; + + Tag({this.id = null, this.name = null}); + + @override + String toString() { + return 'Tag[id=$id, name=$name, ]'; + } +} + +@GenSerializer() +class TagSerializer extends Serializer with _$TagSerializer {} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/model/tag.jser.dart b/samples/client/petstore/dart-jaguar/openapi/lib/model/tag.jser.dart new file mode 100644 index 00000000000..cdb14e1783e --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/tag.jser.dart @@ -0,0 +1,27 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'tag.dart'; + +// ************************************************************************** +// JaguarSerializerGenerator +// ************************************************************************** + +abstract class _$TagSerializer implements Serializer { + @override + Map toMap(Tag model) { + if (model == null) return null; + Map ret = {}; + setMapValue(ret, 'id', model.id); + setMapValue(ret, 'name', model.name); + return ret; + } + + @override + Tag fromMap(Map map) { + if (map == null) return null; + final obj = new Tag( + id: map['id'] as int ?? getJserDefault('id'), + name: map['name'] as String ?? getJserDefault('name')); + return obj; + } +} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/model/user.dart b/samples/client/petstore/dart-jaguar/openapi/lib/model/user.dart new file mode 100644 index 00000000000..9ad7df784c8 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/user.dart @@ -0,0 +1,47 @@ +import 'package:jaguar_serializer/jaguar_serializer.dart'; + +part 'user.jser.dart'; + +class User { + @Alias('id') + final int id; + + @Alias('username') + final String username; + + @Alias('firstName') + final String firstName; + + @Alias('lastName') + final String lastName; + + @Alias('email') + final String email; + + @Alias('password') + final String password; + + @Alias('phone') + final String phone; + /* User Status */ + @Alias('userStatus') + final int userStatus; + + User( + {this.id = null, + this.username = null, + this.firstName = null, + this.lastName = null, + this.email = null, + this.password = null, + this.phone = null, + this.userStatus = null}); + + @override + String toString() { + return 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus, ]'; + } +} + +@GenSerializer() +class UserSerializer extends Serializer with _$UserSerializer {} diff --git a/samples/client/petstore/dart-jaguar/openapi/lib/model/user.jser.dart b/samples/client/petstore/dart-jaguar/openapi/lib/model/user.jser.dart new file mode 100644 index 00000000000..0eced9472d0 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/lib/model/user.jser.dart @@ -0,0 +1,39 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'user.dart'; + +// ************************************************************************** +// JaguarSerializerGenerator +// ************************************************************************** + +abstract class _$UserSerializer implements Serializer { + @override + Map toMap(User model) { + if (model == null) return null; + Map ret = {}; + setMapValue(ret, 'id', model.id); + setMapValue(ret, 'username', model.username); + setMapValue(ret, 'firstName', model.firstName); + setMapValue(ret, 'lastName', model.lastName); + setMapValue(ret, 'email', model.email); + setMapValue(ret, 'password', model.password); + setMapValue(ret, 'phone', model.phone); + setMapValue(ret, 'userStatus', model.userStatus); + return ret; + } + + @override + User fromMap(Map map) { + if (map == null) return null; + final obj = new User( + id: map['id'] as int ?? getJserDefault('id'), + username: map['username'] as String ?? getJserDefault('username'), + firstName: map['firstName'] as String ?? getJserDefault('firstName'), + lastName: map['lastName'] as String ?? getJserDefault('lastName'), + email: map['email'] as String ?? getJserDefault('email'), + password: map['password'] as String ?? getJserDefault('password'), + phone: map['phone'] as String ?? getJserDefault('phone'), + userStatus: map['userStatus'] as int ?? getJserDefault('userStatus')); + return obj; + } +} diff --git a/samples/client/petstore/dart-jaguar/openapi/pom.xml b/samples/client/petstore/dart-jaguar/openapi/pom.xml new file mode 100644 index 00000000000..368877a5f1d --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/pom.xml @@ -0,0 +1,62 @@ + + 4.0.0 + org.openapitools + DartJaguarPetstoreClientTests + pom + 1.0.0-SNAPSHOT + Dart Jaguar Petstore Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + pub-get + pre-integration-test + + exec + + + pub + + get + + + + + pub-test + integration-test + + exec + + + pub + + run + build_runner + build + --delete-conflicting-outputs + + + + + + + + diff --git a/samples/client/petstore/dart-jaguar/openapi/pubspec.yaml b/samples/client/petstore/dart-jaguar/openapi/pubspec.yaml new file mode 100644 index 00000000000..001a842f966 --- /dev/null +++ b/samples/client/petstore/dart-jaguar/openapi/pubspec.yaml @@ -0,0 +1,12 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +environment: + sdk: ">=2.0.0 <3.0.0" +dependencies: + jaguar_retrofit: '^2.5.4' + jaguar_serializer: '^2.2.2' +dev_dependencies: + jaguar_retrofit_gen: '^2.5.2' + jaguar_serializer_cli: '^2.2.1' + build_runner: '^0.10.0' \ No newline at end of file diff --git a/samples/client/petstore/dart/flutter_petstore/ios/Runner.xcodeproj/project.pbxproj b/samples/client/petstore/dart/flutter_petstore/ios/Runner.xcodeproj/project.pbxproj index 9b2e4b7cda8..efd7d0a1e7f 100644 --- a/samples/client/petstore/dart/flutter_petstore/ios/Runner.xcodeproj/project.pbxproj +++ b/samples/client/petstore/dart/flutter_petstore/ios/Runner.xcodeproj/project.pbxproj @@ -9,13 +9,13 @@ /* Begin PBXBuildFile section */ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; }; 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; }; + 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; }; 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; }; 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; }; 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; }; 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; }; - 9740EEBB1CF902C7004384FC /* app.flx in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB71CF902C7004384FC /* app.flx */; }; 978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; }; 97C146F31CF9000F007C117D /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 97C146F21CF9000F007C117D /* main.m */; }; 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; @@ -42,13 +42,13 @@ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; + 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; }; 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; - 9740EEB71CF902C7004384FC /* app.flx */ = {isa = PBXFileReference; lastKnownFileType = file; name = app.flx; path = Flutter/app.flx; sourceTree = ""; }; 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; }; 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; }; 97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; @@ -74,9 +74,9 @@ 9740EEB11CF90186004384FC /* Flutter */ = { isa = PBXGroup; children = ( - 9740EEB71CF902C7004384FC /* app.flx */, 3B80C3931E831B6300D905FE /* App.framework */, 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */, + 2D5378251FAA1A9400D5DBA9 /* flutter_assets */, 9740EEBA1CF902C7004384FC /* Flutter.framework */, 9740EEB21CF90195004384FC /* Debug.xcconfig */, 7AFA3C8E1D35360C0083082E /* Release.xcconfig */, @@ -187,10 +187,10 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 9740EEBB1CF902C7004384FC /* app.flx in Resources */, 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, + 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */, 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/.openapi-generator/VERSION b/samples/client/petstore/dart/flutter_petstore/openapi/.openapi-generator/VERSION index 096bf47efe3..f4cb97d56ce 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/.openapi-generator/VERSION +++ b/samples/client/petstore/dart/flutter_petstore/openapi/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/docs/PetApi.md b/samples/client/petstore/dart/flutter_petstore/openapi/docs/PetApi.md index 6fa9abf67ae..cb39b3f22d3 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/docs/PetApi.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/docs/PetApi.md @@ -87,8 +87,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | - **apiKey** | **String**| | [optional] + **petId** | **int**| Pet id to delete | [default to null] + **apiKey** | **String**| | [optional] [default to null] ### Return type @@ -133,7 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] ### Return type @@ -178,7 +178,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] ### Return type @@ -225,7 +225,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | + **petId** | **int**| ID of pet to return | [default to null] ### Return type @@ -311,7 +311,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | + **petId** | **int**| ID of pet that needs to be updated | [default to null] **name** | **String**| Updated name of the pet | [optional] [default to null] **status** | **String**| Updated status of the pet | [optional] [default to null] @@ -358,7 +358,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | + **petId** | **int**| ID of pet to update | [default to null] **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] **file** | **MultipartFile**| file to upload | [optional] [default to null] diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/docs/StoreApi.md b/samples/client/petstore/dart/flutter_petstore/openapi/docs/StoreApi.md index cc0c2ac2d35..0cbbd758efd 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/docs/StoreApi.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/docs/StoreApi.md @@ -40,7 +40,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of the order that needs to be deleted | + **orderId** | **String**| ID of the order that needs to be deleted | [default to null] ### Return type @@ -126,7 +126,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **int**| ID of pet that needs to be fetched | + **orderId** | **int**| ID of pet that needs to be fetched | [default to null] ### Return type diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/docs/UserApi.md b/samples/client/petstore/dart/flutter_petstore/openapi/docs/UserApi.md index 0dec271be5c..9abe3cc83e2 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/docs/UserApi.md +++ b/samples/client/petstore/dart/flutter_petstore/openapi/docs/UserApi.md @@ -166,7 +166,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be deleted | + **username** | **String**| The name that needs to be deleted | [default to null] ### Return type @@ -207,7 +207,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] ### Return type @@ -249,8 +249,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | - **password** | **String**| The password for login in clear text | + **username** | **String**| The user name for login | [default to null] + **password** | **String**| The password for login in clear text | [default to null] ### Return type @@ -329,7 +329,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| name that need to be deleted | + **username** | **String**| name that need to be deleted | [default to null] **user** | [**User**](User.md)| Updated user object | ### Return type diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api.dart index 9a64a5342b4..756e554c43f 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api.dart @@ -23,5 +23,4 @@ part 'model/pet.dart'; part 'model/tag.dart'; part 'model/user.dart'; - ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/pet_api.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/pet_api.dart index 4134e018386..81b5ad0c880 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/pet_api.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/pet_api.dart @@ -1,7 +1,5 @@ part of openapi.api; - - class PetApi { final ApiClient apiClient; @@ -9,66 +7,60 @@ class PetApi { /// Add a new pet to the store /// - /// + /// Future addPet(Pet pet) async { Object postBody = pet; // verify required params are set - if(pet == null) { - throw new ApiException(400, "Missing required param: pet"); + if (pet == null) { + throw new ApiException(400, "Missing required param: pet"); } // create path and map variables - String path = "/pet".replaceAll("{format}","json"); + String path = "/pet".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - List contentTypes = ["application/json","application/xml"]; + List contentTypes = ["application/json", "application/xml"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Deletes a pet /// - /// - Future deletePet(int petId, { String apiKey }) async { + /// + Future deletePet(int petId, {String apiKey}) async { Object postBody = null; // verify required params are set - if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); } // create path and map variables - String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); // query params List queryParams = []; @@ -78,34 +70,26 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Finds Pets by status /// /// Multiple status values can be provided with comma separated strings @@ -113,50 +97,46 @@ class PetApi { Object postBody = null; // verify required params are set - if(status == null) { - throw new ApiException(400, "Missing required param: status"); + if (status == null) { + throw new ApiException(400, "Missing required param: status"); } // create path and map variables - String path = "/pet/findByStatus".replaceAll("{format}","json"); + String path = "/pet/findByStatus".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("csv", "status", status)); + queryParams + .addAll(_convertParametersForCollectionFormat("csv", "status", status)); List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - return (apiClient.deserialize(response.body, 'List') as List).map((item) => item as Pet).toList(); + } else if (response.body != null) { + return (apiClient.deserialize(response.body, 'List') as List) + .map((item) => item as Pet) + .toList(); } else { return null; } } + /// Finds Pets by tags /// /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -164,50 +144,46 @@ class PetApi { Object postBody = null; // verify required params are set - if(tags == null) { - throw new ApiException(400, "Missing required param: tags"); + if (tags == null) { + throw new ApiException(400, "Missing required param: tags"); } // create path and map variables - String path = "/pet/findByTags".replaceAll("{format}","json"); + String path = "/pet/findByTags".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); + queryParams + .addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - return (apiClient.deserialize(response.body, 'List') as List).map((item) => item as Pet).toList(); + } else if (response.body != null) { + return (apiClient.deserialize(response.body, 'List') as List) + .map((item) => item as Pet) + .toList(); } else { return null; } } + /// Find pet by ID /// /// Returns a single pet @@ -215,12 +191,14 @@ class PetApi { Object postBody = null; // verify required params are set - if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); } // create path and map variables - String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); // query params List queryParams = []; @@ -229,97 +207,84 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["api_key"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'Pet') as Pet; } else { return null; } } + /// Update an existing pet /// - /// + /// Future updatePet(Pet pet) async { Object postBody = pet; // verify required params are set - if(pet == null) { - throw new ApiException(400, "Missing required param: pet"); + if (pet == null) { + throw new ApiException(400, "Missing required param: pet"); } // create path and map variables - String path = "/pet".replaceAll("{format}","json"); + String path = "/pet".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - List contentTypes = ["application/json","application/xml"]; + List contentTypes = ["application/json", "application/xml"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Updates a pet in the store with form data /// - /// - Future updatePetWithForm(int petId, { String name, String status }) async { + /// + Future updatePetWithForm(int petId, {String name, String status}) async { Object postBody = null; // verify required params are set - if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); } // create path and map variables - String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); // query params List queryParams = []; @@ -328,10 +293,11 @@ class PetApi { List contentTypes = ["application/x-www-form-urlencoded"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); if (name != null) { @@ -342,45 +308,38 @@ class PetApi { hasFields = true; mp.fields['status'] = parameterToString(status); } - if(hasFields) - postBody = mp; - } - else { - if (name != null) - formParams['name'] = parameterToString(name); - if (status != null) - formParams['status'] = parameterToString(status); - } - - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); - - if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + if (hasFields) postBody = mp; } else { + if (name != null) formParams['name'] = parameterToString(name); + if (status != null) formParams['status'] = parameterToString(status); + } + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { return; } } + /// uploads an image /// - /// - Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async { + /// + Future uploadFile(int petId, + {String additionalMetadata, MultipartFile file}) async { Object postBody = null; // verify required params are set - if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); } // create path and map variables - String path = "/pet/{petId}/uploadImage".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); + String path = "/pet/{petId}/uploadImage" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); // query params List queryParams = []; @@ -389,10 +348,11 @@ class PetApi { List contentTypes = ["multipart/form-data"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); if (additionalMetadata != null) { @@ -404,26 +364,19 @@ class PetApi { mp.fields['file'] = file.field; mp.files.add(file); } - if(hasFields) - postBody = mp; - } - else { + if (hasFields) postBody = mp; + } else { if (additionalMetadata != null) - formParams['additionalMetadata'] = parameterToString(additionalMetadata); + formParams['additionalMetadata'] = + parameterToString(additionalMetadata); } - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'ApiResponse') as ApiResponse; } else { return null; diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/store_api.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/store_api.dart index f2a48f2d4da..a3f62747d50 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/store_api.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/store_api.dart @@ -1,7 +1,5 @@ part of openapi.api; - - class StoreApi { final ApiClient apiClient; @@ -14,12 +12,14 @@ class StoreApi { Object postBody = null; // verify required params are set - if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + if (orderId == null) { + throw new ApiException(400, "Missing required param: orderId"); } // create path and map variables - String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString()); + String path = "/store/order/{orderId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "orderId" + "}", orderId.toString()); // query params List queryParams = []; @@ -28,34 +28,26 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Returns pet inventories by status /// /// Returns a map of status codes to quantities @@ -65,7 +57,7 @@ class StoreApi { // verify required params are set // create path and map variables - String path = "/store/inventory".replaceAll("{format}","json"); + String path = "/store/inventory".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -74,36 +66,30 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["api_key"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - return new Map.from(apiClient.deserialize(response.body, 'Map')); - ; + } else if (response.body != null) { + return new Map.from( + apiClient.deserialize(response.body, 'Map')); + ; } else { return null; } } + /// Find purchase order by ID /// /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -111,12 +97,14 @@ class StoreApi { Object postBody = null; // verify required params are set - if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + if (orderId == null) { + throw new ApiException(400, "Missing required param: orderId"); } // create path and map variables - String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString()); + String path = "/store/order/{orderId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "orderId" + "}", orderId.toString()); // query params List queryParams = []; @@ -125,48 +113,41 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'Order') as Order; } else { return null; } } + /// Place an order for a pet /// - /// + /// Future placeOrder(Order order) async { Object postBody = order; // verify required params are set - if(order == null) { - throw new ApiException(400, "Missing required param: order"); + if (order == null) { + throw new ApiException(400, "Missing required param: order"); } // create path and map variables - String path = "/store/order".replaceAll("{format}","json"); + String path = "/store/order".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -175,30 +156,22 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'Order') as Order; } else { return null; diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/user_api.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/user_api.dart index cf8ef6bf800..62e8759ede8 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/user_api.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api/user_api.dart @@ -1,7 +1,5 @@ part of openapi.api; - - class UserApi { final ApiClient apiClient; @@ -14,12 +12,12 @@ class UserApi { Object postBody = user; // verify required params are set - if(user == null) { - throw new ApiException(400, "Missing required param: user"); + if (user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables - String path = "/user".replaceAll("{format}","json"); + String path = "/user".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -28,47 +26,39 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Creates list of users with given input array /// - /// + /// Future createUsersWithArrayInput(List user) async { Object postBody = user; // verify required params are set - if(user == null) { - throw new ApiException(400, "Missing required param: user"); + if (user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables - String path = "/user/createWithArray".replaceAll("{format}","json"); + String path = "/user/createWithArray".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -77,47 +67,39 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Creates list of users with given input array /// - /// + /// Future createUsersWithListInput(List user) async { Object postBody = user; // verify required params are set - if(user == null) { - throw new ApiException(400, "Missing required param: user"); + if (user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables - String path = "/user/createWithList".replaceAll("{format}","json"); + String path = "/user/createWithList".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -126,34 +108,26 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Delete user /// /// This can only be done by the logged in user. @@ -161,12 +135,14 @@ class UserApi { Object postBody = null; // verify required params are set - if(username == null) { - throw new ApiException(400, "Missing required param: username"); + if (username == null) { + throw new ApiException(400, "Missing required param: username"); } // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); // query params List queryParams = []; @@ -175,47 +151,41 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Get user by user name /// - /// + /// Future getUserByName(String username) async { Object postBody = null; // verify required params are set - if(username == null) { - throw new ApiException(400, "Missing required param: username"); + if (username == null) { + throw new ApiException(400, "Missing required param: username"); } // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); // query params List queryParams = []; @@ -224,100 +194,88 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'User') as User; } else { return null; } } + /// Logs user into the system /// - /// + /// Future loginUser(String username, String password) async { Object postBody = null; // verify required params are set - if(username == null) { - throw new ApiException(400, "Missing required param: username"); + if (username == null) { + throw new ApiException(400, "Missing required param: username"); } - if(password == null) { - throw new ApiException(400, "Missing required param: password"); + if (password == null) { + throw new ApiException(400, "Missing required param: password"); } // create path and map variables - String path = "/user/login".replaceAll("{format}","json"); + String path = "/user/login".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("", "username", username)); - queryParams.addAll(_convertParametersForCollectionFormat("", "password", password)); + queryParams.addAll( + _convertParametersForCollectionFormat("", "username", username)); + queryParams.addAll( + _convertParametersForCollectionFormat("", "password", password)); List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'String') as String; } else { return null; } } + /// Logs out current logged in user session /// - /// + /// Future logoutUser() async { Object postBody = null; // verify required params are set // create path and map variables - String path = "/user/logout".replaceAll("{format}","json"); + String path = "/user/logout".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -326,34 +284,26 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Updated user /// /// This can only be done by the logged in user. @@ -361,15 +311,17 @@ class UserApi { Object postBody = user; // verify required params are set - if(username == null) { - throw new ApiException(400, "Missing required param: username"); + if (username == null) { + throw new ApiException(400, "Missing required param: username"); } - if(user == null) { - throw new ApiException(400, "Missing required param: user"); + if (user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); // query params List queryParams = []; @@ -378,31 +330,22 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_client.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_client.dart index db4116dd96d..c99c6d8c492 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_client.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_client.dart @@ -8,7 +8,6 @@ class QueryParam { } class ApiClient { - String basePath; var client = new Client(); @@ -25,7 +24,7 @@ class ApiClient { } void addDefaultHeader(String key, String value) { - _defaultHeaderMap[key] = value; + _defaultHeaderMap[key] = value; } dynamic _deserialize(dynamic value, String targetType) { @@ -67,9 +66,11 @@ class ApiClient { } } } catch (e, stack) { - throw new ApiException.withInner(500, 'Exception during deserialization.', e, stack); + throw new ApiException.withInner( + 500, 'Exception during deserialization.', e, stack); } - throw new ApiException(500, 'Could not find a suitable class for deserialization'); + throw new ApiException( + 500, 'Could not find a suitable class for deserialization'); } dynamic deserialize(String json, String targetType) { @@ -94,28 +95,28 @@ class ApiClient { // We don't use a Map for queryParams. // If collectionFormat is 'multi' a key might appear multiple times. - Future invokeAPI(String path, - String method, - Iterable queryParams, - Object body, - Map headerParams, - Map formParams, - String contentType, - List authNames) async { - + Future invokeAPI( + String path, + String method, + Iterable queryParams, + Object body, + Map headerParams, + Map formParams, + String contentType, + List authNames) async { _updateParamsForAuth(authNames, queryParams, headerParams); - var ps = queryParams.where((p) => p.value != null).map((p) => '${p.name}=${p.value}'); - String queryString = ps.isNotEmpty ? - '?' + ps.join('&') : - ''; + var ps = queryParams + .where((p) => p.value != null) + .map((p) => '${p.name}=${p.value}'); + String queryString = ps.isNotEmpty ? '?' + ps.join('&') : ''; String url = basePath + path + queryString; headerParams.addAll(_defaultHeaderMap); headerParams['Content-Type'] = contentType; - if(body is MultipartRequest) { + if (body is MultipartRequest) { var request = new MultipartRequest(method, Uri.parse(url)); request.fields.addAll(body.fields); request.files.addAll(body.files); @@ -124,8 +125,10 @@ class ApiClient { var response = await client.send(request); return Response.fromStream(response); } else { - var msgBody = contentType == "application/x-www-form-urlencoded" ? formParams : serialize(body); - switch(method) { + var msgBody = contentType == "application/x-www-form-urlencoded" + ? formParams + : serialize(body); + switch (method) { case "POST": return client.post(url, headers: headerParams, body: msgBody); case "PUT": @@ -142,10 +145,12 @@ class ApiClient { /// Update query and header parameters based on authentication settings. /// @param authNames The authentications to apply - void _updateParamsForAuth(List authNames, List queryParams, Map headerParams) { + void _updateParamsForAuth(List authNames, + List queryParams, Map headerParams) { authNames.forEach((authName) { Authentication auth = _authentications[authName]; - if (auth == null) throw new ArgumentError("Authentication undefined: " + authName); + if (auth == null) + throw new ArgumentError("Authentication undefined: " + authName); auth.applyToParams(queryParams, headerParams); }); } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_exception.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_exception.dart index f188fd125a4..e485b6c3226 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_exception.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_exception.dart @@ -8,7 +8,8 @@ class ApiException implements Exception { ApiException(this.code, this.message); - ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); + ApiException.withInner( + this.code, this.message, this.innerException, this.stackTrace); String toString() { if (message == null) return "ApiException"; diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_helper.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_helper.dart index 79af4521d5b..e6f87d96bfb 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_helper.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/api_helper.dart @@ -4,7 +4,7 @@ const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; // port from Java version Iterable _convertParametersForCollectionFormat( - String collectionFormat, String name, dynamic value) { + String collectionFormat, String name, dynamic value) { var params = []; // preconditions @@ -19,8 +19,8 @@ Iterable _convertParametersForCollectionFormat( // get the collection format collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) - ? "csv" - : collectionFormat; // default: csv + ? "csv" + : collectionFormat; // default: csv if (collectionFormat == "multi") { return values.map((v) => new QueryParam(name, parameterToString(v))); @@ -28,7 +28,8 @@ Iterable _convertParametersForCollectionFormat( String delimiter = _delimiters[collectionFormat] ?? ","; - params.add(new QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter))); + params.add(new QueryParam( + name, values.map((v) => parameterToString(v)).join(delimiter))); return params; } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/api_key_auth.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/api_key_auth.dart index f9617f7ae4d..69b407fd90e 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/api_key_auth.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/api_key_auth.dart @@ -1,7 +1,6 @@ part of openapi.api; class ApiKeyAuth implements Authentication { - final String location; final String paramName; String apiKey; @@ -10,7 +9,8 @@ class ApiKeyAuth implements Authentication { ApiKeyAuth(this.location, this.paramName); @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List queryParams, Map headerParams) { String value; if (apiKeyPrefix != null) { value = '$apiKeyPrefix $apiKey'; diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/authentication.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/authentication.dart index abd5e2fe68a..2c4d5f301fa 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/authentication.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/authentication.dart @@ -1,7 +1,7 @@ part of openapi.api; abstract class Authentication { - - /// Apply authentication settings to header and query params. - void applyToParams(List queryParams, Map headerParams); + /// Apply authentication settings to header and query params. + void applyToParams( + List queryParams, Map headerParams); } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/http_basic_auth.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/http_basic_auth.dart index 4e77ddcf6e6..e26ec8a005a 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/http_basic_auth.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/http_basic_auth.dart @@ -1,14 +1,15 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - String username; String password; @override - void applyToParams(List queryParams, Map headerParams) { - String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + void applyToParams( + List queryParams, Map headerParams) { + String str = (username == null ? "" : username) + + ":" + + (password == null ? "" : password); headerParams["Authorization"] = "Basic " + BASE64.encode(UTF8.encode(str)); } - -} \ No newline at end of file +} diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/oauth.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/oauth.dart index 13bfd799743..829677d6c9c 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/oauth.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/auth/oauth.dart @@ -3,11 +3,11 @@ part of openapi.api; class OAuth implements Authentication { String accessToken; - OAuth({this.accessToken}) { - } + OAuth({this.accessToken}) {} @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List queryParams, Map headerParams) { if (accessToken != null) { headerParams["Authorization"] = "Bearer " + accessToken; } diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/api_response.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/api_response.dart index a39d9500b29..5599d392539 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/api_response.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/api_response.dart @@ -1,11 +1,10 @@ part of openapi.api; class ApiResponse { - int code = null; - + String type = null; - + String message = null; ApiResponse(); @@ -22,23 +21,22 @@ class ApiResponse { } Map toJson() { - return { - 'code': code, - 'type': type, - 'message': message - }; + return {'code': code, 'type': type, 'message': message}; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new ApiResponse.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new ApiResponse.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { + static Map mapFromJson( + Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new ApiResponse.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new ApiResponse.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/category.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/category.dart index b9b2481dd29..bcc59c0e893 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/category.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/category.dart @@ -1,9 +1,8 @@ part of openapi.api; class Category { - int id = null; - + String name = null; Category(); @@ -19,22 +18,22 @@ class Category { } Map toJson() { - return { - 'id': id, - 'name': name - }; + return {'id': id, 'name': name}; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Category.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new Category.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { + static Map mapFromJson( + Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Category.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new Category.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/order.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/order.dart index 4e264a183ef..8fa9908b07e 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/order.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/order.dart @@ -1,18 +1,17 @@ part of openapi.api; class Order { - int id = null; - + int petId = null; - + int quantity = null; - + DateTime shipDate = null; /* Order Status */ String status = null; //enum statusEnum { placed, approved, delivered, };{ - + bool complete = false; Order(); @@ -26,7 +25,8 @@ class Order { id = json['id']; petId = json['petId']; quantity = json['quantity']; - shipDate = json['shipDate'] == null ? null : DateTime.parse(json['shipDate']); + shipDate = + json['shipDate'] == null ? null : DateTime.parse(json['shipDate']); status = json['status']; complete = json['complete']; } @@ -43,15 +43,18 @@ class Order { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Order.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new Order.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { + static Map mapFromJson( + Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Order.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new Order.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart index 4d2f77a1a5a..b80a0491345 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/pet.dart @@ -1,15 +1,14 @@ part of openapi.api; class Pet { - int id = null; - + Category category = null; - + String name = null; - + List photoUrls = []; - + List tags = []; /* pet status in the store */ String status = null; @@ -26,7 +25,8 @@ class Pet { id = json['id']; category = new Category.fromJson(json['category']); name = json['name']; - photoUrls = (json['photoUrls'] as List).map((item) => item as String).toList(); + photoUrls = + (json['photoUrls'] as List).map((item) => item as String).toList(); tags = Tag.listFromJson(json['tags']); status = json['status']; } @@ -43,15 +43,17 @@ class Pet { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Pet.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new Pet.fromJson(value)).toList(); } static Map mapFromJson(Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Pet.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new Pet.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/tag.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/tag.dart index 315a326adb7..ce683e031c4 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/tag.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/tag.dart @@ -1,9 +1,8 @@ part of openapi.api; class Tag { - int id = null; - + String name = null; Tag(); @@ -19,22 +18,21 @@ class Tag { } Map toJson() { - return { - 'id': id, - 'name': name - }; + return {'id': id, 'name': name}; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Tag.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new Tag.fromJson(value)).toList(); } static Map mapFromJson(Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Tag.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new Tag.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/user.dart b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/user.dart index 0e4cc2104c7..faa02b1ad13 100644 --- a/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/user.dart +++ b/samples/client/petstore/dart/flutter_petstore/openapi/lib/model/user.dart @@ -1,19 +1,18 @@ part of openapi.api; class User { - int id = null; - + String username = null; - + String firstName = null; - + String lastName = null; - + String email = null; - + String password = null; - + String phone = null; /* User Status */ int userStatus = null; @@ -50,15 +49,17 @@ class User { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new User.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new User.fromJson(value)).toList(); } static Map mapFromJson(Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new User.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new User.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/flutter_petstore/pubspec.yaml b/samples/client/petstore/dart/flutter_petstore/pubspec.yaml index b8b388256f2..f5366c6e827 100644 --- a/samples/client/petstore/dart/flutter_petstore/pubspec.yaml +++ b/samples/client/petstore/dart/flutter_petstore/pubspec.yaml @@ -2,6 +2,7 @@ name: flutter_petstore description: OpenAPI petstore sample flutter dependencies: + http: flutter: sdk: flutter openapi: diff --git a/samples/client/petstore/dart/openapi-browser-client/.openapi-generator/VERSION b/samples/client/petstore/dart/openapi-browser-client/.openapi-generator/VERSION index 096bf47efe3..f4cb97d56ce 100644 --- a/samples/client/petstore/dart/openapi-browser-client/.openapi-generator/VERSION +++ b/samples/client/petstore/dart/openapi-browser-client/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart/openapi-browser-client/docs/PetApi.md b/samples/client/petstore/dart/openapi-browser-client/docs/PetApi.md index 6fa9abf67ae..cb39b3f22d3 100644 --- a/samples/client/petstore/dart/openapi-browser-client/docs/PetApi.md +++ b/samples/client/petstore/dart/openapi-browser-client/docs/PetApi.md @@ -87,8 +87,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | - **apiKey** | **String**| | [optional] + **petId** | **int**| Pet id to delete | [default to null] + **apiKey** | **String**| | [optional] [default to null] ### Return type @@ -133,7 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] ### Return type @@ -178,7 +178,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] ### Return type @@ -225,7 +225,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | + **petId** | **int**| ID of pet to return | [default to null] ### Return type @@ -311,7 +311,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | + **petId** | **int**| ID of pet that needs to be updated | [default to null] **name** | **String**| Updated name of the pet | [optional] [default to null] **status** | **String**| Updated status of the pet | [optional] [default to null] @@ -358,7 +358,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | + **petId** | **int**| ID of pet to update | [default to null] **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] **file** | **MultipartFile**| file to upload | [optional] [default to null] diff --git a/samples/client/petstore/dart/openapi-browser-client/docs/StoreApi.md b/samples/client/petstore/dart/openapi-browser-client/docs/StoreApi.md index cc0c2ac2d35..0cbbd758efd 100644 --- a/samples/client/petstore/dart/openapi-browser-client/docs/StoreApi.md +++ b/samples/client/petstore/dart/openapi-browser-client/docs/StoreApi.md @@ -40,7 +40,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of the order that needs to be deleted | + **orderId** | **String**| ID of the order that needs to be deleted | [default to null] ### Return type @@ -126,7 +126,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **int**| ID of pet that needs to be fetched | + **orderId** | **int**| ID of pet that needs to be fetched | [default to null] ### Return type diff --git a/samples/client/petstore/dart/openapi-browser-client/docs/UserApi.md b/samples/client/petstore/dart/openapi-browser-client/docs/UserApi.md index 0dec271be5c..9abe3cc83e2 100644 --- a/samples/client/petstore/dart/openapi-browser-client/docs/UserApi.md +++ b/samples/client/petstore/dart/openapi-browser-client/docs/UserApi.md @@ -166,7 +166,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be deleted | + **username** | **String**| The name that needs to be deleted | [default to null] ### Return type @@ -207,7 +207,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] ### Return type @@ -249,8 +249,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | - **password** | **String**| The password for login in clear text | + **username** | **String**| The user name for login | [default to null] + **password** | **String**| The password for login in clear text | [default to null] ### Return type @@ -329,7 +329,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| name that need to be deleted | + **username** | **String**| name that need to be deleted | [default to null] **user** | [**User**](User.md)| Updated user object | ### Return type diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/api.dart b/samples/client/petstore/dart/openapi-browser-client/lib/api.dart index 84476e0626a..e62b959a456 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/api.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/api.dart @@ -24,5 +24,4 @@ part 'model/pet.dart'; part 'model/tag.dart'; part 'model/user.dart'; - ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/api/pet_api.dart b/samples/client/petstore/dart/openapi-browser-client/lib/api/pet_api.dart index 4134e018386..81b5ad0c880 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/api/pet_api.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/api/pet_api.dart @@ -1,7 +1,5 @@ part of openapi.api; - - class PetApi { final ApiClient apiClient; @@ -9,66 +7,60 @@ class PetApi { /// Add a new pet to the store /// - /// + /// Future addPet(Pet pet) async { Object postBody = pet; // verify required params are set - if(pet == null) { - throw new ApiException(400, "Missing required param: pet"); + if (pet == null) { + throw new ApiException(400, "Missing required param: pet"); } // create path and map variables - String path = "/pet".replaceAll("{format}","json"); + String path = "/pet".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - List contentTypes = ["application/json","application/xml"]; + List contentTypes = ["application/json", "application/xml"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Deletes a pet /// - /// - Future deletePet(int petId, { String apiKey }) async { + /// + Future deletePet(int petId, {String apiKey}) async { Object postBody = null; // verify required params are set - if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); } // create path and map variables - String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); // query params List queryParams = []; @@ -78,34 +70,26 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Finds Pets by status /// /// Multiple status values can be provided with comma separated strings @@ -113,50 +97,46 @@ class PetApi { Object postBody = null; // verify required params are set - if(status == null) { - throw new ApiException(400, "Missing required param: status"); + if (status == null) { + throw new ApiException(400, "Missing required param: status"); } // create path and map variables - String path = "/pet/findByStatus".replaceAll("{format}","json"); + String path = "/pet/findByStatus".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("csv", "status", status)); + queryParams + .addAll(_convertParametersForCollectionFormat("csv", "status", status)); List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - return (apiClient.deserialize(response.body, 'List') as List).map((item) => item as Pet).toList(); + } else if (response.body != null) { + return (apiClient.deserialize(response.body, 'List') as List) + .map((item) => item as Pet) + .toList(); } else { return null; } } + /// Finds Pets by tags /// /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -164,50 +144,46 @@ class PetApi { Object postBody = null; // verify required params are set - if(tags == null) { - throw new ApiException(400, "Missing required param: tags"); + if (tags == null) { + throw new ApiException(400, "Missing required param: tags"); } // create path and map variables - String path = "/pet/findByTags".replaceAll("{format}","json"); + String path = "/pet/findByTags".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); + queryParams + .addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - return (apiClient.deserialize(response.body, 'List') as List).map((item) => item as Pet).toList(); + } else if (response.body != null) { + return (apiClient.deserialize(response.body, 'List') as List) + .map((item) => item as Pet) + .toList(); } else { return null; } } + /// Find pet by ID /// /// Returns a single pet @@ -215,12 +191,14 @@ class PetApi { Object postBody = null; // verify required params are set - if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); } // create path and map variables - String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); // query params List queryParams = []; @@ -229,97 +207,84 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["api_key"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'Pet') as Pet; } else { return null; } } + /// Update an existing pet /// - /// + /// Future updatePet(Pet pet) async { Object postBody = pet; // verify required params are set - if(pet == null) { - throw new ApiException(400, "Missing required param: pet"); + if (pet == null) { + throw new ApiException(400, "Missing required param: pet"); } // create path and map variables - String path = "/pet".replaceAll("{format}","json"); + String path = "/pet".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - List contentTypes = ["application/json","application/xml"]; + List contentTypes = ["application/json", "application/xml"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Updates a pet in the store with form data /// - /// - Future updatePetWithForm(int petId, { String name, String status }) async { + /// + Future updatePetWithForm(int petId, {String name, String status}) async { Object postBody = null; // verify required params are set - if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); } // create path and map variables - String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); // query params List queryParams = []; @@ -328,10 +293,11 @@ class PetApi { List contentTypes = ["application/x-www-form-urlencoded"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); if (name != null) { @@ -342,45 +308,38 @@ class PetApi { hasFields = true; mp.fields['status'] = parameterToString(status); } - if(hasFields) - postBody = mp; - } - else { - if (name != null) - formParams['name'] = parameterToString(name); - if (status != null) - formParams['status'] = parameterToString(status); - } - - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); - - if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + if (hasFields) postBody = mp; } else { + if (name != null) formParams['name'] = parameterToString(name); + if (status != null) formParams['status'] = parameterToString(status); + } + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { return; } } + /// uploads an image /// - /// - Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async { + /// + Future uploadFile(int petId, + {String additionalMetadata, MultipartFile file}) async { Object postBody = null; // verify required params are set - if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); } // create path and map variables - String path = "/pet/{petId}/uploadImage".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); + String path = "/pet/{petId}/uploadImage" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); // query params List queryParams = []; @@ -389,10 +348,11 @@ class PetApi { List contentTypes = ["multipart/form-data"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); if (additionalMetadata != null) { @@ -404,26 +364,19 @@ class PetApi { mp.fields['file'] = file.field; mp.files.add(file); } - if(hasFields) - postBody = mp; - } - else { + if (hasFields) postBody = mp; + } else { if (additionalMetadata != null) - formParams['additionalMetadata'] = parameterToString(additionalMetadata); + formParams['additionalMetadata'] = + parameterToString(additionalMetadata); } - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'ApiResponse') as ApiResponse; } else { return null; diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/api/store_api.dart b/samples/client/petstore/dart/openapi-browser-client/lib/api/store_api.dart index f2a48f2d4da..a3f62747d50 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/api/store_api.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/api/store_api.dart @@ -1,7 +1,5 @@ part of openapi.api; - - class StoreApi { final ApiClient apiClient; @@ -14,12 +12,14 @@ class StoreApi { Object postBody = null; // verify required params are set - if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + if (orderId == null) { + throw new ApiException(400, "Missing required param: orderId"); } // create path and map variables - String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString()); + String path = "/store/order/{orderId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "orderId" + "}", orderId.toString()); // query params List queryParams = []; @@ -28,34 +28,26 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Returns pet inventories by status /// /// Returns a map of status codes to quantities @@ -65,7 +57,7 @@ class StoreApi { // verify required params are set // create path and map variables - String path = "/store/inventory".replaceAll("{format}","json"); + String path = "/store/inventory".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -74,36 +66,30 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["api_key"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - return new Map.from(apiClient.deserialize(response.body, 'Map')); - ; + } else if (response.body != null) { + return new Map.from( + apiClient.deserialize(response.body, 'Map')); + ; } else { return null; } } + /// Find purchase order by ID /// /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -111,12 +97,14 @@ class StoreApi { Object postBody = null; // verify required params are set - if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + if (orderId == null) { + throw new ApiException(400, "Missing required param: orderId"); } // create path and map variables - String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString()); + String path = "/store/order/{orderId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "orderId" + "}", orderId.toString()); // query params List queryParams = []; @@ -125,48 +113,41 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'Order') as Order; } else { return null; } } + /// Place an order for a pet /// - /// + /// Future placeOrder(Order order) async { Object postBody = order; // verify required params are set - if(order == null) { - throw new ApiException(400, "Missing required param: order"); + if (order == null) { + throw new ApiException(400, "Missing required param: order"); } // create path and map variables - String path = "/store/order".replaceAll("{format}","json"); + String path = "/store/order".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -175,30 +156,22 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'Order') as Order; } else { return null; diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/api/user_api.dart b/samples/client/petstore/dart/openapi-browser-client/lib/api/user_api.dart index cf8ef6bf800..62e8759ede8 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/api/user_api.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/api/user_api.dart @@ -1,7 +1,5 @@ part of openapi.api; - - class UserApi { final ApiClient apiClient; @@ -14,12 +12,12 @@ class UserApi { Object postBody = user; // verify required params are set - if(user == null) { - throw new ApiException(400, "Missing required param: user"); + if (user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables - String path = "/user".replaceAll("{format}","json"); + String path = "/user".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -28,47 +26,39 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Creates list of users with given input array /// - /// + /// Future createUsersWithArrayInput(List user) async { Object postBody = user; // verify required params are set - if(user == null) { - throw new ApiException(400, "Missing required param: user"); + if (user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables - String path = "/user/createWithArray".replaceAll("{format}","json"); + String path = "/user/createWithArray".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -77,47 +67,39 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Creates list of users with given input array /// - /// + /// Future createUsersWithListInput(List user) async { Object postBody = user; // verify required params are set - if(user == null) { - throw new ApiException(400, "Missing required param: user"); + if (user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables - String path = "/user/createWithList".replaceAll("{format}","json"); + String path = "/user/createWithList".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -126,34 +108,26 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Delete user /// /// This can only be done by the logged in user. @@ -161,12 +135,14 @@ class UserApi { Object postBody = null; // verify required params are set - if(username == null) { - throw new ApiException(400, "Missing required param: username"); + if (username == null) { + throw new ApiException(400, "Missing required param: username"); } // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); // query params List queryParams = []; @@ -175,47 +151,41 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Get user by user name /// - /// + /// Future getUserByName(String username) async { Object postBody = null; // verify required params are set - if(username == null) { - throw new ApiException(400, "Missing required param: username"); + if (username == null) { + throw new ApiException(400, "Missing required param: username"); } // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); // query params List queryParams = []; @@ -224,100 +194,88 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'User') as User; } else { return null; } } + /// Logs user into the system /// - /// + /// Future loginUser(String username, String password) async { Object postBody = null; // verify required params are set - if(username == null) { - throw new ApiException(400, "Missing required param: username"); + if (username == null) { + throw new ApiException(400, "Missing required param: username"); } - if(password == null) { - throw new ApiException(400, "Missing required param: password"); + if (password == null) { + throw new ApiException(400, "Missing required param: password"); } // create path and map variables - String path = "/user/login".replaceAll("{format}","json"); + String path = "/user/login".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("", "username", username)); - queryParams.addAll(_convertParametersForCollectionFormat("", "password", password)); + queryParams.addAll( + _convertParametersForCollectionFormat("", "username", username)); + queryParams.addAll( + _convertParametersForCollectionFormat("", "password", password)); List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'String') as String; } else { return null; } } + /// Logs out current logged in user session /// - /// + /// Future logoutUser() async { Object postBody = null; // verify required params are set // create path and map variables - String path = "/user/logout".replaceAll("{format}","json"); + String path = "/user/logout".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -326,34 +284,26 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Updated user /// /// This can only be done by the logged in user. @@ -361,15 +311,17 @@ class UserApi { Object postBody = user; // verify required params are set - if(username == null) { - throw new ApiException(400, "Missing required param: username"); + if (username == null) { + throw new ApiException(400, "Missing required param: username"); } - if(user == null) { - throw new ApiException(400, "Missing required param: user"); + if (user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); // query params List queryParams = []; @@ -378,31 +330,22 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/api_client.dart b/samples/client/petstore/dart/openapi-browser-client/lib/api_client.dart index 7cca5bef5f2..bdc0ebf698d 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/api_client.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/api_client.dart @@ -8,7 +8,6 @@ class QueryParam { } class ApiClient { - String basePath; var client = new BrowserClient(); @@ -25,7 +24,7 @@ class ApiClient { } void addDefaultHeader(String key, String value) { - _defaultHeaderMap[key] = value; + _defaultHeaderMap[key] = value; } dynamic _deserialize(dynamic value, String targetType) { @@ -67,9 +66,11 @@ class ApiClient { } } } catch (e, stack) { - throw new ApiException.withInner(500, 'Exception during deserialization.', e, stack); + throw new ApiException.withInner( + 500, 'Exception during deserialization.', e, stack); } - throw new ApiException(500, 'Could not find a suitable class for deserialization'); + throw new ApiException( + 500, 'Could not find a suitable class for deserialization'); } dynamic deserialize(String json, String targetType) { @@ -94,28 +95,28 @@ class ApiClient { // We don't use a Map for queryParams. // If collectionFormat is 'multi' a key might appear multiple times. - Future invokeAPI(String path, - String method, - Iterable queryParams, - Object body, - Map headerParams, - Map formParams, - String contentType, - List authNames) async { - + Future invokeAPI( + String path, + String method, + Iterable queryParams, + Object body, + Map headerParams, + Map formParams, + String contentType, + List authNames) async { _updateParamsForAuth(authNames, queryParams, headerParams); - var ps = queryParams.where((p) => p.value != null).map((p) => '${p.name}=${p.value}'); - String queryString = ps.isNotEmpty ? - '?' + ps.join('&') : - ''; + var ps = queryParams + .where((p) => p.value != null) + .map((p) => '${p.name}=${p.value}'); + String queryString = ps.isNotEmpty ? '?' + ps.join('&') : ''; String url = basePath + path + queryString; headerParams.addAll(_defaultHeaderMap); headerParams['Content-Type'] = contentType; - if(body is MultipartRequest) { + if (body is MultipartRequest) { var request = new MultipartRequest(method, Uri.parse(url)); request.fields.addAll(body.fields); request.files.addAll(body.files); @@ -124,8 +125,10 @@ class ApiClient { var response = await client.send(request); return Response.fromStream(response); } else { - var msgBody = contentType == "application/x-www-form-urlencoded" ? formParams : serialize(body); - switch(method) { + var msgBody = contentType == "application/x-www-form-urlencoded" + ? formParams + : serialize(body); + switch (method) { case "POST": return client.post(url, headers: headerParams, body: msgBody); case "PUT": @@ -142,10 +145,12 @@ class ApiClient { /// Update query and header parameters based on authentication settings. /// @param authNames The authentications to apply - void _updateParamsForAuth(List authNames, List queryParams, Map headerParams) { + void _updateParamsForAuth(List authNames, + List queryParams, Map headerParams) { authNames.forEach((authName) { Authentication auth = _authentications[authName]; - if (auth == null) throw new ArgumentError("Authentication undefined: " + authName); + if (auth == null) + throw new ArgumentError("Authentication undefined: " + authName); auth.applyToParams(queryParams, headerParams); }); } diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/api_exception.dart b/samples/client/petstore/dart/openapi-browser-client/lib/api_exception.dart index f188fd125a4..e485b6c3226 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/api_exception.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/api_exception.dart @@ -8,7 +8,8 @@ class ApiException implements Exception { ApiException(this.code, this.message); - ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); + ApiException.withInner( + this.code, this.message, this.innerException, this.stackTrace); String toString() { if (message == null) return "ApiException"; diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/api_helper.dart b/samples/client/petstore/dart/openapi-browser-client/lib/api_helper.dart index 79af4521d5b..e6f87d96bfb 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/api_helper.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/api_helper.dart @@ -4,7 +4,7 @@ const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; // port from Java version Iterable _convertParametersForCollectionFormat( - String collectionFormat, String name, dynamic value) { + String collectionFormat, String name, dynamic value) { var params = []; // preconditions @@ -19,8 +19,8 @@ Iterable _convertParametersForCollectionFormat( // get the collection format collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) - ? "csv" - : collectionFormat; // default: csv + ? "csv" + : collectionFormat; // default: csv if (collectionFormat == "multi") { return values.map((v) => new QueryParam(name, parameterToString(v))); @@ -28,7 +28,8 @@ Iterable _convertParametersForCollectionFormat( String delimiter = _delimiters[collectionFormat] ?? ","; - params.add(new QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter))); + params.add(new QueryParam( + name, values.map((v) => parameterToString(v)).join(delimiter))); return params; } diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/auth/api_key_auth.dart b/samples/client/petstore/dart/openapi-browser-client/lib/auth/api_key_auth.dart index f9617f7ae4d..69b407fd90e 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/auth/api_key_auth.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/auth/api_key_auth.dart @@ -1,7 +1,6 @@ part of openapi.api; class ApiKeyAuth implements Authentication { - final String location; final String paramName; String apiKey; @@ -10,7 +9,8 @@ class ApiKeyAuth implements Authentication { ApiKeyAuth(this.location, this.paramName); @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List queryParams, Map headerParams) { String value; if (apiKeyPrefix != null) { value = '$apiKeyPrefix $apiKey'; diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/auth/authentication.dart b/samples/client/petstore/dart/openapi-browser-client/lib/auth/authentication.dart index abd5e2fe68a..2c4d5f301fa 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/auth/authentication.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/auth/authentication.dart @@ -1,7 +1,7 @@ part of openapi.api; abstract class Authentication { - - /// Apply authentication settings to header and query params. - void applyToParams(List queryParams, Map headerParams); + /// Apply authentication settings to header and query params. + void applyToParams( + List queryParams, Map headerParams); } diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/auth/http_basic_auth.dart b/samples/client/petstore/dart/openapi-browser-client/lib/auth/http_basic_auth.dart index 4e77ddcf6e6..e26ec8a005a 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/auth/http_basic_auth.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/auth/http_basic_auth.dart @@ -1,14 +1,15 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - String username; String password; @override - void applyToParams(List queryParams, Map headerParams) { - String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + void applyToParams( + List queryParams, Map headerParams) { + String str = (username == null ? "" : username) + + ":" + + (password == null ? "" : password); headerParams["Authorization"] = "Basic " + BASE64.encode(UTF8.encode(str)); } - -} \ No newline at end of file +} diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/auth/oauth.dart b/samples/client/petstore/dart/openapi-browser-client/lib/auth/oauth.dart index 13bfd799743..829677d6c9c 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/auth/oauth.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/auth/oauth.dart @@ -3,11 +3,11 @@ part of openapi.api; class OAuth implements Authentication { String accessToken; - OAuth({this.accessToken}) { - } + OAuth({this.accessToken}) {} @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List queryParams, Map headerParams) { if (accessToken != null) { headerParams["Authorization"] = "Bearer " + accessToken; } diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/model/api_response.dart b/samples/client/petstore/dart/openapi-browser-client/lib/model/api_response.dart index a39d9500b29..5599d392539 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/model/api_response.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/model/api_response.dart @@ -1,11 +1,10 @@ part of openapi.api; class ApiResponse { - int code = null; - + String type = null; - + String message = null; ApiResponse(); @@ -22,23 +21,22 @@ class ApiResponse { } Map toJson() { - return { - 'code': code, - 'type': type, - 'message': message - }; + return {'code': code, 'type': type, 'message': message}; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new ApiResponse.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new ApiResponse.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { + static Map mapFromJson( + Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new ApiResponse.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new ApiResponse.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/model/category.dart b/samples/client/petstore/dart/openapi-browser-client/lib/model/category.dart index b9b2481dd29..bcc59c0e893 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/model/category.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/model/category.dart @@ -1,9 +1,8 @@ part of openapi.api; class Category { - int id = null; - + String name = null; Category(); @@ -19,22 +18,22 @@ class Category { } Map toJson() { - return { - 'id': id, - 'name': name - }; + return {'id': id, 'name': name}; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Category.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new Category.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { + static Map mapFromJson( + Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Category.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new Category.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/model/order.dart b/samples/client/petstore/dart/openapi-browser-client/lib/model/order.dart index 4e264a183ef..8fa9908b07e 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/model/order.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/model/order.dart @@ -1,18 +1,17 @@ part of openapi.api; class Order { - int id = null; - + int petId = null; - + int quantity = null; - + DateTime shipDate = null; /* Order Status */ String status = null; //enum statusEnum { placed, approved, delivered, };{ - + bool complete = false; Order(); @@ -26,7 +25,8 @@ class Order { id = json['id']; petId = json['petId']; quantity = json['quantity']; - shipDate = json['shipDate'] == null ? null : DateTime.parse(json['shipDate']); + shipDate = + json['shipDate'] == null ? null : DateTime.parse(json['shipDate']); status = json['status']; complete = json['complete']; } @@ -43,15 +43,18 @@ class Order { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Order.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new Order.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { + static Map mapFromJson( + Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Order.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new Order.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/model/pet.dart b/samples/client/petstore/dart/openapi-browser-client/lib/model/pet.dart index 4d2f77a1a5a..b80a0491345 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/model/pet.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/model/pet.dart @@ -1,15 +1,14 @@ part of openapi.api; class Pet { - int id = null; - + Category category = null; - + String name = null; - + List photoUrls = []; - + List tags = []; /* pet status in the store */ String status = null; @@ -26,7 +25,8 @@ class Pet { id = json['id']; category = new Category.fromJson(json['category']); name = json['name']; - photoUrls = (json['photoUrls'] as List).map((item) => item as String).toList(); + photoUrls = + (json['photoUrls'] as List).map((item) => item as String).toList(); tags = Tag.listFromJson(json['tags']); status = json['status']; } @@ -43,15 +43,17 @@ class Pet { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Pet.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new Pet.fromJson(value)).toList(); } static Map mapFromJson(Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Pet.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new Pet.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/model/tag.dart b/samples/client/petstore/dart/openapi-browser-client/lib/model/tag.dart index 315a326adb7..ce683e031c4 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/model/tag.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/model/tag.dart @@ -1,9 +1,8 @@ part of openapi.api; class Tag { - int id = null; - + String name = null; Tag(); @@ -19,22 +18,21 @@ class Tag { } Map toJson() { - return { - 'id': id, - 'name': name - }; + return {'id': id, 'name': name}; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Tag.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new Tag.fromJson(value)).toList(); } static Map mapFromJson(Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Tag.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new Tag.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/openapi-browser-client/lib/model/user.dart b/samples/client/petstore/dart/openapi-browser-client/lib/model/user.dart index 0e4cc2104c7..faa02b1ad13 100644 --- a/samples/client/petstore/dart/openapi-browser-client/lib/model/user.dart +++ b/samples/client/petstore/dart/openapi-browser-client/lib/model/user.dart @@ -1,19 +1,18 @@ part of openapi.api; class User { - int id = null; - + String username = null; - + String firstName = null; - + String lastName = null; - + String email = null; - + String password = null; - + String phone = null; /* User Status */ int userStatus = null; @@ -50,15 +49,17 @@ class User { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new User.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new User.fromJson(value)).toList(); } static Map mapFromJson(Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new User.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new User.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/openapi/.openapi-generator/VERSION b/samples/client/petstore/dart/openapi/.openapi-generator/VERSION index 096bf47efe3..f4cb97d56ce 100644 --- a/samples/client/petstore/dart/openapi/.openapi-generator/VERSION +++ b/samples/client/petstore/dart/openapi/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart/openapi/docs/PetApi.md b/samples/client/petstore/dart/openapi/docs/PetApi.md index 6fa9abf67ae..cb39b3f22d3 100644 --- a/samples/client/petstore/dart/openapi/docs/PetApi.md +++ b/samples/client/petstore/dart/openapi/docs/PetApi.md @@ -87,8 +87,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| Pet id to delete | - **apiKey** | **String**| | [optional] + **petId** | **int**| Pet id to delete | [default to null] + **apiKey** | **String**| | [optional] [default to null] ### Return type @@ -133,7 +133,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] ### Return type @@ -178,7 +178,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] ### Return type @@ -225,7 +225,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to return | + **petId** | **int**| ID of pet to return | [default to null] ### Return type @@ -311,7 +311,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet that needs to be updated | + **petId** | **int**| ID of pet that needs to be updated | [default to null] **name** | **String**| Updated name of the pet | [optional] [default to null] **status** | **String**| Updated status of the pet | [optional] [default to null] @@ -358,7 +358,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **int**| ID of pet to update | + **petId** | **int**| ID of pet to update | [default to null] **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] **file** | **MultipartFile**| file to upload | [optional] [default to null] diff --git a/samples/client/petstore/dart/openapi/docs/StoreApi.md b/samples/client/petstore/dart/openapi/docs/StoreApi.md index cc0c2ac2d35..0cbbd758efd 100644 --- a/samples/client/petstore/dart/openapi/docs/StoreApi.md +++ b/samples/client/petstore/dart/openapi/docs/StoreApi.md @@ -40,7 +40,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **String**| ID of the order that needs to be deleted | + **orderId** | **String**| ID of the order that needs to be deleted | [default to null] ### Return type @@ -126,7 +126,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **int**| ID of pet that needs to be fetched | + **orderId** | **int**| ID of pet that needs to be fetched | [default to null] ### Return type diff --git a/samples/client/petstore/dart/openapi/docs/UserApi.md b/samples/client/petstore/dart/openapi/docs/UserApi.md index 0dec271be5c..9abe3cc83e2 100644 --- a/samples/client/petstore/dart/openapi/docs/UserApi.md +++ b/samples/client/petstore/dart/openapi/docs/UserApi.md @@ -166,7 +166,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be deleted | + **username** | **String**| The name that needs to be deleted | [default to null] ### Return type @@ -207,7 +207,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The name that needs to be fetched. Use user1 for testing. | + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] ### Return type @@ -249,8 +249,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| The user name for login | - **password** | **String**| The password for login in clear text | + **username** | **String**| The user name for login | [default to null] + **password** | **String**| The password for login in clear text | [default to null] ### Return type @@ -329,7 +329,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **String**| name that need to be deleted | + **username** | **String**| name that need to be deleted | [default to null] **user** | [**User**](User.md)| Updated user object | ### Return type diff --git a/samples/client/petstore/dart/openapi/lib/api.dart b/samples/client/petstore/dart/openapi/lib/api.dart index 9a64a5342b4..756e554c43f 100644 --- a/samples/client/petstore/dart/openapi/lib/api.dart +++ b/samples/client/petstore/dart/openapi/lib/api.dart @@ -23,5 +23,4 @@ part 'model/pet.dart'; part 'model/tag.dart'; part 'model/user.dart'; - ApiClient defaultApiClient = new ApiClient(); diff --git a/samples/client/petstore/dart/openapi/lib/api/pet_api.dart b/samples/client/petstore/dart/openapi/lib/api/pet_api.dart index 4134e018386..81b5ad0c880 100644 --- a/samples/client/petstore/dart/openapi/lib/api/pet_api.dart +++ b/samples/client/petstore/dart/openapi/lib/api/pet_api.dart @@ -1,7 +1,5 @@ part of openapi.api; - - class PetApi { final ApiClient apiClient; @@ -9,66 +7,60 @@ class PetApi { /// Add a new pet to the store /// - /// + /// Future addPet(Pet pet) async { Object postBody = pet; // verify required params are set - if(pet == null) { - throw new ApiException(400, "Missing required param: pet"); + if (pet == null) { + throw new ApiException(400, "Missing required param: pet"); } // create path and map variables - String path = "/pet".replaceAll("{format}","json"); + String path = "/pet".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - List contentTypes = ["application/json","application/xml"]; + List contentTypes = ["application/json", "application/xml"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Deletes a pet /// - /// - Future deletePet(int petId, { String apiKey }) async { + /// + Future deletePet(int petId, {String apiKey}) async { Object postBody = null; // verify required params are set - if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); } // create path and map variables - String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); // query params List queryParams = []; @@ -78,34 +70,26 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Finds Pets by status /// /// Multiple status values can be provided with comma separated strings @@ -113,50 +97,46 @@ class PetApi { Object postBody = null; // verify required params are set - if(status == null) { - throw new ApiException(400, "Missing required param: status"); + if (status == null) { + throw new ApiException(400, "Missing required param: status"); } // create path and map variables - String path = "/pet/findByStatus".replaceAll("{format}","json"); + String path = "/pet/findByStatus".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("csv", "status", status)); + queryParams + .addAll(_convertParametersForCollectionFormat("csv", "status", status)); List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - return (apiClient.deserialize(response.body, 'List') as List).map((item) => item as Pet).toList(); + } else if (response.body != null) { + return (apiClient.deserialize(response.body, 'List') as List) + .map((item) => item as Pet) + .toList(); } else { return null; } } + /// Finds Pets by tags /// /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. @@ -164,50 +144,46 @@ class PetApi { Object postBody = null; // verify required params are set - if(tags == null) { - throw new ApiException(400, "Missing required param: tags"); + if (tags == null) { + throw new ApiException(400, "Missing required param: tags"); } // create path and map variables - String path = "/pet/findByTags".replaceAll("{format}","json"); + String path = "/pet/findByTags".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); + queryParams + .addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - return (apiClient.deserialize(response.body, 'List') as List).map((item) => item as Pet).toList(); + } else if (response.body != null) { + return (apiClient.deserialize(response.body, 'List') as List) + .map((item) => item as Pet) + .toList(); } else { return null; } } + /// Find pet by ID /// /// Returns a single pet @@ -215,12 +191,14 @@ class PetApi { Object postBody = null; // verify required params are set - if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); } // create path and map variables - String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); // query params List queryParams = []; @@ -229,97 +207,84 @@ class PetApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["api_key"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'Pet') as Pet; } else { return null; } } + /// Update an existing pet /// - /// + /// Future updatePet(Pet pet) async { Object postBody = pet; // verify required params are set - if(pet == null) { - throw new ApiException(400, "Missing required param: pet"); + if (pet == null) { + throw new ApiException(400, "Missing required param: pet"); } // create path and map variables - String path = "/pet".replaceAll("{format}","json"); + String path = "/pet".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - List contentTypes = ["application/json","application/xml"]; + List contentTypes = ["application/json", "application/xml"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Updates a pet in the store with form data /// - /// - Future updatePetWithForm(int petId, { String name, String status }) async { + /// + Future updatePetWithForm(int petId, {String name, String status}) async { Object postBody = null; // verify required params are set - if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); } // create path and map variables - String path = "/pet/{petId}".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); // query params List queryParams = []; @@ -328,10 +293,11 @@ class PetApi { List contentTypes = ["application/x-www-form-urlencoded"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); if (name != null) { @@ -342,45 +308,38 @@ class PetApi { hasFields = true; mp.fields['status'] = parameterToString(status); } - if(hasFields) - postBody = mp; - } - else { - if (name != null) - formParams['name'] = parameterToString(name); - if (status != null) - formParams['status'] = parameterToString(status); - } - - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); - - if(response.statusCode >= 400) { - throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + if (hasFields) postBody = mp; } else { + if (name != null) formParams['name'] = parameterToString(name); + if (status != null) formParams['status'] = parameterToString(status); + } + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { return; } } + /// uploads an image /// - /// - Future uploadFile(int petId, { String additionalMetadata, MultipartFile file }) async { + /// + Future uploadFile(int petId, + {String additionalMetadata, MultipartFile file}) async { Object postBody = null; // verify required params are set - if(petId == null) { - throw new ApiException(400, "Missing required param: petId"); + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); } // create path and map variables - String path = "/pet/{petId}/uploadImage".replaceAll("{format}","json").replaceAll("{" + "petId" + "}", petId.toString()); + String path = "/pet/{petId}/uploadImage" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); // query params List queryParams = []; @@ -389,10 +348,11 @@ class PetApi { List contentTypes = ["multipart/form-data"]; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["petstore_auth"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); if (additionalMetadata != null) { @@ -404,26 +364,19 @@ class PetApi { mp.fields['file'] = file.field; mp.files.add(file); } - if(hasFields) - postBody = mp; - } - else { + if (hasFields) postBody = mp; + } else { if (additionalMetadata != null) - formParams['additionalMetadata'] = parameterToString(additionalMetadata); + formParams['additionalMetadata'] = + parameterToString(additionalMetadata); } - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'ApiResponse') as ApiResponse; } else { return null; diff --git a/samples/client/petstore/dart/openapi/lib/api/store_api.dart b/samples/client/petstore/dart/openapi/lib/api/store_api.dart index f2a48f2d4da..a3f62747d50 100644 --- a/samples/client/petstore/dart/openapi/lib/api/store_api.dart +++ b/samples/client/petstore/dart/openapi/lib/api/store_api.dart @@ -1,7 +1,5 @@ part of openapi.api; - - class StoreApi { final ApiClient apiClient; @@ -14,12 +12,14 @@ class StoreApi { Object postBody = null; // verify required params are set - if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + if (orderId == null) { + throw new ApiException(400, "Missing required param: orderId"); } // create path and map variables - String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString()); + String path = "/store/order/{orderId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "orderId" + "}", orderId.toString()); // query params List queryParams = []; @@ -28,34 +28,26 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Returns pet inventories by status /// /// Returns a map of status codes to quantities @@ -65,7 +57,7 @@ class StoreApi { // verify required params are set // create path and map variables - String path = "/store/inventory".replaceAll("{format}","json"); + String path = "/store/inventory".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -74,36 +66,30 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = ["api_key"]; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - return new Map.from(apiClient.deserialize(response.body, 'Map')); - ; + } else if (response.body != null) { + return new Map.from( + apiClient.deserialize(response.body, 'Map')); + ; } else { return null; } } + /// Find purchase order by ID /// /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions @@ -111,12 +97,14 @@ class StoreApi { Object postBody = null; // verify required params are set - if(orderId == null) { - throw new ApiException(400, "Missing required param: orderId"); + if (orderId == null) { + throw new ApiException(400, "Missing required param: orderId"); } // create path and map variables - String path = "/store/order/{orderId}".replaceAll("{format}","json").replaceAll("{" + "orderId" + "}", orderId.toString()); + String path = "/store/order/{orderId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "orderId" + "}", orderId.toString()); // query params List queryParams = []; @@ -125,48 +113,41 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'Order') as Order; } else { return null; } } + /// Place an order for a pet /// - /// + /// Future placeOrder(Order order) async { Object postBody = order; // verify required params are set - if(order == null) { - throw new ApiException(400, "Missing required param: order"); + if (order == null) { + throw new ApiException(400, "Missing required param: order"); } // create path and map variables - String path = "/store/order".replaceAll("{format}","json"); + String path = "/store/order".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -175,30 +156,22 @@ class StoreApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'Order') as Order; } else { return null; diff --git a/samples/client/petstore/dart/openapi/lib/api/user_api.dart b/samples/client/petstore/dart/openapi/lib/api/user_api.dart index cf8ef6bf800..62e8759ede8 100644 --- a/samples/client/petstore/dart/openapi/lib/api/user_api.dart +++ b/samples/client/petstore/dart/openapi/lib/api/user_api.dart @@ -1,7 +1,5 @@ part of openapi.api; - - class UserApi { final ApiClient apiClient; @@ -14,12 +12,12 @@ class UserApi { Object postBody = user; // verify required params are set - if(user == null) { - throw new ApiException(400, "Missing required param: user"); + if (user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables - String path = "/user".replaceAll("{format}","json"); + String path = "/user".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -28,47 +26,39 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Creates list of users with given input array /// - /// + /// Future createUsersWithArrayInput(List user) async { Object postBody = user; // verify required params are set - if(user == null) { - throw new ApiException(400, "Missing required param: user"); + if (user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables - String path = "/user/createWithArray".replaceAll("{format}","json"); + String path = "/user/createWithArray".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -77,47 +67,39 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Creates list of users with given input array /// - /// + /// Future createUsersWithListInput(List user) async { Object postBody = user; // verify required params are set - if(user == null) { - throw new ApiException(400, "Missing required param: user"); + if (user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables - String path = "/user/createWithList".replaceAll("{format}","json"); + String path = "/user/createWithList".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -126,34 +108,26 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'POST', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Delete user /// /// This can only be done by the logged in user. @@ -161,12 +135,14 @@ class UserApi { Object postBody = null; // verify required params are set - if(username == null) { - throw new ApiException(400, "Missing required param: username"); + if (username == null) { + throw new ApiException(400, "Missing required param: username"); } // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); // query params List queryParams = []; @@ -175,47 +151,41 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'DELETE', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Get user by user name /// - /// + /// Future getUserByName(String username) async { Object postBody = null; // verify required params are set - if(username == null) { - throw new ApiException(400, "Missing required param: username"); + if (username == null) { + throw new ApiException(400, "Missing required param: username"); } // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); // query params List queryParams = []; @@ -224,100 +194,88 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'User') as User; } else { return null; } } + /// Logs user into the system /// - /// + /// Future loginUser(String username, String password) async { Object postBody = null; // verify required params are set - if(username == null) { - throw new ApiException(400, "Missing required param: username"); + if (username == null) { + throw new ApiException(400, "Missing required param: username"); } - if(password == null) { - throw new ApiException(400, "Missing required param: password"); + if (password == null) { + throw new ApiException(400, "Missing required param: password"); } // create path and map variables - String path = "/user/login".replaceAll("{format}","json"); + String path = "/user/login".replaceAll("{format}", "json"); // query params List queryParams = []; Map headerParams = {}; Map formParams = {}; - queryParams.addAll(_convertParametersForCollectionFormat("", "username", username)); - queryParams.addAll(_convertParametersForCollectionFormat("", "password", password)); + queryParams.addAll( + _convertParametersForCollectionFormat("", "username", username)); + queryParams.addAll( + _convertParametersForCollectionFormat("", "password", password)); List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { + } else if (response.body != null) { return apiClient.deserialize(response.body, 'String') as String; } else { return null; } } + /// Logs out current logged in user session /// - /// + /// Future logoutUser() async { Object postBody = null; // verify required params are set // create path and map variables - String path = "/user/logout".replaceAll("{format}","json"); + String path = "/user/logout".replaceAll("{format}", "json"); // query params List queryParams = []; @@ -326,34 +284,26 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'GET', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } + /// Updated user /// /// This can only be done by the logged in user. @@ -361,15 +311,17 @@ class UserApi { Object postBody = user; // verify required params are set - if(username == null) { - throw new ApiException(400, "Missing required param: username"); + if (username == null) { + throw new ApiException(400, "Missing required param: username"); } - if(user == null) { - throw new ApiException(400, "Missing required param: user"); + if (user == null) { + throw new ApiException(400, "Missing required param: user"); } // create path and map variables - String path = "/user/{username}".replaceAll("{format}","json").replaceAll("{" + "username" + "}", username.toString()); + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); // query params List queryParams = []; @@ -378,31 +330,22 @@ class UserApi { List contentTypes = []; - String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json"; + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; List authNames = []; - if(contentType.startsWith("multipart/form-data")) { + if (contentType.startsWith("multipart/form-data")) { bool hasFields = false; MultipartRequest mp = new MultipartRequest(null, null); - if(hasFields) - postBody = mp; - } - else { - } + if (hasFields) postBody = mp; + } else {} - var response = await apiClient.invokeAPI(path, - 'PUT', - queryParams, - postBody, - headerParams, - formParams, - contentType, - authNames); + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, + headerParams, formParams, contentType, authNames); - if(response.statusCode >= 400) { + if (response.statusCode >= 400) { throw new ApiException(response.statusCode, response.body); - } else if(response.body != null) { - } else { + } else if (response.body != null) {} else { return; } } diff --git a/samples/client/petstore/dart/openapi/lib/api_client.dart b/samples/client/petstore/dart/openapi/lib/api_client.dart index db4116dd96d..c99c6d8c492 100644 --- a/samples/client/petstore/dart/openapi/lib/api_client.dart +++ b/samples/client/petstore/dart/openapi/lib/api_client.dart @@ -8,7 +8,6 @@ class QueryParam { } class ApiClient { - String basePath; var client = new Client(); @@ -25,7 +24,7 @@ class ApiClient { } void addDefaultHeader(String key, String value) { - _defaultHeaderMap[key] = value; + _defaultHeaderMap[key] = value; } dynamic _deserialize(dynamic value, String targetType) { @@ -67,9 +66,11 @@ class ApiClient { } } } catch (e, stack) { - throw new ApiException.withInner(500, 'Exception during deserialization.', e, stack); + throw new ApiException.withInner( + 500, 'Exception during deserialization.', e, stack); } - throw new ApiException(500, 'Could not find a suitable class for deserialization'); + throw new ApiException( + 500, 'Could not find a suitable class for deserialization'); } dynamic deserialize(String json, String targetType) { @@ -94,28 +95,28 @@ class ApiClient { // We don't use a Map for queryParams. // If collectionFormat is 'multi' a key might appear multiple times. - Future invokeAPI(String path, - String method, - Iterable queryParams, - Object body, - Map headerParams, - Map formParams, - String contentType, - List authNames) async { - + Future invokeAPI( + String path, + String method, + Iterable queryParams, + Object body, + Map headerParams, + Map formParams, + String contentType, + List authNames) async { _updateParamsForAuth(authNames, queryParams, headerParams); - var ps = queryParams.where((p) => p.value != null).map((p) => '${p.name}=${p.value}'); - String queryString = ps.isNotEmpty ? - '?' + ps.join('&') : - ''; + var ps = queryParams + .where((p) => p.value != null) + .map((p) => '${p.name}=${p.value}'); + String queryString = ps.isNotEmpty ? '?' + ps.join('&') : ''; String url = basePath + path + queryString; headerParams.addAll(_defaultHeaderMap); headerParams['Content-Type'] = contentType; - if(body is MultipartRequest) { + if (body is MultipartRequest) { var request = new MultipartRequest(method, Uri.parse(url)); request.fields.addAll(body.fields); request.files.addAll(body.files); @@ -124,8 +125,10 @@ class ApiClient { var response = await client.send(request); return Response.fromStream(response); } else { - var msgBody = contentType == "application/x-www-form-urlencoded" ? formParams : serialize(body); - switch(method) { + var msgBody = contentType == "application/x-www-form-urlencoded" + ? formParams + : serialize(body); + switch (method) { case "POST": return client.post(url, headers: headerParams, body: msgBody); case "PUT": @@ -142,10 +145,12 @@ class ApiClient { /// Update query and header parameters based on authentication settings. /// @param authNames The authentications to apply - void _updateParamsForAuth(List authNames, List queryParams, Map headerParams) { + void _updateParamsForAuth(List authNames, + List queryParams, Map headerParams) { authNames.forEach((authName) { Authentication auth = _authentications[authName]; - if (auth == null) throw new ArgumentError("Authentication undefined: " + authName); + if (auth == null) + throw new ArgumentError("Authentication undefined: " + authName); auth.applyToParams(queryParams, headerParams); }); } diff --git a/samples/client/petstore/dart/openapi/lib/api_exception.dart b/samples/client/petstore/dart/openapi/lib/api_exception.dart index f188fd125a4..e485b6c3226 100644 --- a/samples/client/petstore/dart/openapi/lib/api_exception.dart +++ b/samples/client/petstore/dart/openapi/lib/api_exception.dart @@ -8,7 +8,8 @@ class ApiException implements Exception { ApiException(this.code, this.message); - ApiException.withInner(this.code, this.message, this.innerException, this.stackTrace); + ApiException.withInner( + this.code, this.message, this.innerException, this.stackTrace); String toString() { if (message == null) return "ApiException"; diff --git a/samples/client/petstore/dart/openapi/lib/api_helper.dart b/samples/client/petstore/dart/openapi/lib/api_helper.dart index 79af4521d5b..e6f87d96bfb 100644 --- a/samples/client/petstore/dart/openapi/lib/api_helper.dart +++ b/samples/client/petstore/dart/openapi/lib/api_helper.dart @@ -4,7 +4,7 @@ const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; // port from Java version Iterable _convertParametersForCollectionFormat( - String collectionFormat, String name, dynamic value) { + String collectionFormat, String name, dynamic value) { var params = []; // preconditions @@ -19,8 +19,8 @@ Iterable _convertParametersForCollectionFormat( // get the collection format collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) - ? "csv" - : collectionFormat; // default: csv + ? "csv" + : collectionFormat; // default: csv if (collectionFormat == "multi") { return values.map((v) => new QueryParam(name, parameterToString(v))); @@ -28,7 +28,8 @@ Iterable _convertParametersForCollectionFormat( String delimiter = _delimiters[collectionFormat] ?? ","; - params.add(new QueryParam(name, values.map((v) => parameterToString(v)).join(delimiter))); + params.add(new QueryParam( + name, values.map((v) => parameterToString(v)).join(delimiter))); return params; } diff --git a/samples/client/petstore/dart/openapi/lib/auth/api_key_auth.dart b/samples/client/petstore/dart/openapi/lib/auth/api_key_auth.dart index f9617f7ae4d..69b407fd90e 100644 --- a/samples/client/petstore/dart/openapi/lib/auth/api_key_auth.dart +++ b/samples/client/petstore/dart/openapi/lib/auth/api_key_auth.dart @@ -1,7 +1,6 @@ part of openapi.api; class ApiKeyAuth implements Authentication { - final String location; final String paramName; String apiKey; @@ -10,7 +9,8 @@ class ApiKeyAuth implements Authentication { ApiKeyAuth(this.location, this.paramName); @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List queryParams, Map headerParams) { String value; if (apiKeyPrefix != null) { value = '$apiKeyPrefix $apiKey'; diff --git a/samples/client/petstore/dart/openapi/lib/auth/authentication.dart b/samples/client/petstore/dart/openapi/lib/auth/authentication.dart index abd5e2fe68a..2c4d5f301fa 100644 --- a/samples/client/petstore/dart/openapi/lib/auth/authentication.dart +++ b/samples/client/petstore/dart/openapi/lib/auth/authentication.dart @@ -1,7 +1,7 @@ part of openapi.api; abstract class Authentication { - - /// Apply authentication settings to header and query params. - void applyToParams(List queryParams, Map headerParams); + /// Apply authentication settings to header and query params. + void applyToParams( + List queryParams, Map headerParams); } diff --git a/samples/client/petstore/dart/openapi/lib/auth/http_basic_auth.dart b/samples/client/petstore/dart/openapi/lib/auth/http_basic_auth.dart index 4e77ddcf6e6..e26ec8a005a 100644 --- a/samples/client/petstore/dart/openapi/lib/auth/http_basic_auth.dart +++ b/samples/client/petstore/dart/openapi/lib/auth/http_basic_auth.dart @@ -1,14 +1,15 @@ part of openapi.api; class HttpBasicAuth implements Authentication { - String username; String password; @override - void applyToParams(List queryParams, Map headerParams) { - String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); + void applyToParams( + List queryParams, Map headerParams) { + String str = (username == null ? "" : username) + + ":" + + (password == null ? "" : password); headerParams["Authorization"] = "Basic " + BASE64.encode(UTF8.encode(str)); } - -} \ No newline at end of file +} diff --git a/samples/client/petstore/dart/openapi/lib/auth/oauth.dart b/samples/client/petstore/dart/openapi/lib/auth/oauth.dart index 13bfd799743..829677d6c9c 100644 --- a/samples/client/petstore/dart/openapi/lib/auth/oauth.dart +++ b/samples/client/petstore/dart/openapi/lib/auth/oauth.dart @@ -3,11 +3,11 @@ part of openapi.api; class OAuth implements Authentication { String accessToken; - OAuth({this.accessToken}) { - } + OAuth({this.accessToken}) {} @override - void applyToParams(List queryParams, Map headerParams) { + void applyToParams( + List queryParams, Map headerParams) { if (accessToken != null) { headerParams["Authorization"] = "Bearer " + accessToken; } diff --git a/samples/client/petstore/dart/openapi/lib/model/api_response.dart b/samples/client/petstore/dart/openapi/lib/model/api_response.dart index a39d9500b29..5599d392539 100644 --- a/samples/client/petstore/dart/openapi/lib/model/api_response.dart +++ b/samples/client/petstore/dart/openapi/lib/model/api_response.dart @@ -1,11 +1,10 @@ part of openapi.api; class ApiResponse { - int code = null; - + String type = null; - + String message = null; ApiResponse(); @@ -22,23 +21,22 @@ class ApiResponse { } Map toJson() { - return { - 'code': code, - 'type': type, - 'message': message - }; + return {'code': code, 'type': type, 'message': message}; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new ApiResponse.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new ApiResponse.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { + static Map mapFromJson( + Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new ApiResponse.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new ApiResponse.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/openapi/lib/model/category.dart b/samples/client/petstore/dart/openapi/lib/model/category.dart index b9b2481dd29..bcc59c0e893 100644 --- a/samples/client/petstore/dart/openapi/lib/model/category.dart +++ b/samples/client/petstore/dart/openapi/lib/model/category.dart @@ -1,9 +1,8 @@ part of openapi.api; class Category { - int id = null; - + String name = null; Category(); @@ -19,22 +18,22 @@ class Category { } Map toJson() { - return { - 'id': id, - 'name': name - }; + return {'id': id, 'name': name}; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Category.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new Category.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { + static Map mapFromJson( + Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Category.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new Category.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/openapi/lib/model/order.dart b/samples/client/petstore/dart/openapi/lib/model/order.dart index 4e264a183ef..8fa9908b07e 100644 --- a/samples/client/petstore/dart/openapi/lib/model/order.dart +++ b/samples/client/petstore/dart/openapi/lib/model/order.dart @@ -1,18 +1,17 @@ part of openapi.api; class Order { - int id = null; - + int petId = null; - + int quantity = null; - + DateTime shipDate = null; /* Order Status */ String status = null; //enum statusEnum { placed, approved, delivered, };{ - + bool complete = false; Order(); @@ -26,7 +25,8 @@ class Order { id = json['id']; petId = json['petId']; quantity = json['quantity']; - shipDate = json['shipDate'] == null ? null : DateTime.parse(json['shipDate']); + shipDate = + json['shipDate'] == null ? null : DateTime.parse(json['shipDate']); status = json['status']; complete = json['complete']; } @@ -43,15 +43,18 @@ class Order { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Order.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new Order.fromJson(value)).toList(); } - static Map mapFromJson(Map> json) { + static Map mapFromJson( + Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Order.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new Order.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/openapi/lib/model/pet.dart b/samples/client/petstore/dart/openapi/lib/model/pet.dart index 4d2f77a1a5a..b80a0491345 100644 --- a/samples/client/petstore/dart/openapi/lib/model/pet.dart +++ b/samples/client/petstore/dart/openapi/lib/model/pet.dart @@ -1,15 +1,14 @@ part of openapi.api; class Pet { - int id = null; - + Category category = null; - + String name = null; - + List photoUrls = []; - + List tags = []; /* pet status in the store */ String status = null; @@ -26,7 +25,8 @@ class Pet { id = json['id']; category = new Category.fromJson(json['category']); name = json['name']; - photoUrls = (json['photoUrls'] as List).map((item) => item as String).toList(); + photoUrls = + (json['photoUrls'] as List).map((item) => item as String).toList(); tags = Tag.listFromJson(json['tags']); status = json['status']; } @@ -43,15 +43,17 @@ class Pet { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Pet.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new Pet.fromJson(value)).toList(); } static Map mapFromJson(Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Pet.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new Pet.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/openapi/lib/model/tag.dart b/samples/client/petstore/dart/openapi/lib/model/tag.dart index 315a326adb7..ce683e031c4 100644 --- a/samples/client/petstore/dart/openapi/lib/model/tag.dart +++ b/samples/client/petstore/dart/openapi/lib/model/tag.dart @@ -1,9 +1,8 @@ part of openapi.api; class Tag { - int id = null; - + String name = null; Tag(); @@ -19,22 +18,21 @@ class Tag { } Map toJson() { - return { - 'id': id, - 'name': name - }; + return {'id': id, 'name': name}; } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new Tag.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new Tag.fromJson(value)).toList(); } static Map mapFromJson(Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new Tag.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new Tag.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart/openapi/lib/model/user.dart b/samples/client/petstore/dart/openapi/lib/model/user.dart index 0e4cc2104c7..faa02b1ad13 100644 --- a/samples/client/petstore/dart/openapi/lib/model/user.dart +++ b/samples/client/petstore/dart/openapi/lib/model/user.dart @@ -1,19 +1,18 @@ part of openapi.api; class User { - int id = null; - + String username = null; - + String firstName = null; - + String lastName = null; - + String email = null; - + String password = null; - + String phone = null; /* User Status */ int userStatus = null; @@ -50,15 +49,17 @@ class User { } static List listFromJson(List json) { - return json == null ? new List() : json.map((value) => new User.fromJson(value)).toList(); + return json == null + ? new List() + : json.map((value) => new User.fromJson(value)).toList(); } static Map mapFromJson(Map> json) { var map = new Map(); if (json != null && json.length > 0) { - json.forEach((String key, Map value) => map[key] = new User.fromJson(value)); + json.forEach((String key, Map value) => + map[key] = new User.fromJson(value)); } return map; } } - diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/.analysis_options b/samples/client/petstore/dart2/flutter_petstore/openapi/.analysis_options new file mode 100644 index 00000000000..518eb901a6f --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true \ No newline at end of file diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/.gitignore b/samples/client/petstore/dart2/flutter_petstore/openapi/.gitignore new file mode 100644 index 00000000000..7c280441649 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/.gitignore @@ -0,0 +1,27 @@ +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/.openapi-generator-ignore b/samples/client/petstore/dart2/flutter_petstore/openapi/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/.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/dart2/flutter_petstore/openapi/.openapi-generator/VERSION b/samples/client/petstore/dart2/flutter_petstore/openapi/.openapi-generator/VERSION new file mode 100644 index 00000000000..f4cb97d56ce --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/README.md b/samples/client/petstore/dart2/flutter_petstore/openapi/README.md new file mode 100644 index 00000000000..5f3fe054784 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/README.md @@ -0,0 +1,121 @@ +# openapi +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Build package: org.openapitools.codegen.languages.DartClientCodegen + +## Requirements + +Dart 1.20.0 or later OR Flutter 0.0.20 or later + +## Installation & Usage + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +``` +name: openapi +version: 1.0.0 +description: OpenAPI API client +dependencies: + openapi: + git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + version: 'any' +``` + +### Local +To use the package in your local drive, please include the following in pubspec.yaml +``` +dependencies: + openapi: + path: /path/to/openapi +``` + +## Tests + +TODO + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/api.dart'; + +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print("Exception when calling PetApi->addPet: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*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 +*StoreApi* | [**deleteOrder**](docs//StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | 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/{orderId} | 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 + + - [ApiResponse](docs//ApiResponse.md) + - [Category](docs//Category.md) + - [Order](docs//Order.md) + - [Pet](docs//Pet.md) + - [Tag](docs//Tag.md) + - [User](docs//User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## 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/dart2/flutter_petstore/openapi/docs/ApiResponse.md b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/ApiResponse.md @@ -0,0 +1,17 @@ +# openapi.model.ApiResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] [default to null] +**type** | **String** | | [optional] [default to null] +**message** | **String** | | [optional] [default to null] + +[[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/dart2/flutter_petstore/openapi/docs/Category.md b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**name** | **String** | | [optional] [default to null] + +[[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/dart2/flutter_petstore/openapi/docs/Order.md b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**petId** | **int** | | [optional] [default to null] +**quantity** | **int** | | [optional] [default to null] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] +**status** | **String** | Order Status | [optional] [default to null] +**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/dart2/flutter_petstore/openapi/docs/Pet.md b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/Pet.md new file mode 100644 index 00000000000..191e1fc66a9 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**category** | [**Category**](Category.md) | | [optional] [default to null] +**name** | **String** | | [default to null] +**photoUrls** | **List<String>** | | [default to []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] +**status** | **String** | pet status in the store | [optional] [default to null] + +[[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/dart2/flutter_petstore/openapi/docs/PetApi.md b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/PetApi.md new file mode 100644 index 00000000000..cb39b3f22d3 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/PetApi.md @@ -0,0 +1,379 @@ +# openapi.api.PetApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> addPet(pet) + +Add a new pet to the store + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print("Exception when calling PetApi->addPet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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** +> deletePet(petId, apiKey) + +Deletes a pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | Pet id to delete +var apiKey = apiKey_example; // String | + +try { + api_instance.deletePet(petId, apiKey); +} catch (e) { + print("Exception when calling PetApi->deletePet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| Pet id to delete | [default to null] + **apiKey** | **String**| | [optional] [default to null] + +### 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** +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var status = []; // List | Status values that need to be considered for filter + +try { + var result = api_instance.findPetsByStatus(status); + print(result); +} catch (e) { + print("Exception when calling PetApi->findPetsByStatus: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] + +### Return type + +[**List**](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** +> List findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var tags = []; // List | Tags to filter by + +try { + var result = api_instance.findPetsByTags(tags); + print(result); +} catch (e) { + print("Exception when calling PetApi->findPetsByTags: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] + +### Return type + +[**List**](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** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to return + +try { + var result = api_instance.getPetById(petId); + print(result); +} catch (e) { + print("Exception when calling PetApi->getPetById: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to return | [default to null] + +### 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** +> updatePet(pet) + +Update an existing pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.updatePet(pet); +} catch (e) { + print("Exception when calling PetApi->updatePet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet that needs to be updated +var name = name_example; // String | Updated name of the pet +var status = status_example; // String | Updated status of the pet + +try { + api_instance.updatePetWithForm(petId, name, status); +} catch (e) { + print("Exception when calling PetApi->updatePetWithForm: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet that needs to be updated | [default to null] + **name** | **String**| Updated name of the pet | [optional] [default to null] + **status** | **String**| Updated status of the pet | [optional] [default to null] + +### 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** +> ApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to update +var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +var file = BINARY_DATA_HERE; // MultipartFile | file to upload + +try { + var result = api_instance.uploadFile(petId, additionalMetadata, file); + print(result); +} catch (e) { + print("Exception when calling PetApi->uploadFile: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **file** | **MultipartFile**| file to upload | [optional] [default to null] + +### 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/dart2/flutter_petstore/openapi/docs/StoreApi.md b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/StoreApi.md new file mode 100644 index 00000000000..0cbbd758efd --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/StoreApi.md @@ -0,0 +1,186 @@ +# openapi.api.StoreApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> 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 +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var orderId = orderId_example; // String | ID of the order that needs to be deleted + +try { + api_instance.deleteOrder(orderId); +} catch (e) { + print("Exception when calling StoreApi->deleteOrder: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | [default to null] + +### 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** +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; + +var api_instance = new StoreApi(); + +try { + var result = api_instance.getInventory(); + print(result); +} catch (e) { + print("Exception when calling StoreApi->getInventory: $e\n"); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Map** + +### 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** +> 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 +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var orderId = 789; // int | ID of pet that needs to be fetched + +try { + var result = api_instance.getOrderById(orderId); + print(result); +} catch (e) { + print("Exception when calling StoreApi->getOrderById: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **int**| ID of pet that needs to be fetched | [default to null] + +### 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** +> Order placeOrder(order) + +Place an order for a pet + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var order = new Order(); // Order | order placed for purchasing the pet + +try { + var result = api_instance.placeOrder(order); + print(result); +} catch (e) { + print("Exception when calling StoreApi->placeOrder: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**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/dart2/flutter_petstore/openapi/docs/Tag.md b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**name** | **String** | | [optional] [default to null] + +[[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/dart2/flutter_petstore/openapi/docs/User.md b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**username** | **String** | | [optional] [default to null] +**firstName** | **String** | | [optional] [default to null] +**lastName** | **String** | | [optional] [default to null] +**email** | **String** | | [optional] [default to null] +**password** | **String** | | [optional] [default to null] +**phone** | **String** | | [optional] [default to null] +**userStatus** | **int** | User Status | [optional] [default to null] + +[[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/dart2/flutter_petstore/openapi/docs/UserApi.md b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/UserApi.md new file mode 100644 index 00000000000..9abe3cc83e2 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/docs/UserApi.md @@ -0,0 +1,349 @@ +# openapi.api.UserApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = new User(); // User | Created user object + +try { + api_instance.createUser(user); +} catch (e) { + print("Exception when calling UserApi->createUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**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** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = [new List<User>()]; // List | List of user object + +try { + api_instance.createUsersWithArrayInput(user); +} catch (e) { + print("Exception when calling UserApi->createUsersWithArrayInput: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](List.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** +> createUsersWithListInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = [new List<User>()]; // List | List of user object + +try { + api_instance.createUsersWithListInput(user); +} catch (e) { + print("Exception when calling UserApi->createUsersWithListInput: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](List.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** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The name that needs to be deleted + +try { + api_instance.deleteUser(username); +} catch (e) { + print("Exception when calling UserApi->deleteUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | [default to null] + +### 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** +> User getUserByName(username) + +Get user by user name + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + +try { + var result = api_instance.getUserByName(username); + print(result); +} catch (e) { + print("Exception when calling UserApi->getUserByName: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] + +### 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** +> String loginUser(username, password) + +Logs user into the system + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The user name for login +var password = password_example; // String | The password for login in clear text + +try { + var result = api_instance.loginUser(username, password); + print(result); +} catch (e) { + print("Exception when calling UserApi->loginUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | [default to null] + **password** | **String**| The password for login in clear text | [default to null] + +### 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** +> logoutUser() + +Logs out current logged in user session + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); + +try { + api_instance.logoutUser(); +} catch (e) { + print("Exception when calling UserApi->logoutUser: $e\n"); +} +``` + +### 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** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | name that need to be deleted +var user = new User(); // User | Updated user object + +try { + api_instance.updateUser(username, user); +} catch (e) { + print("Exception when calling UserApi->updateUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | [default to null] + **user** | [**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/dart2/flutter_petstore/openapi/git_push.sh b/samples/client/petstore/dart2/flutter_petstore/openapi/git_push.sh new file mode 100644 index 00000000000..8442b80bb44 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +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://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api.dart new file mode 100644 index 00000000000..08fe92eb031 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api.dart @@ -0,0 +1,26 @@ +library openapi.api; + +import 'dart:async'; +import 'dart:convert'; +import 'package:http/http.dart'; + +part 'api_client.dart'; +part 'api_helper.dart'; +part 'api_exception.dart'; +part 'auth/authentication.dart'; +part 'auth/api_key_auth.dart'; +part 'auth/oauth.dart'; +part 'auth/http_basic_auth.dart'; + +part 'api/pet_api.dart'; +part 'api/store_api.dart'; +part 'api/user_api.dart'; + +part 'model/api_response.dart'; +part 'model/category.dart'; +part 'model/order.dart'; +part 'model/pet.dart'; +part 'model/tag.dart'; +part 'model/user.dart'; + +ApiClient defaultApiClient = ApiClient(); diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/pet_api.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/pet_api.dart new file mode 100644 index 00000000000..0c625c2b04a --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/pet_api.dart @@ -0,0 +1,385 @@ +part of openapi.api; + +class PetApi { + final ApiClient apiClient; + + PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + /// Add a new pet to the store + /// + /// + Future addPet(Pet pet) async { + Object postBody = pet; + + // verify required params are set + if (pet == null) { + throw new ApiException(400, "Missing required param: pet"); + } + + // create path and map variables + String path = "/pet".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["application/json", "application/xml"]; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Deletes a pet + /// + /// + Future deletePet(int petId, {String apiKey}) async { + Object postBody; + + // verify required params are set + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); + } + + // create path and map variables + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + headerParams["api_key"] = apiKey; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + Future> findPetsByStatus(List status) async { + Object postBody; + + // verify required params are set + if (status == null) { + throw new ApiException(400, "Missing required param: status"); + } + + // create path and map variables + String path = "/pet/findByStatus".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + queryParams + .addAll(_convertParametersForCollectionFormat("csv", "status", status)); + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return (apiClient.deserialize(response.body, 'List') as List) + .map((item) => item as Pet) + .toList(); + } else { + return null; + } + } + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + Future> findPetsByTags(List tags) async { + Object postBody; + + // verify required params are set + if (tags == null) { + throw new ApiException(400, "Missing required param: tags"); + } + + // create path and map variables + String path = "/pet/findByTags".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + queryParams + .addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return (apiClient.deserialize(response.body, 'List') as List) + .map((item) => item as Pet) + .toList(); + } else { + return null; + } + } + + /// Find pet by ID + /// + /// Returns a single pet + Future getPetById(int petId) async { + Object postBody; + + // verify required params are set + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); + } + + // create path and map variables + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["api_key"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'Pet') as Pet; + } else { + return null; + } + } + + /// Update an existing pet + /// + /// + Future updatePet(Pet pet) async { + Object postBody = pet; + + // verify required params are set + if (pet == null) { + throw new ApiException(400, "Missing required param: pet"); + } + + // create path and map variables + String path = "/pet".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["application/json", "application/xml"]; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Updates a pet in the store with form data + /// + /// + Future updatePetWithForm(int petId, {String name, String status}) async { + Object postBody; + + // verify required params are set + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); + } + + // create path and map variables + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["application/x-www-form-urlencoded"]; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (name != null) { + hasFields = true; + mp.fields['name'] = parameterToString(name); + } + if (status != null) { + hasFields = true; + mp.fields['status'] = parameterToString(status); + } + if (hasFields) postBody = mp; + } else { + if (name != null) formParams['name'] = parameterToString(name); + if (status != null) formParams['status'] = parameterToString(status); + } + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// uploads an image + /// + /// + Future uploadFile(int petId, + {String additionalMetadata, MultipartFile file}) async { + Object postBody; + + // verify required params are set + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); + } + + // create path and map variables + String path = "/pet/{petId}/uploadImage" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["multipart/form-data"]; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (additionalMetadata != null) { + hasFields = true; + mp.fields['additionalMetadata'] = parameterToString(additionalMetadata); + } + if (file != null) { + hasFields = true; + mp.fields['file'] = file.field; + mp.files.add(file); + } + if (hasFields) postBody = mp; + } else { + if (additionalMetadata != null) + formParams['additionalMetadata'] = + parameterToString(additionalMetadata); + } + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'ApiResponse') as ApiResponse; + } else { + return null; + } + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/store_api.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/store_api.dart new file mode 100644 index 00000000000..5f88bf5ac99 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/store_api.dart @@ -0,0 +1,180 @@ +part of openapi.api; + +class StoreApi { + final ApiClient apiClient; + + StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + Future deleteOrder(String orderId) async { + Object postBody; + + // verify required params are set + if (orderId == null) { + throw new ApiException(400, "Missing required param: orderId"); + } + + // create path and map variables + String path = "/store/order/{orderId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "orderId" + "}", orderId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + Future> getInventory() async { + Object postBody; + + // verify required params are set + + // create path and map variables + String path = "/store/inventory".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["api_key"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return new Map.from( + apiClient.deserialize(response.body, 'Map')); + ; + } else { + return null; + } + } + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + Future getOrderById(int orderId) async { + Object postBody; + + // verify required params are set + if (orderId == null) { + throw new ApiException(400, "Missing required param: orderId"); + } + + // create path and map variables + String path = "/store/order/{orderId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "orderId" + "}", orderId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'Order') as Order; + } else { + return null; + } + } + + /// Place an order for a pet + /// + /// + Future placeOrder(Order order) async { + Object postBody = order; + + // verify required params are set + if (order == null) { + throw new ApiException(400, "Missing required param: order"); + } + + // create path and map variables + String path = "/store/order".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'Order') as Order; + } else { + return null; + } + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/user_api.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/user_api.dart new file mode 100644 index 00000000000..94b245a5609 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api/user_api.dart @@ -0,0 +1,352 @@ +part of openapi.api; + +class UserApi { + final ApiClient apiClient; + + UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + /// Create user + /// + /// This can only be done by the logged in user. + Future createUser(User user) async { + Object postBody = user; + + // verify required params are set + if (user == null) { + throw new ApiException(400, "Missing required param: user"); + } + + // create path and map variables + String path = "/user".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Creates list of users with given input array + /// + /// + Future createUsersWithArrayInput(List user) async { + Object postBody = user; + + // verify required params are set + if (user == null) { + throw new ApiException(400, "Missing required param: user"); + } + + // create path and map variables + String path = "/user/createWithArray".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Creates list of users with given input array + /// + /// + Future createUsersWithListInput(List user) async { + Object postBody = user; + + // verify required params are set + if (user == null) { + throw new ApiException(400, "Missing required param: user"); + } + + // create path and map variables + String path = "/user/createWithList".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Delete user + /// + /// This can only be done by the logged in user. + Future deleteUser(String username) async { + Object postBody; + + // verify required params are set + if (username == null) { + throw new ApiException(400, "Missing required param: username"); + } + + // create path and map variables + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Get user by user name + /// + /// + Future getUserByName(String username) async { + Object postBody; + + // verify required params are set + if (username == null) { + throw new ApiException(400, "Missing required param: username"); + } + + // create path and map variables + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'User') as User; + } else { + return null; + } + } + + /// Logs user into the system + /// + /// + Future loginUser(String username, String password) async { + Object postBody; + + // verify required params are set + if (username == null) { + throw new ApiException(400, "Missing required param: username"); + } + if (password == null) { + throw new ApiException(400, "Missing required param: password"); + } + + // create path and map variables + String path = "/user/login".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + queryParams.addAll( + _convertParametersForCollectionFormat("", "username", username)); + queryParams.addAll( + _convertParametersForCollectionFormat("", "password", password)); + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'String') as String; + } else { + return null; + } + } + + /// Logs out current logged in user session + /// + /// + Future logoutUser() async { + Object postBody; + + // verify required params are set + + // create path and map variables + String path = "/user/logout".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Updated user + /// + /// This can only be done by the logged in user. + Future updateUser(String username, User user) async { + Object postBody = user; + + // verify required params are set + if (username == null) { + throw new ApiException(400, "Missing required param: username"); + } + if (user == null) { + throw new ApiException(400, "Missing required param: user"); + } + + // create path and map variables + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api_client.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api_client.dart new file mode 100644 index 00000000000..d0db1fd65ec --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api_client.dart @@ -0,0 +1,165 @@ +part of openapi.api; + +class QueryParam { + String name; + String value; + + QueryParam(this.name, this.value); +} + +class ApiClient { + String basePath; + var client = Client(); + + Map _defaultHeaderMap = {}; + Map _authentications = {}; + + final _regList = RegExp(r'^List<(.*)>$'); + final _regMap = RegExp(r'^Map$'); + + ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) { + // Setup authentications (key: authentication name, value: authentication). + _authentications['api_key'] = ApiKeyAuth("header", "api_key"); + _authentications['petstore_auth'] = OAuth(); + } + + void addDefaultHeader(String key, String value) { + _defaultHeaderMap[key] = value; + } + + dynamic _deserialize(dynamic value, String targetType) { + try { + switch (targetType) { + case 'String': + return '$value'; + case 'int': + return value is int ? value : int.parse('$value'); + case 'bool': + return value is bool ? value : '$value'.toLowerCase() == 'true'; + case 'double': + return value is double ? value : double.parse('$value'); + case 'ApiResponse': + return ApiResponse.fromJson(value); + case 'Category': + return Category.fromJson(value); + case 'Order': + return Order.fromJson(value); + case 'Pet': + return Pet.fromJson(value); + case 'Tag': + return Tag.fromJson(value); + case 'User': + return User.fromJson(value); + default: + { + Match match; + if (value is List && + (match = _regList.firstMatch(targetType)) != null) { + var newTargetType = match[1]; + return value.map((v) => _deserialize(v, newTargetType)).toList(); + } else if (value is Map && + (match = _regMap.firstMatch(targetType)) != null) { + var newTargetType = match[1]; + return Map.fromIterables(value.keys, + value.values.map((v) => _deserialize(v, newTargetType))); + } + } + } + } on Exception catch (e, stack) { + throw ApiException.withInner( + 500, 'Exception during deserialization.', e, stack); + } + throw ApiException( + 500, 'Could not find a suitable class for deserialization'); + } + + dynamic deserialize(String json, String targetType) { + // Remove all spaces. Necessary for reg expressions as well. + targetType = targetType.replaceAll(' ', ''); + + if (targetType == 'String') return json; + + var decodedJson = jsonDecode(json); + return _deserialize(decodedJson, targetType); + } + + String serialize(Object obj) { + String serialized = ''; + if (obj == null) { + serialized = ''; + } else { + serialized = json.encode(obj); + } + return serialized; + } + + // We don't use a Map for queryParams. + // If collectionFormat is 'multi' a key might appear multiple times. + Future invokeAPI( + String path, + String method, + Iterable queryParams, + Object body, + Map headerParams, + Map formParams, + String contentType, + List authNames) async { + _updateParamsForAuth(authNames, queryParams, headerParams); + + var ps = queryParams + .where((p) => p.value != null) + .map((p) => '${p.name}=${p.value}'); + String queryString = ps.isNotEmpty ? '?' + ps.join('&') : ''; + + String url = basePath + path + queryString; + + headerParams.addAll(_defaultHeaderMap); + headerParams['Content-Type'] = contentType; + + if (body is MultipartRequest) { + var request = MultipartRequest(method, Uri.parse(url)); + request.fields.addAll(body.fields); + request.files.addAll(body.files); + request.headers.addAll(body.headers); + request.headers.addAll(headerParams); + var response = await client.send(request); + return Response.fromStream(response); + } else { + var msgBody = contentType == "application/x-www-form-urlencoded" + ? formParams + : serialize(body); + switch (method) { + case "POST": + return client.post(url, headers: headerParams, body: msgBody); + case "PUT": + return client.put(url, headers: headerParams, body: msgBody); + case "DELETE": + return client.delete(url, headers: headerParams); + case "PATCH": + return client.patch(url, headers: headerParams, body: msgBody); + default: + return client.get(url, headers: headerParams); + } + } + } + + /// Update query and header parameters based on authentication settings. + /// @param authNames The authentications to apply + void _updateParamsForAuth(List authNames, + List queryParams, Map headerParams) { + authNames.forEach((authName) { + Authentication auth = _authentications[authName]; + if (auth == null) + throw ArgumentError("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams); + }); + } + + void setAccessToken(String accessToken) { + _authentications.forEach((key, auth) { + if (auth is OAuth) { + auth.setAccessToken(accessToken); + } + }); + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api_exception.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api_exception.dart new file mode 100644 index 00000000000..a702da723eb --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api_exception.dart @@ -0,0 +1,24 @@ +part of openapi.api; + +class ApiException implements Exception { + int code = 0; + String message; + Exception innerException; + StackTrace stackTrace; + + ApiException(this.code, this.message); + + ApiException.withInner( + this.code, this.message, this.innerException, this.stackTrace); + + String toString() { + if (message == null) return "ApiException"; + + if (innerException == null) { + return "ApiException $code: $message"; + } + + return "ApiException $code: $message (Inner exception: $innerException)\n\n" + + stackTrace.toString(); + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api_helper.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api_helper.dart new file mode 100644 index 00000000000..9f7ccc8df90 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/api_helper.dart @@ -0,0 +1,45 @@ +part of openapi.api; + +const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; + +// port from Java version +Iterable _convertParametersForCollectionFormat( + String collectionFormat, String name, dynamic value) { + var params = []; + + // preconditions + if (name == null || name.isEmpty || value == null) return params; + + if (value is! List) { + params.add(QueryParam(name, parameterToString(value))); + return params; + } + + List values = value as List; + + // get the collection format + collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) + ? "csv" + : collectionFormat; // default: csv + + if (collectionFormat == "multi") { + return values.map((v) => QueryParam(name, parameterToString(v))); + } + + String delimiter = _delimiters[collectionFormat] ?? ","; + + params.add(QueryParam( + name, values.map((v) => parameterToString(v)).join(delimiter))); + return params; +} + +/// Format the given parameter object into string. +String parameterToString(dynamic value) { + if (value == null) { + return ''; + } else if (value is DateTime) { + return value.toUtc().toIso8601String(); + } else { + return value.toString(); + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/auth/api_key_auth.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/auth/api_key_auth.dart new file mode 100644 index 00000000000..b5a7a8248c0 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/auth/api_key_auth.dart @@ -0,0 +1,27 @@ +part of openapi.api; + +class ApiKeyAuth implements Authentication { + final String location; + final String paramName; + String apiKey; + String apiKeyPrefix; + + ApiKeyAuth(this.location, this.paramName); + + @override + void applyToParams( + List queryParams, Map headerParams) { + String value; + if (apiKeyPrefix != null) { + value = '$apiKeyPrefix $apiKey'; + } else { + value = apiKey; + } + + if (location == 'query' && value != null) { + queryParams.add(QueryParam(paramName, value)); + } else if (location == 'header' && value != null) { + headerParams[paramName] = value; + } + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/auth/authentication.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/auth/authentication.dart new file mode 100644 index 00000000000..2c4d5f301fa --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/auth/authentication.dart @@ -0,0 +1,7 @@ +part of openapi.api; + +abstract class Authentication { + /// Apply authentication settings to header and query params. + void applyToParams( + List queryParams, Map headerParams); +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/auth/http_basic_auth.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/auth/http_basic_auth.dart new file mode 100644 index 00000000000..e141c062ae0 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/auth/http_basic_auth.dart @@ -0,0 +1,15 @@ +part of openapi.api; + +class HttpBasicAuth implements Authentication { + String username; + String password; + + @override + void applyToParams( + List queryParams, Map headerParams) { + String str = (username == null ? "" : username) + + ":" + + (password == null ? "" : password); + headerParams["Authorization"] = "Basic " + base64.encode(utf8.encode(str)); + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/auth/oauth.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/auth/oauth.dart new file mode 100644 index 00000000000..73e2ae07ea3 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/auth/oauth.dart @@ -0,0 +1,19 @@ +part of openapi.api; + +class OAuth implements Authentication { + String accessToken; + + OAuth({this.accessToken}); + + @override + void applyToParams( + List queryParams, Map headerParams) { + if (accessToken != null) { + headerParams["Authorization"] = "Bearer " + accessToken; + } + } + + void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/api_response.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/api_response.dart new file mode 100644 index 00000000000..7265f7138d0 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/api_response.dart @@ -0,0 +1,41 @@ +part of openapi.api; + +class ApiResponse { + int code = null; + + String type = null; + + String message = null; + ApiResponse(); + + @override + String toString() { + return 'ApiResponse[code=$code, type=$type, message=$message, ]'; + } + + ApiResponse.fromJson(Map json) { + if (json == null) return; + code = json['code']; + type = json['type']; + message = json['message']; + } + + Map toJson() { + return {'code': code, 'type': type, 'message': message}; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new ApiResponse.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach((String key, dynamic value) => + map[key] = new ApiResponse.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/category.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/category.dart new file mode 100644 index 00000000000..ac6c55b2e37 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/category.dart @@ -0,0 +1,38 @@ +part of openapi.api; + +class Category { + int id = null; + + String name = null; + Category(); + + @override + String toString() { + return 'Category[id=$id, name=$name, ]'; + } + + Category.fromJson(Map json) { + if (json == null) return; + id = json['id']; + name = json['name']; + } + + Map toJson() { + return {'id': id, 'name': name}; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new Category.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach((String key, dynamic value) => + map[key] = new Category.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/order.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/order.dart new file mode 100644 index 00000000000..d4aa944967f --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/order.dart @@ -0,0 +1,59 @@ +part of openapi.api; + +class Order { + int id = null; + + int petId = null; + + int quantity = null; + + DateTime shipDate = null; + /* Order Status */ + String status = null; + //enum statusEnum { placed, approved, delivered, };{ + + bool complete = false; + Order(); + + @override + String toString() { + return 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete, ]'; + } + + Order.fromJson(Map json) { + if (json == null) return; + id = json['id']; + petId = json['petId']; + quantity = json['quantity']; + shipDate = + json['shipDate'] == null ? null : DateTime.parse(json['shipDate']); + status = json['status']; + complete = json['complete']; + } + + Map toJson() { + return { + 'id': id, + 'petId': petId, + 'quantity': quantity, + 'shipDate': shipDate == null ? '' : shipDate.toUtc().toIso8601String(), + 'status': status, + 'complete': complete + }; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new Order.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach( + (String key, dynamic value) => map[key] = new Order.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/pet.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/pet.dart new file mode 100644 index 00000000000..e9af61831d9 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/pet.dart @@ -0,0 +1,60 @@ +part of openapi.api; + +class Pet { + int id = null; + + Category category = null; + + String name = null; + + List photoUrls = []; + + List tags = []; + /* pet status in the store */ + String status = null; + //enum statusEnum { available, pending, sold, };{ + Pet(); + + @override + String toString() { + return 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status, ]'; + } + + Pet.fromJson(Map json) { + if (json == null) return; + id = json['id']; + category = new Category.fromJson(json['category']); + name = json['name']; + photoUrls = ((json['photoUrls'] ?? []) as List) + .map((item) => item as String) + .toList(); + tags = Tag.listFromJson(json['tags']); + status = json['status']; + } + + Map toJson() { + return { + 'id': id, + 'category': category, + 'name': name, + 'photoUrls': photoUrls, + 'tags': tags, + 'status': status + }; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new Pet.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach( + (String key, dynamic value) => map[key] = new Pet.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/tag.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/tag.dart new file mode 100644 index 00000000000..4a93785d104 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/tag.dart @@ -0,0 +1,38 @@ +part of openapi.api; + +class Tag { + int id = null; + + String name = null; + Tag(); + + @override + String toString() { + return 'Tag[id=$id, name=$name, ]'; + } + + Tag.fromJson(Map json) { + if (json == null) return; + id = json['id']; + name = json['name']; + } + + Map toJson() { + return {'id': id, 'name': name}; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new Tag.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach( + (String key, dynamic value) => map[key] = new Tag.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/user.dart b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/user.dart new file mode 100644 index 00000000000..55f62cc9198 --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/lib/model/user.dart @@ -0,0 +1,65 @@ +part of openapi.api; + +class User { + int id = null; + + String username = null; + + String firstName = null; + + String lastName = null; + + String email = null; + + String password = null; + + String phone = null; + /* User Status */ + int userStatus = null; + User(); + + @override + String toString() { + return 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus, ]'; + } + + User.fromJson(Map json) { + if (json == null) return; + id = json['id']; + username = json['username']; + firstName = json['firstName']; + lastName = json['lastName']; + email = json['email']; + password = json['password']; + phone = json['phone']; + userStatus = json['userStatus']; + } + + Map toJson() { + return { + 'id': id, + 'username': username, + 'firstName': firstName, + 'lastName': lastName, + 'email': email, + 'password': password, + 'phone': phone, + 'userStatus': userStatus + }; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new User.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach( + (String key, dynamic value) => map[key] = new User.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/flutter_petstore/openapi/pubspec.yaml b/samples/client/petstore/dart2/flutter_petstore/openapi/pubspec.yaml new file mode 100644 index 00000000000..9ccf0e524ad --- /dev/null +++ b/samples/client/petstore/dart2/flutter_petstore/openapi/pubspec.yaml @@ -0,0 +1,7 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +environment: + sdk: '>=2.0.0 <3.0.0' +dependencies: + http: '>=0.11.1 <0.12.0' diff --git a/samples/client/petstore/dart2/openapi-browser-client/.analysis_options b/samples/client/petstore/dart2/openapi-browser-client/.analysis_options new file mode 100644 index 00000000000..518eb901a6f --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true \ No newline at end of file diff --git a/samples/client/petstore/dart2/openapi-browser-client/.gitignore b/samples/client/petstore/dart2/openapi-browser-client/.gitignore new file mode 100644 index 00000000000..7c280441649 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/.gitignore @@ -0,0 +1,27 @@ +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock diff --git a/samples/client/petstore/dart2/openapi-browser-client/.openapi-generator-ignore b/samples/client/petstore/dart2/openapi-browser-client/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-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/dart2/openapi-browser-client/.openapi-generator/VERSION b/samples/client/petstore/dart2/openapi-browser-client/.openapi-generator/VERSION new file mode 100644 index 00000000000..f4cb97d56ce --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart2/openapi-browser-client/README.md b/samples/client/petstore/dart2/openapi-browser-client/README.md new file mode 100644 index 00000000000..5f3fe054784 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/README.md @@ -0,0 +1,121 @@ +# openapi +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Build package: org.openapitools.codegen.languages.DartClientCodegen + +## Requirements + +Dart 1.20.0 or later OR Flutter 0.0.20 or later + +## Installation & Usage + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +``` +name: openapi +version: 1.0.0 +description: OpenAPI API client +dependencies: + openapi: + git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + version: 'any' +``` + +### Local +To use the package in your local drive, please include the following in pubspec.yaml +``` +dependencies: + openapi: + path: /path/to/openapi +``` + +## Tests + +TODO + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/api.dart'; + +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print("Exception when calling PetApi->addPet: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*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 +*StoreApi* | [**deleteOrder**](docs//StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | 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/{orderId} | 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 + + - [ApiResponse](docs//ApiResponse.md) + - [Category](docs//Category.md) + - [Order](docs//Order.md) + - [Pet](docs//Pet.md) + - [Tag](docs//Tag.md) + - [User](docs//User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## 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/dart2/openapi-browser-client/docs/ApiResponse.md b/samples/client/petstore/dart2/openapi-browser-client/docs/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/docs/ApiResponse.md @@ -0,0 +1,17 @@ +# openapi.model.ApiResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] [default to null] +**type** | **String** | | [optional] [default to null] +**message** | **String** | | [optional] [default to null] + +[[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/dart2/openapi-browser-client/docs/Category.md b/samples/client/petstore/dart2/openapi-browser-client/docs/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/docs/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**name** | **String** | | [optional] [default to null] + +[[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/dart2/openapi-browser-client/docs/Order.md b/samples/client/petstore/dart2/openapi-browser-client/docs/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/docs/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**petId** | **int** | | [optional] [default to null] +**quantity** | **int** | | [optional] [default to null] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] +**status** | **String** | Order Status | [optional] [default to null] +**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/dart2/openapi-browser-client/docs/Pet.md b/samples/client/petstore/dart2/openapi-browser-client/docs/Pet.md new file mode 100644 index 00000000000..191e1fc66a9 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/docs/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**category** | [**Category**](Category.md) | | [optional] [default to null] +**name** | **String** | | [default to null] +**photoUrls** | **List<String>** | | [default to []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] +**status** | **String** | pet status in the store | [optional] [default to null] + +[[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/dart2/openapi-browser-client/docs/PetApi.md b/samples/client/petstore/dart2/openapi-browser-client/docs/PetApi.md new file mode 100644 index 00000000000..cb39b3f22d3 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/docs/PetApi.md @@ -0,0 +1,379 @@ +# openapi.api.PetApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> addPet(pet) + +Add a new pet to the store + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print("Exception when calling PetApi->addPet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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** +> deletePet(petId, apiKey) + +Deletes a pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | Pet id to delete +var apiKey = apiKey_example; // String | + +try { + api_instance.deletePet(petId, apiKey); +} catch (e) { + print("Exception when calling PetApi->deletePet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| Pet id to delete | [default to null] + **apiKey** | **String**| | [optional] [default to null] + +### 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** +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var status = []; // List | Status values that need to be considered for filter + +try { + var result = api_instance.findPetsByStatus(status); + print(result); +} catch (e) { + print("Exception when calling PetApi->findPetsByStatus: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] + +### Return type + +[**List**](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** +> List findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var tags = []; // List | Tags to filter by + +try { + var result = api_instance.findPetsByTags(tags); + print(result); +} catch (e) { + print("Exception when calling PetApi->findPetsByTags: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] + +### Return type + +[**List**](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** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to return + +try { + var result = api_instance.getPetById(petId); + print(result); +} catch (e) { + print("Exception when calling PetApi->getPetById: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to return | [default to null] + +### 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** +> updatePet(pet) + +Update an existing pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.updatePet(pet); +} catch (e) { + print("Exception when calling PetApi->updatePet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet that needs to be updated +var name = name_example; // String | Updated name of the pet +var status = status_example; // String | Updated status of the pet + +try { + api_instance.updatePetWithForm(petId, name, status); +} catch (e) { + print("Exception when calling PetApi->updatePetWithForm: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet that needs to be updated | [default to null] + **name** | **String**| Updated name of the pet | [optional] [default to null] + **status** | **String**| Updated status of the pet | [optional] [default to null] + +### 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** +> ApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to update +var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +var file = BINARY_DATA_HERE; // MultipartFile | file to upload + +try { + var result = api_instance.uploadFile(petId, additionalMetadata, file); + print(result); +} catch (e) { + print("Exception when calling PetApi->uploadFile: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **file** | **MultipartFile**| file to upload | [optional] [default to null] + +### 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/dart2/openapi-browser-client/docs/StoreApi.md b/samples/client/petstore/dart2/openapi-browser-client/docs/StoreApi.md new file mode 100644 index 00000000000..0cbbd758efd --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/docs/StoreApi.md @@ -0,0 +1,186 @@ +# openapi.api.StoreApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> 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 +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var orderId = orderId_example; // String | ID of the order that needs to be deleted + +try { + api_instance.deleteOrder(orderId); +} catch (e) { + print("Exception when calling StoreApi->deleteOrder: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | [default to null] + +### 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** +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; + +var api_instance = new StoreApi(); + +try { + var result = api_instance.getInventory(); + print(result); +} catch (e) { + print("Exception when calling StoreApi->getInventory: $e\n"); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Map** + +### 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** +> 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 +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var orderId = 789; // int | ID of pet that needs to be fetched + +try { + var result = api_instance.getOrderById(orderId); + print(result); +} catch (e) { + print("Exception when calling StoreApi->getOrderById: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **int**| ID of pet that needs to be fetched | [default to null] + +### 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** +> Order placeOrder(order) + +Place an order for a pet + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var order = new Order(); // Order | order placed for purchasing the pet + +try { + var result = api_instance.placeOrder(order); + print(result); +} catch (e) { + print("Exception when calling StoreApi->placeOrder: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**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/dart2/openapi-browser-client/docs/Tag.md b/samples/client/petstore/dart2/openapi-browser-client/docs/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/docs/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**name** | **String** | | [optional] [default to null] + +[[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/dart2/openapi-browser-client/docs/User.md b/samples/client/petstore/dart2/openapi-browser-client/docs/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/docs/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**username** | **String** | | [optional] [default to null] +**firstName** | **String** | | [optional] [default to null] +**lastName** | **String** | | [optional] [default to null] +**email** | **String** | | [optional] [default to null] +**password** | **String** | | [optional] [default to null] +**phone** | **String** | | [optional] [default to null] +**userStatus** | **int** | User Status | [optional] [default to null] + +[[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/dart2/openapi-browser-client/docs/UserApi.md b/samples/client/petstore/dart2/openapi-browser-client/docs/UserApi.md new file mode 100644 index 00000000000..9abe3cc83e2 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/docs/UserApi.md @@ -0,0 +1,349 @@ +# openapi.api.UserApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = new User(); // User | Created user object + +try { + api_instance.createUser(user); +} catch (e) { + print("Exception when calling UserApi->createUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**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** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = [new List<User>()]; // List | List of user object + +try { + api_instance.createUsersWithArrayInput(user); +} catch (e) { + print("Exception when calling UserApi->createUsersWithArrayInput: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](List.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** +> createUsersWithListInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = [new List<User>()]; // List | List of user object + +try { + api_instance.createUsersWithListInput(user); +} catch (e) { + print("Exception when calling UserApi->createUsersWithListInput: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](List.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** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The name that needs to be deleted + +try { + api_instance.deleteUser(username); +} catch (e) { + print("Exception when calling UserApi->deleteUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | [default to null] + +### 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** +> User getUserByName(username) + +Get user by user name + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + +try { + var result = api_instance.getUserByName(username); + print(result); +} catch (e) { + print("Exception when calling UserApi->getUserByName: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] + +### 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** +> String loginUser(username, password) + +Logs user into the system + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The user name for login +var password = password_example; // String | The password for login in clear text + +try { + var result = api_instance.loginUser(username, password); + print(result); +} catch (e) { + print("Exception when calling UserApi->loginUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | [default to null] + **password** | **String**| The password for login in clear text | [default to null] + +### 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** +> logoutUser() + +Logs out current logged in user session + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); + +try { + api_instance.logoutUser(); +} catch (e) { + print("Exception when calling UserApi->logoutUser: $e\n"); +} +``` + +### 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** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | name that need to be deleted +var user = new User(); // User | Updated user object + +try { + api_instance.updateUser(username, user); +} catch (e) { + print("Exception when calling UserApi->updateUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | [default to null] + **user** | [**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/dart2/openapi-browser-client/git_push.sh b/samples/client/petstore/dart2/openapi-browser-client/git_push.sh new file mode 100644 index 00000000000..8442b80bb44 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +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://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/api.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/api.dart new file mode 100644 index 00000000000..a8a3dd1fa25 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api.dart @@ -0,0 +1,27 @@ +library openapi.api; + +import 'dart:async'; +import 'dart:convert'; +import 'package:http/browser_client.dart'; +import 'package:http/http.dart'; + +part 'api_client.dart'; +part 'api_helper.dart'; +part 'api_exception.dart'; +part 'auth/authentication.dart'; +part 'auth/api_key_auth.dart'; +part 'auth/oauth.dart'; +part 'auth/http_basic_auth.dart'; + +part 'api/pet_api.dart'; +part 'api/store_api.dart'; +part 'api/user_api.dart'; + +part 'model/api_response.dart'; +part 'model/category.dart'; +part 'model/order.dart'; +part 'model/pet.dart'; +part 'model/tag.dart'; +part 'model/user.dart'; + +ApiClient defaultApiClient = ApiClient(); diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/api/pet_api.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/api/pet_api.dart new file mode 100644 index 00000000000..0c625c2b04a --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api/pet_api.dart @@ -0,0 +1,385 @@ +part of openapi.api; + +class PetApi { + final ApiClient apiClient; + + PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + /// Add a new pet to the store + /// + /// + Future addPet(Pet pet) async { + Object postBody = pet; + + // verify required params are set + if (pet == null) { + throw new ApiException(400, "Missing required param: pet"); + } + + // create path and map variables + String path = "/pet".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["application/json", "application/xml"]; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Deletes a pet + /// + /// + Future deletePet(int petId, {String apiKey}) async { + Object postBody; + + // verify required params are set + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); + } + + // create path and map variables + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + headerParams["api_key"] = apiKey; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + Future> findPetsByStatus(List status) async { + Object postBody; + + // verify required params are set + if (status == null) { + throw new ApiException(400, "Missing required param: status"); + } + + // create path and map variables + String path = "/pet/findByStatus".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + queryParams + .addAll(_convertParametersForCollectionFormat("csv", "status", status)); + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return (apiClient.deserialize(response.body, 'List') as List) + .map((item) => item as Pet) + .toList(); + } else { + return null; + } + } + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + Future> findPetsByTags(List tags) async { + Object postBody; + + // verify required params are set + if (tags == null) { + throw new ApiException(400, "Missing required param: tags"); + } + + // create path and map variables + String path = "/pet/findByTags".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + queryParams + .addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return (apiClient.deserialize(response.body, 'List') as List) + .map((item) => item as Pet) + .toList(); + } else { + return null; + } + } + + /// Find pet by ID + /// + /// Returns a single pet + Future getPetById(int petId) async { + Object postBody; + + // verify required params are set + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); + } + + // create path and map variables + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["api_key"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'Pet') as Pet; + } else { + return null; + } + } + + /// Update an existing pet + /// + /// + Future updatePet(Pet pet) async { + Object postBody = pet; + + // verify required params are set + if (pet == null) { + throw new ApiException(400, "Missing required param: pet"); + } + + // create path and map variables + String path = "/pet".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["application/json", "application/xml"]; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Updates a pet in the store with form data + /// + /// + Future updatePetWithForm(int petId, {String name, String status}) async { + Object postBody; + + // verify required params are set + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); + } + + // create path and map variables + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["application/x-www-form-urlencoded"]; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (name != null) { + hasFields = true; + mp.fields['name'] = parameterToString(name); + } + if (status != null) { + hasFields = true; + mp.fields['status'] = parameterToString(status); + } + if (hasFields) postBody = mp; + } else { + if (name != null) formParams['name'] = parameterToString(name); + if (status != null) formParams['status'] = parameterToString(status); + } + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// uploads an image + /// + /// + Future uploadFile(int petId, + {String additionalMetadata, MultipartFile file}) async { + Object postBody; + + // verify required params are set + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); + } + + // create path and map variables + String path = "/pet/{petId}/uploadImage" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["multipart/form-data"]; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (additionalMetadata != null) { + hasFields = true; + mp.fields['additionalMetadata'] = parameterToString(additionalMetadata); + } + if (file != null) { + hasFields = true; + mp.fields['file'] = file.field; + mp.files.add(file); + } + if (hasFields) postBody = mp; + } else { + if (additionalMetadata != null) + formParams['additionalMetadata'] = + parameterToString(additionalMetadata); + } + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'ApiResponse') as ApiResponse; + } else { + return null; + } + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/api/store_api.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/api/store_api.dart new file mode 100644 index 00000000000..5f88bf5ac99 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api/store_api.dart @@ -0,0 +1,180 @@ +part of openapi.api; + +class StoreApi { + final ApiClient apiClient; + + StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + Future deleteOrder(String orderId) async { + Object postBody; + + // verify required params are set + if (orderId == null) { + throw new ApiException(400, "Missing required param: orderId"); + } + + // create path and map variables + String path = "/store/order/{orderId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "orderId" + "}", orderId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + Future> getInventory() async { + Object postBody; + + // verify required params are set + + // create path and map variables + String path = "/store/inventory".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["api_key"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return new Map.from( + apiClient.deserialize(response.body, 'Map')); + ; + } else { + return null; + } + } + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + Future getOrderById(int orderId) async { + Object postBody; + + // verify required params are set + if (orderId == null) { + throw new ApiException(400, "Missing required param: orderId"); + } + + // create path and map variables + String path = "/store/order/{orderId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "orderId" + "}", orderId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'Order') as Order; + } else { + return null; + } + } + + /// Place an order for a pet + /// + /// + Future placeOrder(Order order) async { + Object postBody = order; + + // verify required params are set + if (order == null) { + throw new ApiException(400, "Missing required param: order"); + } + + // create path and map variables + String path = "/store/order".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'Order') as Order; + } else { + return null; + } + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/api/user_api.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/api/user_api.dart new file mode 100644 index 00000000000..94b245a5609 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api/user_api.dart @@ -0,0 +1,352 @@ +part of openapi.api; + +class UserApi { + final ApiClient apiClient; + + UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + /// Create user + /// + /// This can only be done by the logged in user. + Future createUser(User user) async { + Object postBody = user; + + // verify required params are set + if (user == null) { + throw new ApiException(400, "Missing required param: user"); + } + + // create path and map variables + String path = "/user".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Creates list of users with given input array + /// + /// + Future createUsersWithArrayInput(List user) async { + Object postBody = user; + + // verify required params are set + if (user == null) { + throw new ApiException(400, "Missing required param: user"); + } + + // create path and map variables + String path = "/user/createWithArray".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Creates list of users with given input array + /// + /// + Future createUsersWithListInput(List user) async { + Object postBody = user; + + // verify required params are set + if (user == null) { + throw new ApiException(400, "Missing required param: user"); + } + + // create path and map variables + String path = "/user/createWithList".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Delete user + /// + /// This can only be done by the logged in user. + Future deleteUser(String username) async { + Object postBody; + + // verify required params are set + if (username == null) { + throw new ApiException(400, "Missing required param: username"); + } + + // create path and map variables + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Get user by user name + /// + /// + Future getUserByName(String username) async { + Object postBody; + + // verify required params are set + if (username == null) { + throw new ApiException(400, "Missing required param: username"); + } + + // create path and map variables + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'User') as User; + } else { + return null; + } + } + + /// Logs user into the system + /// + /// + Future loginUser(String username, String password) async { + Object postBody; + + // verify required params are set + if (username == null) { + throw new ApiException(400, "Missing required param: username"); + } + if (password == null) { + throw new ApiException(400, "Missing required param: password"); + } + + // create path and map variables + String path = "/user/login".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + queryParams.addAll( + _convertParametersForCollectionFormat("", "username", username)); + queryParams.addAll( + _convertParametersForCollectionFormat("", "password", password)); + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'String') as String; + } else { + return null; + } + } + + /// Logs out current logged in user session + /// + /// + Future logoutUser() async { + Object postBody; + + // verify required params are set + + // create path and map variables + String path = "/user/logout".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Updated user + /// + /// This can only be done by the logged in user. + Future updateUser(String username, User user) async { + Object postBody = user; + + // verify required params are set + if (username == null) { + throw new ApiException(400, "Missing required param: username"); + } + if (user == null) { + throw new ApiException(400, "Missing required param: user"); + } + + // create path and map variables + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/api_client.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/api_client.dart new file mode 100644 index 00000000000..acf873a63b2 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api_client.dart @@ -0,0 +1,165 @@ +part of openapi.api; + +class QueryParam { + String name; + String value; + + QueryParam(this.name, this.value); +} + +class ApiClient { + String basePath; + var client = BrowserClient(); + + Map _defaultHeaderMap = {}; + Map _authentications = {}; + + final _regList = RegExp(r'^List<(.*)>$'); + final _regMap = RegExp(r'^Map$'); + + ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) { + // Setup authentications (key: authentication name, value: authentication). + _authentications['api_key'] = ApiKeyAuth("header", "api_key"); + _authentications['petstore_auth'] = OAuth(); + } + + void addDefaultHeader(String key, String value) { + _defaultHeaderMap[key] = value; + } + + dynamic _deserialize(dynamic value, String targetType) { + try { + switch (targetType) { + case 'String': + return '$value'; + case 'int': + return value is int ? value : int.parse('$value'); + case 'bool': + return value is bool ? value : '$value'.toLowerCase() == 'true'; + case 'double': + return value is double ? value : double.parse('$value'); + case 'ApiResponse': + return ApiResponse.fromJson(value); + case 'Category': + return Category.fromJson(value); + case 'Order': + return Order.fromJson(value); + case 'Pet': + return Pet.fromJson(value); + case 'Tag': + return Tag.fromJson(value); + case 'User': + return User.fromJson(value); + default: + { + Match match; + if (value is List && + (match = _regList.firstMatch(targetType)) != null) { + var newTargetType = match[1]; + return value.map((v) => _deserialize(v, newTargetType)).toList(); + } else if (value is Map && + (match = _regMap.firstMatch(targetType)) != null) { + var newTargetType = match[1]; + return Map.fromIterables(value.keys, + value.values.map((v) => _deserialize(v, newTargetType))); + } + } + } + } on Exception catch (e, stack) { + throw ApiException.withInner( + 500, 'Exception during deserialization.', e, stack); + } + throw ApiException( + 500, 'Could not find a suitable class for deserialization'); + } + + dynamic deserialize(String json, String targetType) { + // Remove all spaces. Necessary for reg expressions as well. + targetType = targetType.replaceAll(' ', ''); + + if (targetType == 'String') return json; + + var decodedJson = jsonDecode(json); + return _deserialize(decodedJson, targetType); + } + + String serialize(Object obj) { + String serialized = ''; + if (obj == null) { + serialized = ''; + } else { + serialized = json.encode(obj); + } + return serialized; + } + + // We don't use a Map for queryParams. + // If collectionFormat is 'multi' a key might appear multiple times. + Future invokeAPI( + String path, + String method, + Iterable queryParams, + Object body, + Map headerParams, + Map formParams, + String contentType, + List authNames) async { + _updateParamsForAuth(authNames, queryParams, headerParams); + + var ps = queryParams + .where((p) => p.value != null) + .map((p) => '${p.name}=${p.value}'); + String queryString = ps.isNotEmpty ? '?' + ps.join('&') : ''; + + String url = basePath + path + queryString; + + headerParams.addAll(_defaultHeaderMap); + headerParams['Content-Type'] = contentType; + + if (body is MultipartRequest) { + var request = MultipartRequest(method, Uri.parse(url)); + request.fields.addAll(body.fields); + request.files.addAll(body.files); + request.headers.addAll(body.headers); + request.headers.addAll(headerParams); + var response = await client.send(request); + return Response.fromStream(response); + } else { + var msgBody = contentType == "application/x-www-form-urlencoded" + ? formParams + : serialize(body); + switch (method) { + case "POST": + return client.post(url, headers: headerParams, body: msgBody); + case "PUT": + return client.put(url, headers: headerParams, body: msgBody); + case "DELETE": + return client.delete(url, headers: headerParams); + case "PATCH": + return client.patch(url, headers: headerParams, body: msgBody); + default: + return client.get(url, headers: headerParams); + } + } + } + + /// Update query and header parameters based on authentication settings. + /// @param authNames The authentications to apply + void _updateParamsForAuth(List authNames, + List queryParams, Map headerParams) { + authNames.forEach((authName) { + Authentication auth = _authentications[authName]; + if (auth == null) + throw ArgumentError("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams); + }); + } + + void setAccessToken(String accessToken) { + _authentications.forEach((key, auth) { + if (auth is OAuth) { + auth.setAccessToken(accessToken); + } + }); + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/api_exception.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/api_exception.dart new file mode 100644 index 00000000000..a702da723eb --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api_exception.dart @@ -0,0 +1,24 @@ +part of openapi.api; + +class ApiException implements Exception { + int code = 0; + String message; + Exception innerException; + StackTrace stackTrace; + + ApiException(this.code, this.message); + + ApiException.withInner( + this.code, this.message, this.innerException, this.stackTrace); + + String toString() { + if (message == null) return "ApiException"; + + if (innerException == null) { + return "ApiException $code: $message"; + } + + return "ApiException $code: $message (Inner exception: $innerException)\n\n" + + stackTrace.toString(); + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/api_helper.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/api_helper.dart new file mode 100644 index 00000000000..9f7ccc8df90 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/api_helper.dart @@ -0,0 +1,45 @@ +part of openapi.api; + +const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; + +// port from Java version +Iterable _convertParametersForCollectionFormat( + String collectionFormat, String name, dynamic value) { + var params = []; + + // preconditions + if (name == null || name.isEmpty || value == null) return params; + + if (value is! List) { + params.add(QueryParam(name, parameterToString(value))); + return params; + } + + List values = value as List; + + // get the collection format + collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) + ? "csv" + : collectionFormat; // default: csv + + if (collectionFormat == "multi") { + return values.map((v) => QueryParam(name, parameterToString(v))); + } + + String delimiter = _delimiters[collectionFormat] ?? ","; + + params.add(QueryParam( + name, values.map((v) => parameterToString(v)).join(delimiter))); + return params; +} + +/// Format the given parameter object into string. +String parameterToString(dynamic value) { + if (value == null) { + return ''; + } else if (value is DateTime) { + return value.toUtc().toIso8601String(); + } else { + return value.toString(); + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/auth/api_key_auth.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/auth/api_key_auth.dart new file mode 100644 index 00000000000..b5a7a8248c0 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/auth/api_key_auth.dart @@ -0,0 +1,27 @@ +part of openapi.api; + +class ApiKeyAuth implements Authentication { + final String location; + final String paramName; + String apiKey; + String apiKeyPrefix; + + ApiKeyAuth(this.location, this.paramName); + + @override + void applyToParams( + List queryParams, Map headerParams) { + String value; + if (apiKeyPrefix != null) { + value = '$apiKeyPrefix $apiKey'; + } else { + value = apiKey; + } + + if (location == 'query' && value != null) { + queryParams.add(QueryParam(paramName, value)); + } else if (location == 'header' && value != null) { + headerParams[paramName] = value; + } + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/auth/authentication.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/auth/authentication.dart new file mode 100644 index 00000000000..2c4d5f301fa --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/auth/authentication.dart @@ -0,0 +1,7 @@ +part of openapi.api; + +abstract class Authentication { + /// Apply authentication settings to header and query params. + void applyToParams( + List queryParams, Map headerParams); +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/auth/http_basic_auth.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/auth/http_basic_auth.dart new file mode 100644 index 00000000000..e141c062ae0 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/auth/http_basic_auth.dart @@ -0,0 +1,15 @@ +part of openapi.api; + +class HttpBasicAuth implements Authentication { + String username; + String password; + + @override + void applyToParams( + List queryParams, Map headerParams) { + String str = (username == null ? "" : username) + + ":" + + (password == null ? "" : password); + headerParams["Authorization"] = "Basic " + base64.encode(utf8.encode(str)); + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/auth/oauth.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/auth/oauth.dart new file mode 100644 index 00000000000..73e2ae07ea3 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/auth/oauth.dart @@ -0,0 +1,19 @@ +part of openapi.api; + +class OAuth implements Authentication { + String accessToken; + + OAuth({this.accessToken}); + + @override + void applyToParams( + List queryParams, Map headerParams) { + if (accessToken != null) { + headerParams["Authorization"] = "Bearer " + accessToken; + } + } + + void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/model/api_response.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/model/api_response.dart new file mode 100644 index 00000000000..7265f7138d0 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/api_response.dart @@ -0,0 +1,41 @@ +part of openapi.api; + +class ApiResponse { + int code = null; + + String type = null; + + String message = null; + ApiResponse(); + + @override + String toString() { + return 'ApiResponse[code=$code, type=$type, message=$message, ]'; + } + + ApiResponse.fromJson(Map json) { + if (json == null) return; + code = json['code']; + type = json['type']; + message = json['message']; + } + + Map toJson() { + return {'code': code, 'type': type, 'message': message}; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new ApiResponse.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach((String key, dynamic value) => + map[key] = new ApiResponse.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/model/category.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/model/category.dart new file mode 100644 index 00000000000..ac6c55b2e37 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/category.dart @@ -0,0 +1,38 @@ +part of openapi.api; + +class Category { + int id = null; + + String name = null; + Category(); + + @override + String toString() { + return 'Category[id=$id, name=$name, ]'; + } + + Category.fromJson(Map json) { + if (json == null) return; + id = json['id']; + name = json['name']; + } + + Map toJson() { + return {'id': id, 'name': name}; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new Category.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach((String key, dynamic value) => + map[key] = new Category.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/model/order.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/model/order.dart new file mode 100644 index 00000000000..d4aa944967f --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/order.dart @@ -0,0 +1,59 @@ +part of openapi.api; + +class Order { + int id = null; + + int petId = null; + + int quantity = null; + + DateTime shipDate = null; + /* Order Status */ + String status = null; + //enum statusEnum { placed, approved, delivered, };{ + + bool complete = false; + Order(); + + @override + String toString() { + return 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete, ]'; + } + + Order.fromJson(Map json) { + if (json == null) return; + id = json['id']; + petId = json['petId']; + quantity = json['quantity']; + shipDate = + json['shipDate'] == null ? null : DateTime.parse(json['shipDate']); + status = json['status']; + complete = json['complete']; + } + + Map toJson() { + return { + 'id': id, + 'petId': petId, + 'quantity': quantity, + 'shipDate': shipDate == null ? '' : shipDate.toUtc().toIso8601String(), + 'status': status, + 'complete': complete + }; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new Order.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach( + (String key, dynamic value) => map[key] = new Order.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/model/pet.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/model/pet.dart new file mode 100644 index 00000000000..e9af61831d9 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/pet.dart @@ -0,0 +1,60 @@ +part of openapi.api; + +class Pet { + int id = null; + + Category category = null; + + String name = null; + + List photoUrls = []; + + List tags = []; + /* pet status in the store */ + String status = null; + //enum statusEnum { available, pending, sold, };{ + Pet(); + + @override + String toString() { + return 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status, ]'; + } + + Pet.fromJson(Map json) { + if (json == null) return; + id = json['id']; + category = new Category.fromJson(json['category']); + name = json['name']; + photoUrls = ((json['photoUrls'] ?? []) as List) + .map((item) => item as String) + .toList(); + tags = Tag.listFromJson(json['tags']); + status = json['status']; + } + + Map toJson() { + return { + 'id': id, + 'category': category, + 'name': name, + 'photoUrls': photoUrls, + 'tags': tags, + 'status': status + }; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new Pet.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach( + (String key, dynamic value) => map[key] = new Pet.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/model/tag.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/model/tag.dart new file mode 100644 index 00000000000..4a93785d104 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/tag.dart @@ -0,0 +1,38 @@ +part of openapi.api; + +class Tag { + int id = null; + + String name = null; + Tag(); + + @override + String toString() { + return 'Tag[id=$id, name=$name, ]'; + } + + Tag.fromJson(Map json) { + if (json == null) return; + id = json['id']; + name = json['name']; + } + + Map toJson() { + return {'id': id, 'name': name}; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new Tag.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach( + (String key, dynamic value) => map[key] = new Tag.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/lib/model/user.dart b/samples/client/petstore/dart2/openapi-browser-client/lib/model/user.dart new file mode 100644 index 00000000000..55f62cc9198 --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/lib/model/user.dart @@ -0,0 +1,65 @@ +part of openapi.api; + +class User { + int id = null; + + String username = null; + + String firstName = null; + + String lastName = null; + + String email = null; + + String password = null; + + String phone = null; + /* User Status */ + int userStatus = null; + User(); + + @override + String toString() { + return 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus, ]'; + } + + User.fromJson(Map json) { + if (json == null) return; + id = json['id']; + username = json['username']; + firstName = json['firstName']; + lastName = json['lastName']; + email = json['email']; + password = json['password']; + phone = json['phone']; + userStatus = json['userStatus']; + } + + Map toJson() { + return { + 'id': id, + 'username': username, + 'firstName': firstName, + 'lastName': lastName, + 'email': email, + 'password': password, + 'phone': phone, + 'userStatus': userStatus + }; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new User.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach( + (String key, dynamic value) => map[key] = new User.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/openapi-browser-client/pubspec.yaml b/samples/client/petstore/dart2/openapi-browser-client/pubspec.yaml new file mode 100644 index 00000000000..9ccf0e524ad --- /dev/null +++ b/samples/client/petstore/dart2/openapi-browser-client/pubspec.yaml @@ -0,0 +1,7 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +environment: + sdk: '>=2.0.0 <3.0.0' +dependencies: + http: '>=0.11.1 <0.12.0' diff --git a/samples/client/petstore/dart2/openapi/.analysis_options b/samples/client/petstore/dart2/openapi/.analysis_options new file mode 100644 index 00000000000..518eb901a6f --- /dev/null +++ b/samples/client/petstore/dart2/openapi/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true \ No newline at end of file diff --git a/samples/client/petstore/dart2/openapi/.gitignore b/samples/client/petstore/dart2/openapi/.gitignore new file mode 100644 index 00000000000..7c280441649 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/.gitignore @@ -0,0 +1,27 @@ +# See https://www.dartlang.org/tools/private-files.html + +# Files and directories created by pub +.buildlog +.packages +.project +.pub/ +build/ +**/packages/ + +# Files created by dart2js +# (Most Dart developers will use pub build to compile Dart, use/modify these +# rules if you intend to use dart2js directly +# Convention is to use extension '.dart.js' for Dart compiled to Javascript to +# differentiate from explicit Javascript files) +*.dart.js +*.part.js +*.js.deps +*.js.map +*.info.json + +# Directory created by dartdoc +doc/api/ + +# Don't commit pubspec lock file +# (Library packages only! Remove pattern if developing an application package) +pubspec.lock diff --git a/samples/client/petstore/dart2/openapi/.openapi-generator-ignore b/samples/client/petstore/dart2/openapi/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/.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/dart2/openapi/.openapi-generator/VERSION b/samples/client/petstore/dart2/openapi/.openapi-generator/VERSION new file mode 100644 index 00000000000..f4cb97d56ce --- /dev/null +++ b/samples/client/petstore/dart2/openapi/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/dart2/openapi/README.md b/samples/client/petstore/dart2/openapi/README.md new file mode 100644 index 00000000000..5f3fe054784 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/README.md @@ -0,0 +1,121 @@ +# openapi +This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + +This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Build package: org.openapitools.codegen.languages.DartClientCodegen + +## Requirements + +Dart 1.20.0 or later OR Flutter 0.0.20 or later + +## Installation & Usage + +### Github +If this Dart package is published to Github, please include the following in pubspec.yaml +``` +name: openapi +version: 1.0.0 +description: OpenAPI API client +dependencies: + openapi: + git: https://github.com/GIT_USER_ID/GIT_REPO_ID.git + version: 'any' +``` + +### Local +To use the package in your local drive, please include the following in pubspec.yaml +``` +dependencies: + openapi: + path: /path/to/openapi +``` + +## Tests + +TODO + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```dart +import 'package:openapi/api.dart'; + +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print("Exception when calling PetApi->addPet: $e\n"); +} + +``` + +## Documentation for API Endpoints + +All URIs are relative to *http://petstore.swagger.io/v2* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*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 +*StoreApi* | [**deleteOrder**](docs//StoreApi.md#deleteorder) | **DELETE** /store/order/{orderId} | 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/{orderId} | 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 + + - [ApiResponse](docs//ApiResponse.md) + - [Category](docs//Category.md) + - [Order](docs//Order.md) + - [Pet](docs//Pet.md) + - [Tag](docs//Tag.md) + - [User](docs//User.md) + + +## Documentation For Authorization + + +## api_key + +- **Type**: API key +- **API key parameter name**: api_key +- **Location**: HTTP header + +## 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/dart2/openapi/docs/ApiResponse.md b/samples/client/petstore/dart2/openapi/docs/ApiResponse.md new file mode 100644 index 00000000000..92422f0f446 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/docs/ApiResponse.md @@ -0,0 +1,17 @@ +# openapi.model.ApiResponse + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | [optional] [default to null] +**type** | **String** | | [optional] [default to null] +**message** | **String** | | [optional] [default to null] + +[[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/dart2/openapi/docs/Category.md b/samples/client/petstore/dart2/openapi/docs/Category.md new file mode 100644 index 00000000000..cc0d1633b59 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/docs/Category.md @@ -0,0 +1,16 @@ +# openapi.model.Category + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**name** | **String** | | [optional] [default to null] + +[[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/dart2/openapi/docs/Order.md b/samples/client/petstore/dart2/openapi/docs/Order.md new file mode 100644 index 00000000000..310ce6c65be --- /dev/null +++ b/samples/client/petstore/dart2/openapi/docs/Order.md @@ -0,0 +1,20 @@ +# openapi.model.Order + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**petId** | **int** | | [optional] [default to null] +**quantity** | **int** | | [optional] [default to null] +**shipDate** | [**DateTime**](DateTime.md) | | [optional] [default to null] +**status** | **String** | Order Status | [optional] [default to null] +**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/dart2/openapi/docs/Pet.md b/samples/client/petstore/dart2/openapi/docs/Pet.md new file mode 100644 index 00000000000..191e1fc66a9 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/docs/Pet.md @@ -0,0 +1,20 @@ +# openapi.model.Pet + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**category** | [**Category**](Category.md) | | [optional] [default to null] +**name** | **String** | | [default to null] +**photoUrls** | **List<String>** | | [default to []] +**tags** | [**List<Tag>**](Tag.md) | | [optional] [default to []] +**status** | **String** | pet status in the store | [optional] [default to null] + +[[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/dart2/openapi/docs/PetApi.md b/samples/client/petstore/dart2/openapi/docs/PetApi.md new file mode 100644 index 00000000000..cb39b3f22d3 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/docs/PetApi.md @@ -0,0 +1,379 @@ +# openapi.api.PetApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> addPet(pet) + +Add a new pet to the store + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.addPet(pet); +} catch (e) { + print("Exception when calling PetApi->addPet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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** +> deletePet(petId, apiKey) + +Deletes a pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | Pet id to delete +var apiKey = apiKey_example; // String | + +try { + api_instance.deletePet(petId, apiKey); +} catch (e) { + print("Exception when calling PetApi->deletePet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| Pet id to delete | [default to null] + **apiKey** | **String**| | [optional] [default to null] + +### 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** +> List findPetsByStatus(status) + +Finds Pets by status + +Multiple status values can be provided with comma separated strings + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var status = []; // List | Status values that need to be considered for filter + +try { + var result = api_instance.findPetsByStatus(status); + print(result); +} catch (e) { + print("Exception when calling PetApi->findPetsByStatus: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to []] + +### Return type + +[**List**](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** +> List findPetsByTags(tags) + +Finds Pets by tags + +Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var tags = []; // List | Tags to filter by + +try { + var result = api_instance.findPetsByTags(tags); + print(result); +} catch (e) { + print("Exception when calling PetApi->findPetsByTags: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to []] + +### Return type + +[**List**](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** +> Pet getPetById(petId) + +Find pet by ID + +Returns a single pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to return + +try { + var result = api_instance.getPetById(petId); + print(result); +} catch (e) { + print("Exception when calling PetApi->getPetById: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to return | [default to null] + +### 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** +> updatePet(pet) + +Update an existing pet + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var pet = new Pet(); // Pet | Pet object that needs to be added to the store + +try { + api_instance.updatePet(pet); +} catch (e) { + print("Exception when calling PetApi->updatePet: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**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** +> updatePetWithForm(petId, name, status) + +Updates a pet in the store with form data + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet that needs to be updated +var name = name_example; // String | Updated name of the pet +var status = status_example; // String | Updated status of the pet + +try { + api_instance.updatePetWithForm(petId, name, status); +} catch (e) { + print("Exception when calling PetApi->updatePetWithForm: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet that needs to be updated | [default to null] + **name** | **String**| Updated name of the pet | [optional] [default to null] + **status** | **String**| Updated status of the pet | [optional] [default to null] + +### 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** +> ApiResponse uploadFile(petId, additionalMetadata, file) + +uploads an image + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure OAuth2 access token for authorization: petstore_auth +//openapi.api.Configuration.accessToken = 'YOUR_ACCESS_TOKEN'; + +var api_instance = new PetApi(); +var petId = 789; // int | ID of pet to update +var additionalMetadata = additionalMetadata_example; // String | Additional data to pass to server +var file = BINARY_DATA_HERE; // MultipartFile | file to upload + +try { + var result = api_instance.uploadFile(petId, additionalMetadata, file); + print(result); +} catch (e) { + print("Exception when calling PetApi->uploadFile: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **int**| ID of pet to update | [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **file** | **MultipartFile**| file to upload | [optional] [default to null] + +### 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/dart2/openapi/docs/StoreApi.md b/samples/client/petstore/dart2/openapi/docs/StoreApi.md new file mode 100644 index 00000000000..0cbbd758efd --- /dev/null +++ b/samples/client/petstore/dart2/openapi/docs/StoreApi.md @@ -0,0 +1,186 @@ +# openapi.api.StoreApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> 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 +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var orderId = orderId_example; // String | ID of the order that needs to be deleted + +try { + api_instance.deleteOrder(orderId); +} catch (e) { + print("Exception when calling StoreApi->deleteOrder: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | [default to null] + +### 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** +> Map getInventory() + +Returns pet inventories by status + +Returns a map of status codes to quantities + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: api_key +//openapi.api.Configuration.apiKey{'api_key'} = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//openapi.api.Configuration.apiKeyPrefix{'api_key'} = "Bearer"; + +var api_instance = new StoreApi(); + +try { + var result = api_instance.getInventory(); + print(result); +} catch (e) { + print("Exception when calling StoreApi->getInventory: $e\n"); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +**Map** + +### 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** +> 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 +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var orderId = 789; // int | ID of pet that needs to be fetched + +try { + var result = api_instance.getOrderById(orderId); + print(result); +} catch (e) { + print("Exception when calling StoreApi->getOrderById: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **int**| ID of pet that needs to be fetched | [default to null] + +### 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** +> Order placeOrder(order) + +Place an order for a pet + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new StoreApi(); +var order = new Order(); // Order | order placed for purchasing the pet + +try { + var result = api_instance.placeOrder(order); + print(result); +} catch (e) { + print("Exception when calling StoreApi->placeOrder: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**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/dart2/openapi/docs/Tag.md b/samples/client/petstore/dart2/openapi/docs/Tag.md new file mode 100644 index 00000000000..ded7b32ac3d --- /dev/null +++ b/samples/client/petstore/dart2/openapi/docs/Tag.md @@ -0,0 +1,16 @@ +# openapi.model.Tag + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**name** | **String** | | [optional] [default to null] + +[[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/dart2/openapi/docs/User.md b/samples/client/petstore/dart2/openapi/docs/User.md new file mode 100644 index 00000000000..3761b70cf0b --- /dev/null +++ b/samples/client/petstore/dart2/openapi/docs/User.md @@ -0,0 +1,22 @@ +# openapi.model.User + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | [optional] [default to null] +**username** | **String** | | [optional] [default to null] +**firstName** | **String** | | [optional] [default to null] +**lastName** | **String** | | [optional] [default to null] +**email** | **String** | | [optional] [default to null] +**password** | **String** | | [optional] [default to null] +**phone** | **String** | | [optional] [default to null] +**userStatus** | **int** | User Status | [optional] [default to null] + +[[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/dart2/openapi/docs/UserApi.md b/samples/client/petstore/dart2/openapi/docs/UserApi.md new file mode 100644 index 00000000000..9abe3cc83e2 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/docs/UserApi.md @@ -0,0 +1,349 @@ +# openapi.api.UserApi + +## Load the API package +```dart +import 'package:openapi/api.dart'; +``` + +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** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = new User(); // User | Created user object + +try { + api_instance.createUser(user); +} catch (e) { + print("Exception when calling UserApi->createUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**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** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = [new List<User>()]; // List | List of user object + +try { + api_instance.createUsersWithArrayInput(user); +} catch (e) { + print("Exception when calling UserApi->createUsersWithArrayInput: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](List.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** +> createUsersWithListInput(user) + +Creates list of users with given input array + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var user = [new List<User>()]; // List | List of user object + +try { + api_instance.createUsersWithListInput(user); +} catch (e) { + print("Exception when calling UserApi->createUsersWithListInput: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](List.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** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The name that needs to be deleted + +try { + api_instance.deleteUser(username); +} catch (e) { + print("Exception when calling UserApi->deleteUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | [default to null] + +### 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** +> User getUserByName(username) + +Get user by user name + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The name that needs to be fetched. Use user1 for testing. + +try { + var result = api_instance.getUserByName(username); + print(result); +} catch (e) { + print("Exception when calling UserApi->getUserByName: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be fetched. Use user1 for testing. | [default to null] + +### 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** +> String loginUser(username, password) + +Logs user into the system + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | The user name for login +var password = password_example; // String | The password for login in clear text + +try { + var result = api_instance.loginUser(username, password); + print(result); +} catch (e) { + print("Exception when calling UserApi->loginUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The user name for login | [default to null] + **password** | **String**| The password for login in clear text | [default to null] + +### 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** +> logoutUser() + +Logs out current logged in user session + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); + +try { + api_instance.logoutUser(); +} catch (e) { + print("Exception when calling UserApi->logoutUser: $e\n"); +} +``` + +### 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** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```dart +import 'package:openapi/api.dart'; + +var api_instance = new UserApi(); +var username = username_example; // String | name that need to be deleted +var user = new User(); // User | Updated user object + +try { + api_instance.updateUser(username, user); +} catch (e) { + print("Exception when calling UserApi->updateUser: $e\n"); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | [default to null] + **user** | [**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/dart2/openapi/git_push.sh b/samples/client/petstore/dart2/openapi/git_push.sh new file mode 100644 index 00000000000..8442b80bb44 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +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://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/dart2/openapi/lib/api.dart b/samples/client/petstore/dart2/openapi/lib/api.dart new file mode 100644 index 00000000000..08fe92eb031 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/api.dart @@ -0,0 +1,26 @@ +library openapi.api; + +import 'dart:async'; +import 'dart:convert'; +import 'package:http/http.dart'; + +part 'api_client.dart'; +part 'api_helper.dart'; +part 'api_exception.dart'; +part 'auth/authentication.dart'; +part 'auth/api_key_auth.dart'; +part 'auth/oauth.dart'; +part 'auth/http_basic_auth.dart'; + +part 'api/pet_api.dart'; +part 'api/store_api.dart'; +part 'api/user_api.dart'; + +part 'model/api_response.dart'; +part 'model/category.dart'; +part 'model/order.dart'; +part 'model/pet.dart'; +part 'model/tag.dart'; +part 'model/user.dart'; + +ApiClient defaultApiClient = ApiClient(); diff --git a/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart b/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart new file mode 100644 index 00000000000..0c625c2b04a --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/api/pet_api.dart @@ -0,0 +1,385 @@ +part of openapi.api; + +class PetApi { + final ApiClient apiClient; + + PetApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + /// Add a new pet to the store + /// + /// + Future addPet(Pet pet) async { + Object postBody = pet; + + // verify required params are set + if (pet == null) { + throw new ApiException(400, "Missing required param: pet"); + } + + // create path and map variables + String path = "/pet".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["application/json", "application/xml"]; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Deletes a pet + /// + /// + Future deletePet(int petId, {String apiKey}) async { + Object postBody; + + // verify required params are set + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); + } + + // create path and map variables + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + headerParams["api_key"] = apiKey; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Finds Pets by status + /// + /// Multiple status values can be provided with comma separated strings + Future> findPetsByStatus(List status) async { + Object postBody; + + // verify required params are set + if (status == null) { + throw new ApiException(400, "Missing required param: status"); + } + + // create path and map variables + String path = "/pet/findByStatus".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + queryParams + .addAll(_convertParametersForCollectionFormat("csv", "status", status)); + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return (apiClient.deserialize(response.body, 'List') as List) + .map((item) => item as Pet) + .toList(); + } else { + return null; + } + } + + /// Finds Pets by tags + /// + /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + Future> findPetsByTags(List tags) async { + Object postBody; + + // verify required params are set + if (tags == null) { + throw new ApiException(400, "Missing required param: tags"); + } + + // create path and map variables + String path = "/pet/findByTags".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + queryParams + .addAll(_convertParametersForCollectionFormat("csv", "tags", tags)); + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return (apiClient.deserialize(response.body, 'List') as List) + .map((item) => item as Pet) + .toList(); + } else { + return null; + } + } + + /// Find pet by ID + /// + /// Returns a single pet + Future getPetById(int petId) async { + Object postBody; + + // verify required params are set + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); + } + + // create path and map variables + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["api_key"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'Pet') as Pet; + } else { + return null; + } + } + + /// Update an existing pet + /// + /// + Future updatePet(Pet pet) async { + Object postBody = pet; + + // verify required params are set + if (pet == null) { + throw new ApiException(400, "Missing required param: pet"); + } + + // create path and map variables + String path = "/pet".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["application/json", "application/xml"]; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Updates a pet in the store with form data + /// + /// + Future updatePetWithForm(int petId, {String name, String status}) async { + Object postBody; + + // verify required params are set + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); + } + + // create path and map variables + String path = "/pet/{petId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["application/x-www-form-urlencoded"]; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (name != null) { + hasFields = true; + mp.fields['name'] = parameterToString(name); + } + if (status != null) { + hasFields = true; + mp.fields['status'] = parameterToString(status); + } + if (hasFields) postBody = mp; + } else { + if (name != null) formParams['name'] = parameterToString(name); + if (status != null) formParams['status'] = parameterToString(status); + } + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// uploads an image + /// + /// + Future uploadFile(int petId, + {String additionalMetadata, MultipartFile file}) async { + Object postBody; + + // verify required params are set + if (petId == null) { + throw new ApiException(400, "Missing required param: petId"); + } + + // create path and map variables + String path = "/pet/{petId}/uploadImage" + .replaceAll("{format}", "json") + .replaceAll("{" + "petId" + "}", petId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = ["multipart/form-data"]; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["petstore_auth"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (additionalMetadata != null) { + hasFields = true; + mp.fields['additionalMetadata'] = parameterToString(additionalMetadata); + } + if (file != null) { + hasFields = true; + mp.fields['file'] = file.field; + mp.files.add(file); + } + if (hasFields) postBody = mp; + } else { + if (additionalMetadata != null) + formParams['additionalMetadata'] = + parameterToString(additionalMetadata); + } + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'ApiResponse') as ApiResponse; + } else { + return null; + } + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/api/store_api.dart b/samples/client/petstore/dart2/openapi/lib/api/store_api.dart new file mode 100644 index 00000000000..5f88bf5ac99 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/api/store_api.dart @@ -0,0 +1,180 @@ +part of openapi.api; + +class StoreApi { + final ApiClient apiClient; + + StoreApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + /// Delete purchase order by ID + /// + /// For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + Future deleteOrder(String orderId) async { + Object postBody; + + // verify required params are set + if (orderId == null) { + throw new ApiException(400, "Missing required param: orderId"); + } + + // create path and map variables + String path = "/store/order/{orderId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "orderId" + "}", orderId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Returns pet inventories by status + /// + /// Returns a map of status codes to quantities + Future> getInventory() async { + Object postBody; + + // verify required params are set + + // create path and map variables + String path = "/store/inventory".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = ["api_key"]; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return new Map.from( + apiClient.deserialize(response.body, 'Map')); + ; + } else { + return null; + } + } + + /// Find purchase order by ID + /// + /// For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + Future getOrderById(int orderId) async { + Object postBody; + + // verify required params are set + if (orderId == null) { + throw new ApiException(400, "Missing required param: orderId"); + } + + // create path and map variables + String path = "/store/order/{orderId}" + .replaceAll("{format}", "json") + .replaceAll("{" + "orderId" + "}", orderId.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'Order') as Order; + } else { + return null; + } + } + + /// Place an order for a pet + /// + /// + Future placeOrder(Order order) async { + Object postBody = order; + + // verify required params are set + if (order == null) { + throw new ApiException(400, "Missing required param: order"); + } + + // create path and map variables + String path = "/store/order".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'Order') as Order; + } else { + return null; + } + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/api/user_api.dart b/samples/client/petstore/dart2/openapi/lib/api/user_api.dart new file mode 100644 index 00000000000..94b245a5609 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/api/user_api.dart @@ -0,0 +1,352 @@ +part of openapi.api; + +class UserApi { + final ApiClient apiClient; + + UserApi([ApiClient apiClient]) : apiClient = apiClient ?? defaultApiClient; + + /// Create user + /// + /// This can only be done by the logged in user. + Future createUser(User user) async { + Object postBody = user; + + // verify required params are set + if (user == null) { + throw new ApiException(400, "Missing required param: user"); + } + + // create path and map variables + String path = "/user".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Creates list of users with given input array + /// + /// + Future createUsersWithArrayInput(List user) async { + Object postBody = user; + + // verify required params are set + if (user == null) { + throw new ApiException(400, "Missing required param: user"); + } + + // create path and map variables + String path = "/user/createWithArray".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Creates list of users with given input array + /// + /// + Future createUsersWithListInput(List user) async { + Object postBody = user; + + // verify required params are set + if (user == null) { + throw new ApiException(400, "Missing required param: user"); + } + + // create path and map variables + String path = "/user/createWithList".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'POST', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Delete user + /// + /// This can only be done by the logged in user. + Future deleteUser(String username) async { + Object postBody; + + // verify required params are set + if (username == null) { + throw new ApiException(400, "Missing required param: username"); + } + + // create path and map variables + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'DELETE', queryParams, + postBody, headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Get user by user name + /// + /// + Future getUserByName(String username) async { + Object postBody; + + // verify required params are set + if (username == null) { + throw new ApiException(400, "Missing required param: username"); + } + + // create path and map variables + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'User') as User; + } else { + return null; + } + } + + /// Logs user into the system + /// + /// + Future loginUser(String username, String password) async { + Object postBody; + + // verify required params are set + if (username == null) { + throw new ApiException(400, "Missing required param: username"); + } + if (password == null) { + throw new ApiException(400, "Missing required param: password"); + } + + // create path and map variables + String path = "/user/login".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + queryParams.addAll( + _convertParametersForCollectionFormat("", "username", username)); + queryParams.addAll( + _convertParametersForCollectionFormat("", "password", password)); + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) { + return apiClient.deserialize(response.body, 'String') as String; + } else { + return null; + } + } + + /// Logs out current logged in user session + /// + /// + Future logoutUser() async { + Object postBody; + + // verify required params are set + + // create path and map variables + String path = "/user/logout".replaceAll("{format}", "json"); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'GET', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } + + /// Updated user + /// + /// This can only be done by the logged in user. + Future updateUser(String username, User user) async { + Object postBody = user; + + // verify required params are set + if (username == null) { + throw new ApiException(400, "Missing required param: username"); + } + if (user == null) { + throw new ApiException(400, "Missing required param: user"); + } + + // create path and map variables + String path = "/user/{username}" + .replaceAll("{format}", "json") + .replaceAll("{" + "username" + "}", username.toString()); + + // query params + List queryParams = []; + Map headerParams = {}; + Map formParams = {}; + + List contentTypes = []; + + String contentType = + contentTypes.length > 0 ? contentTypes[0] : "application/json"; + List authNames = []; + + if (contentType.startsWith("multipart/form-data")) { + bool hasFields = false; + MultipartRequest mp = new MultipartRequest(null, null); + if (hasFields) postBody = mp; + } else {} + + var response = await apiClient.invokeAPI(path, 'PUT', queryParams, postBody, + headerParams, formParams, contentType, authNames); + + if (response.statusCode >= 400) { + throw new ApiException(response.statusCode, response.body); + } else if (response.body != null) {} else { + return; + } + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/api_client.dart b/samples/client/petstore/dart2/openapi/lib/api_client.dart new file mode 100644 index 00000000000..d0db1fd65ec --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/api_client.dart @@ -0,0 +1,165 @@ +part of openapi.api; + +class QueryParam { + String name; + String value; + + QueryParam(this.name, this.value); +} + +class ApiClient { + String basePath; + var client = Client(); + + Map _defaultHeaderMap = {}; + Map _authentications = {}; + + final _regList = RegExp(r'^List<(.*)>$'); + final _regMap = RegExp(r'^Map$'); + + ApiClient({this.basePath: "http://petstore.swagger.io/v2"}) { + // Setup authentications (key: authentication name, value: authentication). + _authentications['api_key'] = ApiKeyAuth("header", "api_key"); + _authentications['petstore_auth'] = OAuth(); + } + + void addDefaultHeader(String key, String value) { + _defaultHeaderMap[key] = value; + } + + dynamic _deserialize(dynamic value, String targetType) { + try { + switch (targetType) { + case 'String': + return '$value'; + case 'int': + return value is int ? value : int.parse('$value'); + case 'bool': + return value is bool ? value : '$value'.toLowerCase() == 'true'; + case 'double': + return value is double ? value : double.parse('$value'); + case 'ApiResponse': + return ApiResponse.fromJson(value); + case 'Category': + return Category.fromJson(value); + case 'Order': + return Order.fromJson(value); + case 'Pet': + return Pet.fromJson(value); + case 'Tag': + return Tag.fromJson(value); + case 'User': + return User.fromJson(value); + default: + { + Match match; + if (value is List && + (match = _regList.firstMatch(targetType)) != null) { + var newTargetType = match[1]; + return value.map((v) => _deserialize(v, newTargetType)).toList(); + } else if (value is Map && + (match = _regMap.firstMatch(targetType)) != null) { + var newTargetType = match[1]; + return Map.fromIterables(value.keys, + value.values.map((v) => _deserialize(v, newTargetType))); + } + } + } + } on Exception catch (e, stack) { + throw ApiException.withInner( + 500, 'Exception during deserialization.', e, stack); + } + throw ApiException( + 500, 'Could not find a suitable class for deserialization'); + } + + dynamic deserialize(String json, String targetType) { + // Remove all spaces. Necessary for reg expressions as well. + targetType = targetType.replaceAll(' ', ''); + + if (targetType == 'String') return json; + + var decodedJson = jsonDecode(json); + return _deserialize(decodedJson, targetType); + } + + String serialize(Object obj) { + String serialized = ''; + if (obj == null) { + serialized = ''; + } else { + serialized = json.encode(obj); + } + return serialized; + } + + // We don't use a Map for queryParams. + // If collectionFormat is 'multi' a key might appear multiple times. + Future invokeAPI( + String path, + String method, + Iterable queryParams, + Object body, + Map headerParams, + Map formParams, + String contentType, + List authNames) async { + _updateParamsForAuth(authNames, queryParams, headerParams); + + var ps = queryParams + .where((p) => p.value != null) + .map((p) => '${p.name}=${p.value}'); + String queryString = ps.isNotEmpty ? '?' + ps.join('&') : ''; + + String url = basePath + path + queryString; + + headerParams.addAll(_defaultHeaderMap); + headerParams['Content-Type'] = contentType; + + if (body is MultipartRequest) { + var request = MultipartRequest(method, Uri.parse(url)); + request.fields.addAll(body.fields); + request.files.addAll(body.files); + request.headers.addAll(body.headers); + request.headers.addAll(headerParams); + var response = await client.send(request); + return Response.fromStream(response); + } else { + var msgBody = contentType == "application/x-www-form-urlencoded" + ? formParams + : serialize(body); + switch (method) { + case "POST": + return client.post(url, headers: headerParams, body: msgBody); + case "PUT": + return client.put(url, headers: headerParams, body: msgBody); + case "DELETE": + return client.delete(url, headers: headerParams); + case "PATCH": + return client.patch(url, headers: headerParams, body: msgBody); + default: + return client.get(url, headers: headerParams); + } + } + } + + /// Update query and header parameters based on authentication settings. + /// @param authNames The authentications to apply + void _updateParamsForAuth(List authNames, + List queryParams, Map headerParams) { + authNames.forEach((authName) { + Authentication auth = _authentications[authName]; + if (auth == null) + throw ArgumentError("Authentication undefined: " + authName); + auth.applyToParams(queryParams, headerParams); + }); + } + + void setAccessToken(String accessToken) { + _authentications.forEach((key, auth) { + if (auth is OAuth) { + auth.setAccessToken(accessToken); + } + }); + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/api_exception.dart b/samples/client/petstore/dart2/openapi/lib/api_exception.dart new file mode 100644 index 00000000000..a702da723eb --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/api_exception.dart @@ -0,0 +1,24 @@ +part of openapi.api; + +class ApiException implements Exception { + int code = 0; + String message; + Exception innerException; + StackTrace stackTrace; + + ApiException(this.code, this.message); + + ApiException.withInner( + this.code, this.message, this.innerException, this.stackTrace); + + String toString() { + if (message == null) return "ApiException"; + + if (innerException == null) { + return "ApiException $code: $message"; + } + + return "ApiException $code: $message (Inner exception: $innerException)\n\n" + + stackTrace.toString(); + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/api_helper.dart b/samples/client/petstore/dart2/openapi/lib/api_helper.dart new file mode 100644 index 00000000000..9f7ccc8df90 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/api_helper.dart @@ -0,0 +1,45 @@ +part of openapi.api; + +const _delimiters = const {'csv': ',', 'ssv': ' ', 'tsv': '\t', 'pipes': '|'}; + +// port from Java version +Iterable _convertParametersForCollectionFormat( + String collectionFormat, String name, dynamic value) { + var params = []; + + // preconditions + if (name == null || name.isEmpty || value == null) return params; + + if (value is! List) { + params.add(QueryParam(name, parameterToString(value))); + return params; + } + + List values = value as List; + + // get the collection format + collectionFormat = (collectionFormat == null || collectionFormat.isEmpty) + ? "csv" + : collectionFormat; // default: csv + + if (collectionFormat == "multi") { + return values.map((v) => QueryParam(name, parameterToString(v))); + } + + String delimiter = _delimiters[collectionFormat] ?? ","; + + params.add(QueryParam( + name, values.map((v) => parameterToString(v)).join(delimiter))); + return params; +} + +/// Format the given parameter object into string. +String parameterToString(dynamic value) { + if (value == null) { + return ''; + } else if (value is DateTime) { + return value.toUtc().toIso8601String(); + } else { + return value.toString(); + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/auth/api_key_auth.dart b/samples/client/petstore/dart2/openapi/lib/auth/api_key_auth.dart new file mode 100644 index 00000000000..b5a7a8248c0 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/auth/api_key_auth.dart @@ -0,0 +1,27 @@ +part of openapi.api; + +class ApiKeyAuth implements Authentication { + final String location; + final String paramName; + String apiKey; + String apiKeyPrefix; + + ApiKeyAuth(this.location, this.paramName); + + @override + void applyToParams( + List queryParams, Map headerParams) { + String value; + if (apiKeyPrefix != null) { + value = '$apiKeyPrefix $apiKey'; + } else { + value = apiKey; + } + + if (location == 'query' && value != null) { + queryParams.add(QueryParam(paramName, value)); + } else if (location == 'header' && value != null) { + headerParams[paramName] = value; + } + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/auth/authentication.dart b/samples/client/petstore/dart2/openapi/lib/auth/authentication.dart new file mode 100644 index 00000000000..2c4d5f301fa --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/auth/authentication.dart @@ -0,0 +1,7 @@ +part of openapi.api; + +abstract class Authentication { + /// Apply authentication settings to header and query params. + void applyToParams( + List queryParams, Map headerParams); +} diff --git a/samples/client/petstore/dart2/openapi/lib/auth/http_basic_auth.dart b/samples/client/petstore/dart2/openapi/lib/auth/http_basic_auth.dart new file mode 100644 index 00000000000..e141c062ae0 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/auth/http_basic_auth.dart @@ -0,0 +1,15 @@ +part of openapi.api; + +class HttpBasicAuth implements Authentication { + String username; + String password; + + @override + void applyToParams( + List queryParams, Map headerParams) { + String str = (username == null ? "" : username) + + ":" + + (password == null ? "" : password); + headerParams["Authorization"] = "Basic " + base64.encode(utf8.encode(str)); + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/auth/oauth.dart b/samples/client/petstore/dart2/openapi/lib/auth/oauth.dart new file mode 100644 index 00000000000..73e2ae07ea3 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/auth/oauth.dart @@ -0,0 +1,19 @@ +part of openapi.api; + +class OAuth implements Authentication { + String accessToken; + + OAuth({this.accessToken}); + + @override + void applyToParams( + List queryParams, Map headerParams) { + if (accessToken != null) { + headerParams["Authorization"] = "Bearer " + accessToken; + } + } + + void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/model/api_response.dart b/samples/client/petstore/dart2/openapi/lib/model/api_response.dart new file mode 100644 index 00000000000..7265f7138d0 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/model/api_response.dart @@ -0,0 +1,41 @@ +part of openapi.api; + +class ApiResponse { + int code = null; + + String type = null; + + String message = null; + ApiResponse(); + + @override + String toString() { + return 'ApiResponse[code=$code, type=$type, message=$message, ]'; + } + + ApiResponse.fromJson(Map json) { + if (json == null) return; + code = json['code']; + type = json['type']; + message = json['message']; + } + + Map toJson() { + return {'code': code, 'type': type, 'message': message}; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new ApiResponse.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach((String key, dynamic value) => + map[key] = new ApiResponse.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/model/category.dart b/samples/client/petstore/dart2/openapi/lib/model/category.dart new file mode 100644 index 00000000000..ac6c55b2e37 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/model/category.dart @@ -0,0 +1,38 @@ +part of openapi.api; + +class Category { + int id = null; + + String name = null; + Category(); + + @override + String toString() { + return 'Category[id=$id, name=$name, ]'; + } + + Category.fromJson(Map json) { + if (json == null) return; + id = json['id']; + name = json['name']; + } + + Map toJson() { + return {'id': id, 'name': name}; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new Category.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach((String key, dynamic value) => + map[key] = new Category.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/model/order.dart b/samples/client/petstore/dart2/openapi/lib/model/order.dart new file mode 100644 index 00000000000..d4aa944967f --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/model/order.dart @@ -0,0 +1,59 @@ +part of openapi.api; + +class Order { + int id = null; + + int petId = null; + + int quantity = null; + + DateTime shipDate = null; + /* Order Status */ + String status = null; + //enum statusEnum { placed, approved, delivered, };{ + + bool complete = false; + Order(); + + @override + String toString() { + return 'Order[id=$id, petId=$petId, quantity=$quantity, shipDate=$shipDate, status=$status, complete=$complete, ]'; + } + + Order.fromJson(Map json) { + if (json == null) return; + id = json['id']; + petId = json['petId']; + quantity = json['quantity']; + shipDate = + json['shipDate'] == null ? null : DateTime.parse(json['shipDate']); + status = json['status']; + complete = json['complete']; + } + + Map toJson() { + return { + 'id': id, + 'petId': petId, + 'quantity': quantity, + 'shipDate': shipDate == null ? '' : shipDate.toUtc().toIso8601String(), + 'status': status, + 'complete': complete + }; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new Order.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach( + (String key, dynamic value) => map[key] = new Order.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/model/pet.dart b/samples/client/petstore/dart2/openapi/lib/model/pet.dart new file mode 100644 index 00000000000..e9af61831d9 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/model/pet.dart @@ -0,0 +1,60 @@ +part of openapi.api; + +class Pet { + int id = null; + + Category category = null; + + String name = null; + + List photoUrls = []; + + List tags = []; + /* pet status in the store */ + String status = null; + //enum statusEnum { available, pending, sold, };{ + Pet(); + + @override + String toString() { + return 'Pet[id=$id, category=$category, name=$name, photoUrls=$photoUrls, tags=$tags, status=$status, ]'; + } + + Pet.fromJson(Map json) { + if (json == null) return; + id = json['id']; + category = new Category.fromJson(json['category']); + name = json['name']; + photoUrls = ((json['photoUrls'] ?? []) as List) + .map((item) => item as String) + .toList(); + tags = Tag.listFromJson(json['tags']); + status = json['status']; + } + + Map toJson() { + return { + 'id': id, + 'category': category, + 'name': name, + 'photoUrls': photoUrls, + 'tags': tags, + 'status': status + }; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new Pet.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach( + (String key, dynamic value) => map[key] = new Pet.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/model/tag.dart b/samples/client/petstore/dart2/openapi/lib/model/tag.dart new file mode 100644 index 00000000000..4a93785d104 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/model/tag.dart @@ -0,0 +1,38 @@ +part of openapi.api; + +class Tag { + int id = null; + + String name = null; + Tag(); + + @override + String toString() { + return 'Tag[id=$id, name=$name, ]'; + } + + Tag.fromJson(Map json) { + if (json == null) return; + id = json['id']; + name = json['name']; + } + + Map toJson() { + return {'id': id, 'name': name}; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new Tag.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach( + (String key, dynamic value) => map[key] = new Tag.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/openapi/lib/model/user.dart b/samples/client/petstore/dart2/openapi/lib/model/user.dart new file mode 100644 index 00000000000..55f62cc9198 --- /dev/null +++ b/samples/client/petstore/dart2/openapi/lib/model/user.dart @@ -0,0 +1,65 @@ +part of openapi.api; + +class User { + int id = null; + + String username = null; + + String firstName = null; + + String lastName = null; + + String email = null; + + String password = null; + + String phone = null; + /* User Status */ + int userStatus = null; + User(); + + @override + String toString() { + return 'User[id=$id, username=$username, firstName=$firstName, lastName=$lastName, email=$email, password=$password, phone=$phone, userStatus=$userStatus, ]'; + } + + User.fromJson(Map json) { + if (json == null) return; + id = json['id']; + username = json['username']; + firstName = json['firstName']; + lastName = json['lastName']; + email = json['email']; + password = json['password']; + phone = json['phone']; + userStatus = json['userStatus']; + } + + Map toJson() { + return { + 'id': id, + 'username': username, + 'firstName': firstName, + 'lastName': lastName, + 'email': email, + 'password': password, + 'phone': phone, + 'userStatus': userStatus + }; + } + + static List listFromJson(List json) { + return json == null + ? new List() + : json.map((value) => new User.fromJson(value)).toList(); + } + + static Map mapFromJson(Map json) { + var map = new Map(); + if (json != null && json.length > 0) { + json.forEach( + (String key, dynamic value) => map[key] = new User.fromJson(value)); + } + return map; + } +} diff --git a/samples/client/petstore/dart2/openapi/pubspec.yaml b/samples/client/petstore/dart2/openapi/pubspec.yaml new file mode 100644 index 00000000000..9ccf0e524ad --- /dev/null +++ b/samples/client/petstore/dart2/openapi/pubspec.yaml @@ -0,0 +1,7 @@ +name: openapi +version: 1.0.0 +description: OpenAPI API client +environment: + sdk: '>=2.0.0 <3.0.0' +dependencies: + http: '>=0.11.1 <0.12.0' diff --git a/samples/client/petstore/dart2/petstore/.analysis_options b/samples/client/petstore/dart2/petstore/.analysis_options new file mode 100644 index 00000000000..a10d4c5a05c --- /dev/null +++ b/samples/client/petstore/dart2/petstore/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true diff --git a/samples/client/petstore/dart2/petstore/README.md b/samples/client/petstore/dart2/petstore/README.md new file mode 100644 index 00000000000..17343a5c026 --- /dev/null +++ b/samples/client/petstore/dart2/petstore/README.md @@ -0,0 +1,58 @@ +# To run these tests: + +Simply start the dart server: `pub serve` + +then open http://127.0.0.1:8080/tests.html + + +This already starts the tests. There is _NO_ feedback! + +Open the javascript / dart console of your browser to verify all tests +passed successfully. + +You should have the following output: +``` +Observatory listening at http://127.0.0.1:39067/ +unittest-suite-wait-for-done +GET http://petstore.swagger.io/v2/pet/957639 404 (Not Found) +GET http://petstore.swagger.io/v2/pet/525946 404 (Not Found) +GET http://petstore.swagger.io/v2/store/order/29756 404 (Not Found) +GET http://petstore.swagger.io/v2/user/Riddlem325 404 (Not Found) +PASS: Pet API adds a new pet and gets it by id +PASS: Pet API doesn't get non-existing pet by id +PASS: Pet API deletes existing pet by id +PASS: Pet API updates pet with form +PASS: Pet API updates existing pet +PASS: Pet API finds pets by status +PASS: Pet API finds pets by tag +PASS: Pet API uploads a pet image +PASS: Store API places an order and gets it by id +PASS: Store API deletes an order +PASS: Store API gets the store inventory +PASS: User API creates a user +PASS: User API creates users with list input +PASS: User API updates a user +PASS: User API deletes a user +PASS: User API logs a user in + +All 16 tests passed. +unittest-suite-success +``` + + +You may also run the tests in the dart vm. + +Either generate the test-package for a vm: +- change bin/dart-petstore.sh and uncomment the vm options line +- run bin/dart-petstore.sh + +or + +- in `lib/api_client.dart` change `new BrowserClient()` to `new Client()` +- in `lib/api.dart` remove the line `import 'package:http/browser_client.dart';` + + + +Then run `test/tests.dart`. + +Have fun. \ No newline at end of file diff --git a/samples/client/petstore/dart2/petstore/pom.xml b/samples/client/petstore/dart2/petstore/pom.xml new file mode 100644 index 00000000000..f3332da5e1a --- /dev/null +++ b/samples/client/petstore/dart2/petstore/pom.xml @@ -0,0 +1,74 @@ + + 4.0.0 + org.openapitools + Dart2PetstoreClientTests + pom + 1.0.0-SNAPSHOT + Dart2 Petstore Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + export-dartfmt + pre-install-test + + exec + + + export + + DART_FMT_PATH=/usr/local/bin/dartfmt + + + + + pub-get + pre-integration-test + + exec + + + pub + + get + + + + + pub-test + integration-test + + exec + + + pub + + run + build_runner + test + + + + + + + + diff --git a/samples/client/petstore/dart2/petstore/pubspec.lock b/samples/client/petstore/dart2/petstore/pubspec.lock new file mode 100644 index 00000000000..f077e1d4423 --- /dev/null +++ b/samples/client/petstore/dart2/petstore/pubspec.lock @@ -0,0 +1,516 @@ +# Generated by pub +# See https://www.dartlang.org/tools/pub/glossary#lockfile +packages: + analyzer: + dependency: transitive + description: + name: analyzer + url: "https://pub.dartlang.org" + source: hosted + version: "0.32.4" + archive: + dependency: transitive + description: + name: archive + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" + args: + dependency: transitive + description: + name: args + url: "https://pub.dartlang.org" + source: hosted + version: "1.5.0" + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.8" + bazel_worker: + dependency: transitive + description: + name: bazel_worker + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.12" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + build: + dependency: transitive + description: + name: build + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.7+3" + build_config: + dependency: transitive + description: + name: build_config + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.1+2" + build_modules: + dependency: transitive + description: + name: build_modules + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.2" + build_resolvers: + dependency: transitive + description: + name: build_resolvers + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.2+3" + build_runner: + dependency: "direct dev" + description: + name: build_runner + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.1+1" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.1+4" + build_test: + dependency: "direct dev" + description: + name: build_test + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.3+1" + build_web_compilers: + dependency: "direct dev" + description: + name: build_web_compilers + url: "https://pub.dartlang.org" + source: hosted + version: "0.4.2+2" + built_collection: + dependency: transitive + description: + name: built_collection + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.3" + built_value: + dependency: transitive + description: + name: built_value + url: "https://pub.dartlang.org" + source: hosted + version: "5.5.5" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" + cli_util: + dependency: transitive + description: + name: cli_util + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3+2" + code_builder: + dependency: transitive + description: + name: code_builder + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.2" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.14.11" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.2" + crypto: + dependency: transitive + description: + name: crypto + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.6" + csslib: + dependency: transitive + description: + name: csslib + url: "https://pub.dartlang.org" + source: hosted + version: "0.14.5" + dart_style: + dependency: transitive + description: + name: dart_style + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.3" + fixnum: + dependency: transitive + description: + name: fixnum + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.8" + front_end: + dependency: transitive + description: + name: front_end + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.4" + glob: + dependency: transitive + description: + name: glob + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.7" + graphs: + dependency: transitive + description: + name: graphs + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2+1" + html: + dependency: transitive + description: + name: html + url: "https://pub.dartlang.org" + source: hosted + version: "0.13.3+3" + http: + dependency: transitive + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.11.3+17" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.5" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.3" + io: + dependency: transitive + description: + name: io + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.3" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.1+1" + json_annotation: + dependency: transitive + description: + name: json_annotation + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" + json_rpc_2: + dependency: transitive + description: + name: json_rpc_2 + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.9" + kernel: + dependency: transitive + description: + name: kernel + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.4" + logging: + dependency: transitive + description: + name: logging + url: "https://pub.dartlang.org" + source: hosted + version: "0.11.3+2" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.3+1" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" + mime: + dependency: transitive + description: + name: mime + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.6+2" + multi_server_socket: + dependency: transitive + description: + name: multi_server_socket + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + node_preamble: + dependency: transitive + description: + name: node_preamble + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.4" + openapi: + dependency: "direct main" + description: + path: "../openapi" + relative: true + source: path + version: "1.0.0" + package_config: + dependency: transitive + description: + name: package_config + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + package_resolver: + dependency: transitive + description: + name: package_resolver + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.2" + plugin: + dependency: transitive + description: + name: plugin + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0+3" + pool: + dependency: transitive + description: + name: pool + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.6" + protobuf: + dependency: transitive + description: + name: protobuf + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.1" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.2" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.2+2" + quiver: + dependency: transitive + description: + name: quiver + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0+1" + scratch_space: + dependency: transitive + description: + name: scratch_space + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.3+1" + shelf: + dependency: transitive + description: + name: shelf + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.3+3" + shelf_packages_handler: + dependency: transitive + description: + name: shelf_packages_handler + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + shelf_static: + dependency: transitive + description: + name: shelf_static + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.8" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.2+4" + source_map_stack_trace: + dependency: transitive + description: + name: source_map_stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.5" + source_maps: + dependency: transitive + description: + name: source_maps + url: "https://pub.dartlang.org" + source: hosted + version: "0.10.7" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.3" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "1.6.8" + stream_transform: + dependency: transitive + description: + name: stream_transform + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.14+1" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.4" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.1" + test: + dependency: "direct main" + description: + name: test + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.6" + utf: + dependency: transitive + description: + name: utf + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.0+5" + vm_service_client: + dependency: transitive + description: + name: vm_service_client + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.6" + watcher: + dependency: transitive + description: + name: watcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.7+10" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.9" + yaml: + dependency: transitive + description: + name: yaml + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.15" +sdks: + dart: ">=2.0.0 <3.0.0" diff --git a/samples/client/petstore/dart2/petstore/pubspec.yaml b/samples/client/petstore/dart2/petstore/pubspec.yaml new file mode 100644 index 00000000000..d84c7ac3202 --- /dev/null +++ b/samples/client/petstore/dart2/petstore/pubspec.yaml @@ -0,0 +1,13 @@ +name: petstore_client +version: 1.0.0 +description: Petstore client using OpenAPI library +environment: + sdk: '>=2.0.0 <3.0.0' +dependencies: + openapi: + path: ../openapi + test: ^1.3.0 +dev_dependencies: + build_runner: ^0.10.1+1 + build_test: ^0.10.3+1 + build_web_compilers: ^0.4.2+2 diff --git a/samples/client/petstore/dart2/petstore/test/pet_test.dart b/samples/client/petstore/dart2/petstore/test/pet_test.dart new file mode 100644 index 00000000000..3671469c7b7 --- /dev/null +++ b/samples/client/petstore/dart2/petstore/test/pet_test.dart @@ -0,0 +1,103 @@ +import 'dart:async'; + +import 'package:http/http.dart'; +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +import 'random_id.dart'; + +void main() { + var petApi = new PetApi(); + + Pet makePet({ + int id = 1234, + String name = 'Fluffy', + String status = '', + }) { + final category = Category() + ..id = 1234 + ..name = 'eyeColor'; + final tags = [ + Tag() + ..id = 1234 + ..name = 'New York', + Tag() + ..id = 124321 + ..name = 'Jose' + ]; + return Pet() + ..id = id + ..category = category + ..tags = tags + ..name = name + ..status = status + ..photoUrls = ['https://petstore.com/sample/photo1.jpg']; + } + + group('Pet API ', () { + test('adds a new pet and gets it by id', () async { + var id = newId(); + await petApi.addPet(makePet(id: id)); + var pet = await petApi.getPetById(id); + expect(pet.id, equals(id)); + }); + + test('doesn\'t get non-existing pet by id', () { + expect(petApi.getPetById(newId()), + throwsA(equals(TypeMatcher()))); + }); + + test('deletes existing pet by id', () async { + var id = newId(); + await petApi.addPet(makePet(id: id)); + await petApi.deletePet(id, apiKey: 'special-key'); + expect( + petApi.getPetById(id), throwsA(equals(TypeMatcher()))); + }); + + test('updates pet with form', () async { + var id = newId(); + + await petApi.addPet(makePet(id: id, name: 'Snowy')); + await petApi.updatePetWithForm(id, name: 'Doge', status: ''); + var pet = await petApi.getPetById(id); + expect(pet.name, equals('Doge')); + }); + + test('updates existing pet', () async { + var id = newId(); + var name = 'Snowy'; + + await petApi.addPet(makePet(id: id)); + await petApi.updatePet(makePet(id: id, name: name)); + var pet = await petApi.getPetById(id); + expect(pet.name, equals(name)); + }); + + test('finds pets by status', () async { + var id1 = newId(); + var id2 = newId(); + var id3 = newId(); + var status = 'available'; + + return Future.wait([ + petApi.addPet(makePet(id: id1, status: status)), + petApi.addPet(makePet(id: id2, status: status)), + petApi.addPet(makePet(id: id3, status: 'sold')) + ]).then((_) async { + var pets = await petApi.findPetsByStatus([status]); + var petIds = pets.map((pet) => pet.id).toList(); + expect(petIds, contains(id1)); + expect(petIds, contains(id2)); + expect(petIds, isNot(contains(id3))); + }); + }); + + test('uploads a pet image', () async { + var id = newId(); + await petApi.addPet(makePet(id: id)); + var file = new MultipartFile.fromBytes('file', [104, 101, 108, 108, 111]); + await petApi.uploadFile(id, additionalMetadata: '', file: file); + }); + }); +} diff --git a/samples/client/petstore/dart2/petstore/test/random_id.dart b/samples/client/petstore/dart2/petstore/test/random_id.dart new file mode 100644 index 00000000000..0457428c7dd --- /dev/null +++ b/samples/client/petstore/dart2/petstore/test/random_id.dart @@ -0,0 +1,7 @@ +import 'dart:math'; + +final _random = new Random(); + +int newId() { + return _random.nextInt(999999); +} \ No newline at end of file diff --git a/samples/client/petstore/dart2/petstore/test/store_test.dart b/samples/client/petstore/dart2/petstore/test/store_test.dart new file mode 100644 index 00000000000..0e610e7a67a --- /dev/null +++ b/samples/client/petstore/dart2/petstore/test/store_test.dart @@ -0,0 +1,42 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +import 'random_id.dart'; + +void main() { + var storeApi = new StoreApi(); + + Order makeOrder({int id}) { + return Order() + ..id = id + ..petId = 1234 + ..quantity = 1 + ..shipDate = DateTime.now() + ..status + ..complete = false; + } + + group('Store API ', () { + test('places an order and gets it by id', () async { + var id = newId(); + + await storeApi.placeOrder(makeOrder(id: id)); + var order = await storeApi.getOrderById(id); + expect(order.id, equals(id)); + }); + + test('deletes an order', () async { + var id = newId(); + + await storeApi.placeOrder(makeOrder(id: id)); + await storeApi.deleteOrder(id.toString()); + expect(storeApi.getOrderById(id), + throwsA(equals(TypeMatcher()))); + }); + + test('gets the store inventory', () async { + Map inventory = await storeApi.getInventory(); + expect(inventory.length, isNot(equals(0))); + }); + }); +} diff --git a/samples/client/petstore/dart2/petstore/test/user_test.dart b/samples/client/petstore/dart2/petstore/test/user_test.dart new file mode 100644 index 00000000000..a9c37e4808b --- /dev/null +++ b/samples/client/petstore/dart2/petstore/test/user_test.dart @@ -0,0 +1,80 @@ +import 'package:openapi/api.dart'; +import 'package:test/test.dart'; + +import 'random_id.dart'; + +void main() { + var userApi = new UserApi(); + + User makeUser( + {int id, String userName = 'username', String password = 'password'}) { + return User() + ..id = id + ..username = userName + ..firstName = 'firstname' + ..lastName = 'lastname' + ..email = 'email' + ..password = password + ..phone = 'phone' + ..userStatus = 0; + } + + group('User API ', () { + test('creates a user', () async { + var id = newId(); + var username = 'Mally45'; + await userApi.createUser(makeUser(id: id, userName: username)); + var user = await userApi.getUserByName(username); + expect(user.id, equals(id)); + }); + + test('creates users with list input', () async { + var firstId = newId(); + var joe = 'Joe'; + + var sally = 'Sally'; + var secondId = newId(); + + var users = [ + makeUser(id: firstId, userName: joe), + makeUser(id: secondId, userName: sally), + ]; + + await userApi.createUsersWithListInput(users); + var firstUser = await userApi.getUserByName(joe); + var secondUser = await userApi.getUserByName(sally); + expect(firstUser.id, equals(firstId)); + expect(secondUser.id, equals(secondId)); + }); + + test('updates a user', () async { + var username = 'Arkjam89'; + var email = 'test@example.com'; + var user = makeUser(id: newId(), userName: username); + + await userApi.createUser(user); + user.email = email; + await userApi.updateUser(username, user); + var foundUser = await userApi.getUserByName(username); + expect(foundUser.email, equals(email)); + }); + + test('deletes a user', () async { + var username = 'Riddlem325'; + await userApi.createUser(makeUser(id: newId(), userName: username)); + await userApi.deleteUser(username); + expect(userApi.getUserByName(username), + throwsA(TypeMatcher())); + }); + + test('logs a user in', () async { + var username = 'sgarad625'; + var password = 'lokimoki1'; + var user = makeUser(id: newId(), userName: username, password: password); + + await userApi.createUser(user); + var result = await userApi.loginUser(username, password); + expect(result, contains('logged in user session:')); + }); + }); +} diff --git a/samples/client/petstore/elm-0.18/.gitignore b/samples/client/petstore/elm-0.18/.gitignore new file mode 100644 index 00000000000..8b0d053e4e3 --- /dev/null +++ b/samples/client/petstore/elm-0.18/.gitignore @@ -0,0 +1 @@ +/elm-stuff \ No newline at end of file diff --git a/samples/client/petstore/elm-0.18/.openapi-generator-ignore b/samples/client/petstore/elm-0.18/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/elm-0.18/.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/elm-0.18/.openapi-generator/VERSION b/samples/client/petstore/elm-0.18/.openapi-generator/VERSION new file mode 100644 index 00000000000..6d94c9c2e12 --- /dev/null +++ b/samples/client/petstore/elm-0.18/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/elm-0.18/README.md b/samples/client/petstore/elm-0.18/README.md new file mode 100644 index 00000000000..3f36740911a --- /dev/null +++ b/samples/client/petstore/elm-0.18/README.md @@ -0,0 +1,10 @@ +# Elm API 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. By using the [openapi-spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate an API client. + +- API version: 1.0.0 +- Package version: +- Build package: org.openapitools.codegen.languages.ElmClientCodegen diff --git a/samples/client/petstore/elm-0.18/elm-0.18-compile-test b/samples/client/petstore/elm-0.18/elm-0.18-compile-test new file mode 100755 index 00000000000..c6ba0a25f68 --- /dev/null +++ b/samples/client/petstore/elm-0.18/elm-0.18-compile-test @@ -0,0 +1,14 @@ +#!/bin/bash -e +# elm 0.18 make all elm files under src + +for ELM in `find src -name "*.elm"` +do + echo "Compiling $ELM" + elm make $ELM --output /dev/null --yes + rc=$? + if [[ $rc != 0 ]] + then + echo "ERROR!! FAILED TO COMPILE $ELM" + exit $rc; + fi +done diff --git a/samples/client/petstore/elm/elm-package.json b/samples/client/petstore/elm-0.18/elm-package.json similarity index 100% rename from samples/client/petstore/elm/elm-package.json rename to samples/client/petstore/elm-0.18/elm-package.json diff --git a/samples/client/petstore/elm-0.18/pom.xml b/samples/client/petstore/elm-0.18/pom.xml new file mode 100644 index 00000000000..7ddfe9d49e7 --- /dev/null +++ b/samples/client/petstore/elm-0.18/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + org.openapitools + Elm018ClientTests + pom + 1.0-SNAPSHOT + Elm 0.18 Petstore Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + bundle-test + integration-test + + exec + + + ./elm-0.18-compile-test + + + + + + + diff --git a/samples/client/petstore/elm-0.18/src/Byte.elm b/samples/client/petstore/elm-0.18/src/Byte.elm new file mode 100644 index 00000000000..6c80664aba1 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Byte.elm @@ -0,0 +1,18 @@ +module Byte exposing (Byte, decoder, encoder) + +import Json.Decode as Decode exposing (Decoder) +import Json.Encode as Encode + + +type alias Byte = + String + + +decoder : Decoder Byte +decoder = + Decode.string + + +encoder : Byte -> Encode.Value +encoder model = + Encode.string model diff --git a/samples/client/petstore/elm-0.18/src/Data/ApiResponse.elm b/samples/client/petstore/elm-0.18/src/Data/ApiResponse.elm new file mode 100644 index 00000000000..36006df2fae --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Data/ApiResponse.elm @@ -0,0 +1,43 @@ +{- + OpenAPI Petstore + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + + NOTE: This file is auto generated by the openapi-generator. + https://github.com/openapitools/openapi-generator.git + Do not edit this file manually. +-} + + +module Data.ApiResponse exposing (ApiResponse, decoder, encoder) + +import Json.Decode as Decode exposing (Decoder) +import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Encode as Encode + + +{-| Describes the result of uploading an image resource +-} +type alias ApiResponse = + { code : Maybe Int + , type_ : Maybe String + , message : Maybe String + } + + +decoder : Decoder ApiResponse +decoder = + decode ApiResponse + |> optional "code" (Decode.nullable Decode.int) Nothing + |> optional "type" (Decode.nullable Decode.string) Nothing + |> optional "message" (Decode.nullable Decode.string) Nothing + + +encoder : ApiResponse -> Encode.Value +encoder model = + Encode.object + [ ( "code", Maybe.withDefault Encode.null (Maybe.map Encode.int model.code) ) + , ( "type", Maybe.withDefault Encode.null (Maybe.map Encode.string model.type_) ) + , ( "message", Maybe.withDefault Encode.null (Maybe.map Encode.string model.message) ) + ] diff --git a/samples/client/petstore/elm-0.18/src/Data/Category.elm b/samples/client/petstore/elm-0.18/src/Data/Category.elm new file mode 100644 index 00000000000..38144b5c5cb --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Data/Category.elm @@ -0,0 +1,40 @@ +{- + OpenAPI Petstore + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + + NOTE: This file is auto generated by the openapi-generator. + https://github.com/openapitools/openapi-generator.git + Do not edit this file manually. +-} + + +module Data.Category exposing (Category, decoder, encoder) + +import Json.Decode as Decode exposing (Decoder) +import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Encode as Encode + + +{-| A category for a pet +-} +type alias Category = + { id : Maybe Int + , name : Maybe String + } + + +decoder : Decoder Category +decoder = + decode Category + |> optional "id" (Decode.nullable Decode.int) Nothing + |> optional "name" (Decode.nullable Decode.string) Nothing + + +encoder : Category -> Encode.Value +encoder model = + Encode.object + [ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) ) + , ( "name", Maybe.withDefault Encode.null (Maybe.map Encode.string model.name) ) + ] diff --git a/samples/client/petstore/elm-0.18/src/Data/Order_.elm b/samples/client/petstore/elm-0.18/src/Data/Order_.elm new file mode 100644 index 00000000000..b69e761b24f --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Data/Order_.elm @@ -0,0 +1,92 @@ +{- + OpenAPI Petstore + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + + NOTE: This file is auto generated by the openapi-generator. + https://github.com/openapitools/openapi-generator.git + Do not edit this file manually. +-} + + +module Data.Order_ exposing (Order_, Status(..), decoder, encoder) + +import DateTime exposing (DateTime) +import Json.Decode as Decode exposing (Decoder) +import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Encode as Encode + + +{-| An order for a pets from the pet store +-} +type alias Order_ = + { id : Maybe Int + , petId : Maybe Int + , quantity : Maybe Int + , shipDate : Maybe DateTime + , status : Maybe Status + , complete : Maybe Bool + } + + +type Status + = Placed + | Approved + | Delivered + + +decoder : Decoder Order_ +decoder = + decode Order_ + |> optional "id" (Decode.nullable Decode.int) Nothing + |> optional "petId" (Decode.nullable Decode.int) Nothing + |> optional "quantity" (Decode.nullable Decode.int) Nothing + |> optional "shipDate" (Decode.nullable DateTime.decoder) Nothing + |> optional "status" (Decode.nullable statusDecoder) Nothing + |> optional "complete" (Decode.nullable Decode.bool) (Just False) + + +encoder : Order_ -> Encode.Value +encoder model = + Encode.object + [ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) ) + , ( "petId", Maybe.withDefault Encode.null (Maybe.map Encode.int model.petId) ) + , ( "quantity", Maybe.withDefault Encode.null (Maybe.map Encode.int model.quantity) ) + , ( "shipDate", Maybe.withDefault Encode.null (Maybe.map DateTime.encoder model.shipDate) ) + , ( "status", Maybe.withDefault Encode.null (Maybe.map statusEncoder model.status) ) + , ( "complete", Maybe.withDefault Encode.null (Maybe.map Encode.bool model.complete) ) + ] + + +statusDecoder : Decoder Status +statusDecoder = + Decode.string + |> Decode.andThen + (\str -> + case str of + "placed" -> + Decode.succeed Placed + + "approved" -> + Decode.succeed Approved + + "delivered" -> + Decode.succeed Delivered + + other -> + Decode.fail <| "Unknown type: " ++ other + ) + + +statusEncoder : Status -> Encode.Value +statusEncoder model = + case model of + Placed -> + Encode.string "placed" + + Approved -> + Encode.string "approved" + + Delivered -> + Encode.string "delivered" diff --git a/samples/client/petstore/elm-0.18/src/Data/Pet.elm b/samples/client/petstore/elm-0.18/src/Data/Pet.elm new file mode 100644 index 00000000000..752126f0293 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Data/Pet.elm @@ -0,0 +1,93 @@ +{- + OpenAPI Petstore + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + + NOTE: This file is auto generated by the openapi-generator. + https://github.com/openapitools/openapi-generator.git + Do not edit this file manually. +-} + + +module Data.Pet exposing (Pet, Status(..), decoder, encoder) + +import Data.Category as Category exposing (Category) +import Data.Tag as Tag exposing (Tag) +import Json.Decode as Decode exposing (Decoder) +import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Encode as Encode + + +{-| A pet for sale in the pet store +-} +type alias Pet = + { id : Maybe Int + , category : Maybe Category + , name : String + , photoUrls : List String + , tags : Maybe (List Tag) + , status : Maybe Status + } + + +type Status + = Available + | Pending + | Sold + + +decoder : Decoder Pet +decoder = + decode Pet + |> optional "id" (Decode.nullable Decode.int) Nothing + |> optional "category" (Decode.nullable Category.decoder) Nothing + |> required "name" Decode.string + |> required "photoUrls" (Decode.list Decode.string) + |> optional "tags" (Decode.nullable (Decode.list Tag.decoder)) Nothing + |> optional "status" (Decode.nullable statusDecoder) Nothing + + +encoder : Pet -> Encode.Value +encoder model = + Encode.object + [ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) ) + , ( "category", Maybe.withDefault Encode.null (Maybe.map Category.encoder model.category) ) + , ( "name", Encode.string model.name ) + , ( "photoUrls", (Encode.list << List.map Encode.string) model.photoUrls ) + , ( "tags", Maybe.withDefault Encode.null (Maybe.map (Encode.list << List.map Tag.encoder) model.tags) ) + , ( "status", Maybe.withDefault Encode.null (Maybe.map statusEncoder model.status) ) + ] + + +statusDecoder : Decoder Status +statusDecoder = + Decode.string + |> Decode.andThen + (\str -> + case str of + "available" -> + Decode.succeed Available + + "pending" -> + Decode.succeed Pending + + "sold" -> + Decode.succeed Sold + + other -> + Decode.fail <| "Unknown type: " ++ other + ) + + +statusEncoder : Status -> Encode.Value +statusEncoder model = + case model of + Available -> + Encode.string "available" + + Pending -> + Encode.string "pending" + + Sold -> + Encode.string "sold" diff --git a/samples/client/petstore/elm-0.18/src/Data/Tag.elm b/samples/client/petstore/elm-0.18/src/Data/Tag.elm new file mode 100644 index 00000000000..906e6f7286f --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Data/Tag.elm @@ -0,0 +1,40 @@ +{- + OpenAPI Petstore + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + + NOTE: This file is auto generated by the openapi-generator. + https://github.com/openapitools/openapi-generator.git + Do not edit this file manually. +-} + + +module Data.Tag exposing (Tag, decoder, encoder) + +import Json.Decode as Decode exposing (Decoder) +import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Encode as Encode + + +{-| A tag for a pet +-} +type alias Tag = + { id : Maybe Int + , name : Maybe String + } + + +decoder : Decoder Tag +decoder = + decode Tag + |> optional "id" (Decode.nullable Decode.int) Nothing + |> optional "name" (Decode.nullable Decode.string) Nothing + + +encoder : Tag -> Encode.Value +encoder model = + Encode.object + [ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) ) + , ( "name", Maybe.withDefault Encode.null (Maybe.map Encode.string model.name) ) + ] diff --git a/samples/client/petstore/elm-0.18/src/Data/User.elm b/samples/client/petstore/elm-0.18/src/Data/User.elm new file mode 100644 index 00000000000..1d8b44b4b96 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Data/User.elm @@ -0,0 +1,58 @@ +{- + OpenAPI Petstore + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + + NOTE: This file is auto generated by the openapi-generator. + https://github.com/openapitools/openapi-generator.git + Do not edit this file manually. +-} + + +module Data.User exposing (User, decoder, encoder) + +import Json.Decode as Decode exposing (Decoder) +import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Encode as Encode + + +{-| A User who is purchasing from the pet store +-} +type alias User = + { id : Maybe Int + , username : Maybe String + , firstName : Maybe String + , lastName : Maybe String + , email : Maybe String + , password : Maybe String + , phone : Maybe String + , userStatus : Maybe Int + } + + +decoder : Decoder User +decoder = + decode User + |> optional "id" (Decode.nullable Decode.int) Nothing + |> optional "username" (Decode.nullable Decode.string) Nothing + |> optional "firstName" (Decode.nullable Decode.string) Nothing + |> optional "lastName" (Decode.nullable Decode.string) Nothing + |> optional "email" (Decode.nullable Decode.string) Nothing + |> optional "password" (Decode.nullable Decode.string) Nothing + |> optional "phone" (Decode.nullable Decode.string) Nothing + |> optional "userStatus" (Decode.nullable Decode.int) Nothing + + +encoder : User -> Encode.Value +encoder model = + Encode.object + [ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) ) + , ( "username", Maybe.withDefault Encode.null (Maybe.map Encode.string model.username) ) + , ( "firstName", Maybe.withDefault Encode.null (Maybe.map Encode.string model.firstName) ) + , ( "lastName", Maybe.withDefault Encode.null (Maybe.map Encode.string model.lastName) ) + , ( "email", Maybe.withDefault Encode.null (Maybe.map Encode.string model.email) ) + , ( "password", Maybe.withDefault Encode.null (Maybe.map Encode.string model.password) ) + , ( "phone", Maybe.withDefault Encode.null (Maybe.map Encode.string model.phone) ) + , ( "userStatus", Maybe.withDefault Encode.null (Maybe.map Encode.int model.userStatus) ) + ] diff --git a/samples/client/petstore/elm-0.18/src/DateOnly.elm b/samples/client/petstore/elm-0.18/src/DateOnly.elm new file mode 100644 index 00000000000..29abf6757ef --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/DateOnly.elm @@ -0,0 +1,37 @@ +module DateOnly exposing (DateOnly, decoder, encoder, toString) + +import Date +import Date.Extra exposing (fromIsoString, toFormattedString) +import Json.Decode as Decode exposing (Decoder) +import Json.Encode as Encode +import Result + + +type alias DateOnly = + Date.Date + + +decoder : Decoder DateOnly +decoder = + Decode.string + |> Decode.andThen decodeIsoString + + +encoder : DateOnly -> Encode.Value +encoder = + Encode.string << toString + + +decodeIsoString : String -> Decoder DateOnly +decodeIsoString str = + case fromIsoString str of + Result.Ok date -> + Decode.succeed date + + Result.Err msg -> + Decode.fail msg + + +toString : DateOnly -> String +toString = + toFormattedString "yyyy-MM-dd" diff --git a/samples/client/petstore/elm-0.18/src/DateTime.elm b/samples/client/petstore/elm-0.18/src/DateTime.elm new file mode 100644 index 00000000000..cc688c54b87 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/DateTime.elm @@ -0,0 +1,37 @@ +module DateTime exposing (DateTime, decoder, encoder, toString) + +import Date +import Date.Extra exposing (fromIsoString, toIsoString) +import Json.Decode as Decode exposing (Decoder) +import Json.Encode as Encode +import Result + + +type alias DateTime = + Date.Date + + +decoder : Decoder DateTime +decoder = + Decode.string + |> Decode.andThen decodeIsoString + + +encoder : DateTime -> Encode.Value +encoder = + Encode.string << toString + + +decodeIsoString : String -> Decoder DateTime +decodeIsoString str = + case fromIsoString str of + Result.Ok date -> + Decode.succeed date + + Result.Err msg -> + Decode.fail msg + + +toString : DateTime -> String +toString = + toIsoString diff --git a/samples/client/petstore/elm-0.18/src/Main.elm b/samples/client/petstore/elm-0.18/src/Main.elm new file mode 100644 index 00000000000..23274d541c1 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Main.elm @@ -0,0 +1,60 @@ +module Main exposing (main) + +import Html exposing (Html) + + +main : Program Never Model Msg +main = + Html.program + { init = init + , view = view + , update = update + , subscriptions = subscriptions + } + + + +-- MODEL + + +type alias Model = + { value : Int + } + + +init : ( Model, Cmd Msg ) +init = + ( Model 0, Cmd.none ) + + + +-- UPDATE + + +type Msg + = NoOp + + +update : Msg -> Model -> ( Model, Cmd Msg ) +update msg model = + case msg of + NoOp -> + ( model, Cmd.none ) + + + +-- SUBSCRIPTIONS + + +subscriptions : Model -> Sub Msg +subscriptions _ = + Sub.none + + + +-- VIEW + + +view : Model -> Html Msg +view _ = + Html.text "main" diff --git a/samples/client/petstore/elm-0.18/src/Request/Pet.elm b/samples/client/petstore/elm-0.18/src/Request/Pet.elm new file mode 100644 index 00000000000..24ddb56fbb3 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Request/Pet.elm @@ -0,0 +1,134 @@ +{- + OpenAPI Petstore + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + + NOTE: This file is auto generated by the openapi-generator. + https://github.com/openapitools/openapi-generator.git + Do not edit this file manually. +-} + + +module Request.Pet exposing (addPet, deletePet, findPetsByStatus, findPetsByTags, getPetById, updatePet, updatePetWithForm, uploadFile) + +import Data.ApiResponse as ApiResponse exposing (ApiResponse) +import Data.Pet as Pet exposing (Pet) +import Dict +import Http +import Json.Decode as Decode + + +basePath : String +basePath = + "http://petstore.swagger.io/v2" + + +addPet : Pet -> Http.Request () +addPet model = + { method = "POST" + , url = basePath ++ "/pet" + , headers = [] + , body = Http.jsonBody <| Pet.encoder model + , expect = Http.expectStringResponse (\_ -> Ok ()) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +deletePet : Int -> Http.Request () +deletePet petId = + { method = "DELETE" + , url = basePath ++ "/pet/" ++ toString petId + , headers = [] + , body = Http.emptyBody + , expect = Http.expectStringResponse (\_ -> Ok ()) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +{-| Multiple status values can be provided with comma separated strings +-} +findPetsByStatus : Http.Request (List Pet) +findPetsByStatus = + { method = "GET" + , url = basePath ++ "/pet/findByStatus" + , headers = [] + , body = Http.emptyBody + , expect = Http.expectJson (Decode.list Pet.decoder) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +{-| Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. +-} +findPetsByTags : Http.Request (List Pet) +findPetsByTags = + { method = "GET" + , url = basePath ++ "/pet/findByTags" + , headers = [] + , body = Http.emptyBody + , expect = Http.expectJson (Decode.list Pet.decoder) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +{-| Returns a single pet +-} +getPetById : Int -> Http.Request Pet +getPetById petId = + { method = "GET" + , url = basePath ++ "/pet/" ++ toString petId + , headers = [] + , body = Http.emptyBody + , expect = Http.expectJson Pet.decoder + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +updatePet : Pet -> Http.Request () +updatePet model = + { method = "PUT" + , url = basePath ++ "/pet" + , headers = [] + , body = Http.jsonBody <| Pet.encoder model + , expect = Http.expectStringResponse (\_ -> Ok ()) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +updatePetWithForm : Int -> Http.Request () +updatePetWithForm petId = + { method = "POST" + , url = basePath ++ "/pet/" ++ toString petId + , headers = [] + , body = Http.emptyBody + , expect = Http.expectStringResponse (\_ -> Ok ()) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +uploadFile : Int -> Http.Request ApiResponse +uploadFile petId = + { method = "POST" + , url = basePath ++ "/pet/" ++ toString petId ++ "/uploadImage" + , headers = [] + , body = Http.emptyBody + , expect = Http.expectJson ApiResponse.decoder + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request diff --git a/samples/client/petstore/elm-0.18/src/Request/Store.elm b/samples/client/petstore/elm-0.18/src/Request/Store.elm new file mode 100644 index 00000000000..6786fbb2518 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Request/Store.elm @@ -0,0 +1,81 @@ +{- + OpenAPI Petstore + This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + + OpenAPI spec version: 1.0.0 + + NOTE: This file is auto generated by the openapi-generator. + https://github.com/openapitools/openapi-generator.git + Do not edit this file manually. +-} + + +module Request.Store exposing (deleteOrder, getInventory, getOrderById, placeOrder) + +import Data.Order_ as Order_ exposing (Order_) +import Dict +import Http +import Json.Decode as Decode + + +basePath : String +basePath = + "http://petstore.swagger.io/v2" + + +{-| For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors +-} +deleteOrder : String -> Http.Request () +deleteOrder orderId = + { method = "DELETE" + , url = basePath ++ "/store/order/" ++ orderId + , headers = [] + , body = Http.emptyBody + , expect = Http.expectStringResponse (\_ -> Ok ()) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +{-| Returns a map of status codes to quantities +-} +getInventory : Http.Request (Dict.Dict String Int) +getInventory = + { method = "GET" + , url = basePath ++ "/store/inventory" + , headers = [] + , body = Http.emptyBody + , expect = Http.expectJson (Decode.dict Decode.int) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +{-| For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions +-} +getOrderById : Int -> Http.Request Order_ +getOrderById orderId = + { method = "GET" + , url = basePath ++ "/store/order/" ++ toString orderId + , headers = [] + , body = Http.emptyBody + , expect = Http.expectJson Order_.decoder + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +placeOrder : Order_ -> Http.Request Order_ +placeOrder model = + { method = "POST" + , url = basePath ++ "/store/order" + , headers = [] + , body = Http.jsonBody <| Order_.encoder model + , expect = Http.expectJson Order_.decoder + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request diff --git a/samples/client/petstore/elm-0.18/src/Request/User.elm b/samples/client/petstore/elm-0.18/src/Request/User.elm new file mode 100644 index 00000000000..b466fa6c516 --- /dev/null +++ b/samples/client/petstore/elm-0.18/src/Request/User.elm @@ -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. + + OpenAPI spec version: 1.0.0 + + NOTE: This file is auto generated by the openapi-generator. + https://github.com/openapitools/openapi-generator.git + Do not edit this file manually. +-} + + +module Request.User exposing (createUser, createUsersWithArrayInput, createUsersWithListInput, deleteUser, getUserByName, loginUser, logoutUser, updateUser) + +import Data.User as User exposing (User) +import Dict +import Http +import Json.Decode as Decode + + +basePath : String +basePath = + "http://petstore.swagger.io/v2" + + +{-| This can only be done by the logged in user. +-} +createUser : User -> Http.Request () +createUser model = + { method = "POST" + , url = basePath ++ "/user" + , headers = [] + , body = Http.jsonBody <| User.encoder model + , expect = Http.expectStringResponse (\_ -> Ok ()) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +createUsersWithArrayInput : User -> Http.Request () +createUsersWithArrayInput model = + { method = "POST" + , url = basePath ++ "/user/createWithArray" + , headers = [] + , body = Http.jsonBody <| User.encoder model + , expect = Http.expectStringResponse (\_ -> Ok ()) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +createUsersWithListInput : User -> Http.Request () +createUsersWithListInput model = + { method = "POST" + , url = basePath ++ "/user/createWithList" + , headers = [] + , body = Http.jsonBody <| User.encoder model + , expect = Http.expectStringResponse (\_ -> Ok ()) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +{-| This can only be done by the logged in user. +-} +deleteUser : String -> Http.Request () +deleteUser username = + { method = "DELETE" + , url = basePath ++ "/user/" ++ username + , headers = [] + , body = Http.emptyBody + , expect = Http.expectStringResponse (\_ -> Ok ()) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +getUserByName : String -> Http.Request User +getUserByName username = + { method = "GET" + , url = basePath ++ "/user/" ++ username + , headers = [] + , body = Http.emptyBody + , expect = Http.expectJson User.decoder + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +loginUser : Http.Request String +loginUser = + { method = "GET" + , url = basePath ++ "/user/login" + , headers = [] + , body = Http.emptyBody + , expect = Http.expectJson Decode.string + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +logoutUser : Http.Request () +logoutUser = + { method = "GET" + , url = basePath ++ "/user/logout" + , headers = [] + , body = Http.emptyBody + , expect = Http.expectStringResponse (\_ -> Ok ()) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request + + +{-| This can only be done by the logged in user. +-} +updateUser : String -> User -> Http.Request () +updateUser username model = + { method = "PUT" + , url = basePath ++ "/user/" ++ username + , headers = [] + , body = Http.jsonBody <| User.encoder model + , expect = Http.expectStringResponse (\_ -> Ok ()) + , timeout = Just 30000 + , withCredentials = False + } + |> Http.request diff --git a/samples/client/petstore/elm/.openapi-generator/VERSION b/samples/client/petstore/elm/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/client/petstore/elm/.openapi-generator/VERSION +++ b/samples/client/petstore/elm/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/elm/elm-compile-test b/samples/client/petstore/elm/elm-compile-test index c2403c5fd4e..55507cfcad6 100755 --- a/samples/client/petstore/elm/elm-compile-test +++ b/samples/client/petstore/elm/elm-compile-test @@ -4,7 +4,7 @@ for ELM in `find src -name "*.elm"` do echo "Compiling $ELM" - elm make $ELM --output /dev/null --yes + elm make $ELM --output /dev/null rc=$? if [[ $rc != 0 ]] then diff --git a/samples/client/petstore/elm/elm.json b/samples/client/petstore/elm/elm.json new file mode 100644 index 00000000000..6028a740feb --- /dev/null +++ b/samples/client/petstore/elm/elm.json @@ -0,0 +1,28 @@ +{ + "type": "application", + "source-directories": [ + "src" + ], + "elm-version": "0.19.0", + "dependencies": { + "direct": { + "NoRedInk/elm-json-decode-pipeline": "1.0.0", + "elm/browser": "1.0.0", + "elm/core": "1.0.0", + "elm/html": "1.0.0", + "elm/http": "1.0.0", + "elm/json": "1.0.0", + "elm/time": "1.0.0", + "rtfeldman/elm-iso8601-date-strings": "1.0.0" + }, + "indirect": { + "elm/parser": "1.0.0", + "elm/url": "1.0.0", + "elm/virtual-dom": "1.0.0" + } + }, + "test-dependencies": { + "direct": {}, + "indirect": {} + } +} diff --git a/samples/client/petstore/elm/src/Byte.elm b/samples/client/petstore/elm/src/Byte.elm index 6974f1ed59b..6c80664aba1 100644 --- a/samples/client/petstore/elm/src/Byte.elm +++ b/samples/client/petstore/elm/src/Byte.elm @@ -1,4 +1,4 @@ -module Byte exposing (Byte, byteDecoder, byteEncoder) +module Byte exposing (Byte, decoder, encoder) import Json.Decode as Decode exposing (Decoder) import Json.Encode as Encode @@ -8,12 +8,11 @@ type alias Byte = String -byteDecoder : Decoder Byte -byteDecoder = +decoder : Decoder Byte +decoder = Decode.string -byteEncoder : Byte -> Encode.Value -byteEncoder model = +encoder : Byte -> Encode.Value +encoder model = Encode.string model - diff --git a/samples/client/petstore/elm/src/Data/ApiResponse.elm b/samples/client/petstore/elm/src/Data/ApiResponse.elm index ce052917546..2227c89ad88 100644 --- a/samples/client/petstore/elm/src/Data/ApiResponse.elm +++ b/samples/client/petstore/elm/src/Data/ApiResponse.elm @@ -10,12 +10,11 @@ -} -module Data.ApiResponse exposing (ApiResponse, apiResponseDecoder, apiResponseEncoder) +module Data.ApiResponse exposing (ApiResponse, decoder, encoder) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode -import Maybe exposing (map, withDefault) {-| Describes the result of uploading an image resource @@ -27,21 +26,18 @@ type alias ApiResponse = } -apiResponseDecoder : Decoder ApiResponse -apiResponseDecoder = - decode ApiResponse +decoder : Decoder ApiResponse +decoder = + Decode.succeed ApiResponse |> optional "code" (Decode.nullable Decode.int) Nothing |> optional "type" (Decode.nullable Decode.string) Nothing |> optional "message" (Decode.nullable Decode.string) Nothing - -apiResponseEncoder : ApiResponse -> Encode.Value -apiResponseEncoder model = +encoder : ApiResponse -> Encode.Value +encoder model = Encode.object - [ ( "code", withDefault Encode.null (map Encode.int model.code) ) - , ( "type", withDefault Encode.null (map Encode.string model.type_) ) - , ( "message", withDefault Encode.null (map Encode.string model.message) ) + [ ( "code", Maybe.withDefault Encode.null (Maybe.map Encode.int model.code) ) + , ( "type", Maybe.withDefault Encode.null (Maybe.map Encode.string model.type_) ) + , ( "message", Maybe.withDefault Encode.null (Maybe.map Encode.string model.message) ) ] - - diff --git a/samples/client/petstore/elm/src/Data/Category.elm b/samples/client/petstore/elm/src/Data/Category.elm index 8cac70ea451..b927627fe70 100644 --- a/samples/client/petstore/elm/src/Data/Category.elm +++ b/samples/client/petstore/elm/src/Data/Category.elm @@ -10,12 +10,11 @@ -} -module Data.Category exposing (Category, categoryDecoder, categoryEncoder) +module Data.Category exposing (Category, decoder, encoder) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode -import Maybe exposing (map, withDefault) {-| A category for a pet @@ -26,19 +25,16 @@ type alias Category = } -categoryDecoder : Decoder Category -categoryDecoder = - decode Category +decoder : Decoder Category +decoder = + Decode.succeed Category |> optional "id" (Decode.nullable Decode.int) Nothing |> optional "name" (Decode.nullable Decode.string) Nothing - -categoryEncoder : Category -> Encode.Value -categoryEncoder model = +encoder : Category -> Encode.Value +encoder model = Encode.object - [ ( "id", withDefault Encode.null (map Encode.int model.id) ) - , ( "name", withDefault Encode.null (map Encode.string model.name) ) + [ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) ) + , ( "name", Maybe.withDefault Encode.null (Maybe.map Encode.string model.name) ) ] - - diff --git a/samples/client/petstore/elm/src/Data/Order_.elm b/samples/client/petstore/elm/src/Data/Order_.elm index c343084f39d..45d086df717 100644 --- a/samples/client/petstore/elm/src/Data/Order_.elm +++ b/samples/client/petstore/elm/src/Data/Order_.elm @@ -10,13 +10,12 @@ -} -module Data.Order_ exposing (Order_, Status(..), orderDecoder, orderEncoder) +module Data.Order_ exposing (Order_, Status(..), decoder, encoder) -import DateTime exposing (DateTime, dateTimeDecoder, dateTimeEncoder) +import DateTime exposing (DateTime) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode -import Maybe exposing (map, withDefault) {-| An order for a pets from the pet store @@ -37,49 +36,47 @@ type Status | Delivered - -orderDecoder : Decoder Order_ -orderDecoder = - decode Order_ +decoder : Decoder Order_ +decoder = + Decode.succeed Order_ |> optional "id" (Decode.nullable Decode.int) Nothing |> optional "petId" (Decode.nullable Decode.int) Nothing |> optional "quantity" (Decode.nullable Decode.int) Nothing - |> optional "shipDate" (Decode.nullable dateTimeDecoder) Nothing + |> optional "shipDate" (Decode.nullable DateTime.decoder) Nothing |> optional "status" (Decode.nullable statusDecoder) Nothing |> optional "complete" (Decode.nullable Decode.bool) (Just False) - -orderEncoder : Order_ -> Encode.Value -orderEncoder model = +encoder : Order_ -> Encode.Value +encoder model = Encode.object - [ ( "id", withDefault Encode.null (map Encode.int model.id) ) - , ( "petId", withDefault Encode.null (map Encode.int model.petId) ) - , ( "quantity", withDefault Encode.null (map Encode.int model.quantity) ) - , ( "shipDate", withDefault Encode.null (map dateTimeEncoder model.shipDate) ) - , ( "status", withDefault Encode.null (map statusEncoder model.status) ) - , ( "complete", withDefault Encode.null (map Encode.bool model.complete) ) + [ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) ) + , ( "petId", Maybe.withDefault Encode.null (Maybe.map Encode.int model.petId) ) + , ( "quantity", Maybe.withDefault Encode.null (Maybe.map Encode.int model.quantity) ) + , ( "shipDate", Maybe.withDefault Encode.null (Maybe.map DateTime.encoder model.shipDate) ) + , ( "status", Maybe.withDefault Encode.null (Maybe.map statusEncoder model.status) ) + , ( "complete", Maybe.withDefault Encode.null (Maybe.map Encode.bool model.complete) ) ] - statusDecoder : Decoder Status statusDecoder = Decode.string - |> Decode.andThen (\str -> - case str of - "placed" -> - Decode.succeed Placed + |> Decode.andThen + (\str -> + case str of + "placed" -> + Decode.succeed Placed - "approved" -> - Decode.succeed Approved + "approved" -> + Decode.succeed Approved - "delivered" -> - Decode.succeed Delivered + "delivered" -> + Decode.succeed Delivered - other -> - Decode.fail <| "Unknown type: " ++ other - ) + other -> + Decode.fail <| "Unknown type: " ++ other + ) statusEncoder : Status -> Encode.Value @@ -93,6 +90,3 @@ statusEncoder model = Delivered -> Encode.string "delivered" - - - diff --git a/samples/client/petstore/elm/src/Data/Pet.elm b/samples/client/petstore/elm/src/Data/Pet.elm index 7f15ea44168..ed15ad08d2b 100644 --- a/samples/client/petstore/elm/src/Data/Pet.elm +++ b/samples/client/petstore/elm/src/Data/Pet.elm @@ -10,14 +10,13 @@ -} -module Data.Pet exposing (Pet, Status(..), petDecoder, petEncoder) +module Data.Pet exposing (Pet, Status(..), decoder, encoder) -import Data.Category exposing (Category, categoryDecoder, categoryEncoder) -import Data.Tag exposing (Tag, tagDecoder, tagEncoder) +import Data.Category as Category exposing (Category) +import Data.Tag as Tag exposing (Tag) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode -import Maybe exposing (map, withDefault) {-| A pet for sale in the pet store @@ -38,49 +37,47 @@ type Status | Sold - -petDecoder : Decoder Pet -petDecoder = - decode Pet +decoder : Decoder Pet +decoder = + Decode.succeed Pet |> optional "id" (Decode.nullable Decode.int) Nothing - |> optional "category" (Decode.nullable categoryDecoder) Nothing + |> optional "category" (Decode.nullable Category.decoder) Nothing |> required "name" Decode.string |> required "photoUrls" (Decode.list Decode.string) - |> optional "tags" (Decode.nullable (Decode.list tagDecoder)) Nothing + |> optional "tags" (Decode.nullable (Decode.list Tag.decoder)) Nothing |> optional "status" (Decode.nullable statusDecoder) Nothing - -petEncoder : Pet -> Encode.Value -petEncoder model = +encoder : Pet -> Encode.Value +encoder model = Encode.object - [ ( "id", withDefault Encode.null (map Encode.int model.id) ) - , ( "category", withDefault Encode.null (map categoryEncoder model.category) ) + [ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) ) + , ( "category", Maybe.withDefault Encode.null (Maybe.map Category.encoder model.category) ) , ( "name", Encode.string model.name ) - , ( "photoUrls", (Encode.list << List.map Encode.string) model.photoUrls ) - , ( "tags", withDefault Encode.null (map (Encode.list << List.map tagEncoder) model.tags) ) - , ( "status", withDefault Encode.null (map statusEncoder model.status) ) + , ( "photoUrls", Encode.list Encode.string model.photoUrls ) + , ( "tags", Maybe.withDefault Encode.null (Maybe.map (Encode.list Tag.encoder) model.tags) ) + , ( "status", Maybe.withDefault Encode.null (Maybe.map statusEncoder model.status) ) ] - statusDecoder : Decoder Status statusDecoder = Decode.string - |> Decode.andThen (\str -> - case str of - "available" -> - Decode.succeed Available + |> Decode.andThen + (\str -> + case str of + "available" -> + Decode.succeed Available - "pending" -> - Decode.succeed Pending + "pending" -> + Decode.succeed Pending - "sold" -> - Decode.succeed Sold + "sold" -> + Decode.succeed Sold - other -> - Decode.fail <| "Unknown type: " ++ other - ) + other -> + Decode.fail <| "Unknown type: " ++ other + ) statusEncoder : Status -> Encode.Value @@ -94,6 +91,3 @@ statusEncoder model = Sold -> Encode.string "sold" - - - diff --git a/samples/client/petstore/elm/src/Data/Tag.elm b/samples/client/petstore/elm/src/Data/Tag.elm index 74f6de18287..c514abe1429 100644 --- a/samples/client/petstore/elm/src/Data/Tag.elm +++ b/samples/client/petstore/elm/src/Data/Tag.elm @@ -10,12 +10,11 @@ -} -module Data.Tag exposing (Tag, tagDecoder, tagEncoder) +module Data.Tag exposing (Tag, decoder, encoder) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode -import Maybe exposing (map, withDefault) {-| A tag for a pet @@ -26,19 +25,16 @@ type alias Tag = } -tagDecoder : Decoder Tag -tagDecoder = - decode Tag +decoder : Decoder Tag +decoder = + Decode.succeed Tag |> optional "id" (Decode.nullable Decode.int) Nothing |> optional "name" (Decode.nullable Decode.string) Nothing - -tagEncoder : Tag -> Encode.Value -tagEncoder model = +encoder : Tag -> Encode.Value +encoder model = Encode.object - [ ( "id", withDefault Encode.null (map Encode.int model.id) ) - , ( "name", withDefault Encode.null (map Encode.string model.name) ) + [ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) ) + , ( "name", Maybe.withDefault Encode.null (Maybe.map Encode.string model.name) ) ] - - diff --git a/samples/client/petstore/elm/src/Data/User.elm b/samples/client/petstore/elm/src/Data/User.elm index 851f3a51022..a6213937f52 100644 --- a/samples/client/petstore/elm/src/Data/User.elm +++ b/samples/client/petstore/elm/src/Data/User.elm @@ -10,12 +10,11 @@ -} -module Data.User exposing (User, userDecoder, userEncoder) +module Data.User exposing (User, decoder, encoder) import Json.Decode as Decode exposing (Decoder) -import Json.Decode.Pipeline exposing (decode, optional, required) +import Json.Decode.Pipeline exposing (optional, required) import Json.Encode as Encode -import Maybe exposing (map, withDefault) {-| A User who is purchasing from the pet store @@ -32,9 +31,9 @@ type alias User = } -userDecoder : Decoder User -userDecoder = - decode User +decoder : Decoder User +decoder = + Decode.succeed User |> optional "id" (Decode.nullable Decode.int) Nothing |> optional "username" (Decode.nullable Decode.string) Nothing |> optional "firstName" (Decode.nullable Decode.string) Nothing @@ -45,18 +44,15 @@ userDecoder = |> optional "userStatus" (Decode.nullable Decode.int) Nothing - -userEncoder : User -> Encode.Value -userEncoder model = +encoder : User -> Encode.Value +encoder model = Encode.object - [ ( "id", withDefault Encode.null (map Encode.int model.id) ) - , ( "username", withDefault Encode.null (map Encode.string model.username) ) - , ( "firstName", withDefault Encode.null (map Encode.string model.firstName) ) - , ( "lastName", withDefault Encode.null (map Encode.string model.lastName) ) - , ( "email", withDefault Encode.null (map Encode.string model.email) ) - , ( "password", withDefault Encode.null (map Encode.string model.password) ) - , ( "phone", withDefault Encode.null (map Encode.string model.phone) ) - , ( "userStatus", withDefault Encode.null (map Encode.int model.userStatus) ) + [ ( "id", Maybe.withDefault Encode.null (Maybe.map Encode.int model.id) ) + , ( "username", Maybe.withDefault Encode.null (Maybe.map Encode.string model.username) ) + , ( "firstName", Maybe.withDefault Encode.null (Maybe.map Encode.string model.firstName) ) + , ( "lastName", Maybe.withDefault Encode.null (Maybe.map Encode.string model.lastName) ) + , ( "email", Maybe.withDefault Encode.null (Maybe.map Encode.string model.email) ) + , ( "password", Maybe.withDefault Encode.null (Maybe.map Encode.string model.password) ) + , ( "phone", Maybe.withDefault Encode.null (Maybe.map Encode.string model.phone) ) + , ( "userStatus", Maybe.withDefault Encode.null (Maybe.map Encode.int model.userStatus) ) ] - - diff --git a/samples/client/petstore/elm/src/DateOnly.elm b/samples/client/petstore/elm/src/DateOnly.elm index 59551c7aa71..acd6cd44eb9 100644 --- a/samples/client/petstore/elm/src/DateOnly.elm +++ b/samples/client/petstore/elm/src/DateOnly.elm @@ -1,32 +1,37 @@ -module DateOnly exposing (DateOnly, dateOnlyDecoder, dateOnlyEncoder) +module DateOnly exposing (DateOnly, decoder, encoder, toString) -import Date -import Date.Extra exposing (fromIsoString, toFormattedString) +import Iso8601 import Json.Decode as Decode exposing (Decoder) import Json.Encode as Encode import Result +import Time type alias DateOnly = - Date.Date + Time.Posix -dateOnlyDecoder : Decoder DateOnly -dateOnlyDecoder = +decoder : Decoder DateOnly +decoder = Decode.string |> Decode.andThen decodeIsoString -dateOnlyEncoder : DateOnly -> Encode.Value -dateOnlyEncoder model = - Encode.string <| toFormattedString "yyyy-MM-dd" model +encoder : DateOnly -> Encode.Value +encoder = + Encode.string << toString decodeIsoString : String -> Decoder DateOnly decodeIsoString str = - case fromIsoString str of - Result.Ok date -> - Decode.succeed date + case Iso8601.toTime (str ++ "T00:00:00.000Z") of + Result.Ok posix -> + Decode.succeed posix - Result.Err msg -> - Decode.fail msg + Result.Err _ -> + Decode.fail <| "Invalid date: " ++ str + + +toString : DateOnly -> String +toString = + String.left 10 << Iso8601.fromTime diff --git a/samples/client/petstore/elm/src/DateTime.elm b/samples/client/petstore/elm/src/DateTime.elm index d3638500a89..a560b4588b9 100644 --- a/samples/client/petstore/elm/src/DateTime.elm +++ b/samples/client/petstore/elm/src/DateTime.elm @@ -1,32 +1,37 @@ -module DateTime exposing (DateTime, dateTimeDecoder, dateTimeEncoder) +module DateTime exposing (DateTime, decoder, encoder, toString) -import Date -import Date.Extra exposing (fromIsoString, toIsoString) +import Iso8601 import Json.Decode as Decode exposing (Decoder) import Json.Encode as Encode import Result +import Time type alias DateTime = - Date.Date + Time.Posix -dateTimeDecoder : Decoder DateTime -dateTimeDecoder = +decoder : Decoder DateTime +decoder = Decode.string |> Decode.andThen decodeIsoString -dateTimeEncoder : DateTime -> Encode.Value -dateTimeEncoder model = - Encode.string <| toIsoString model +encoder : DateTime -> Encode.Value +encoder = + Encode.string << toString decodeIsoString : String -> Decoder DateTime decodeIsoString str = - case fromIsoString str of - Result.Ok date -> - Decode.succeed date + case Iso8601.toTime str of + Result.Ok posix -> + Decode.succeed posix - Result.Err msg -> - Decode.fail msg + Result.Err _ -> + Decode.fail <| "Invalid date: " ++ str + + +toString : DateTime -> String +toString = + Iso8601.fromTime diff --git a/samples/client/petstore/elm/src/Main.elm b/samples/client/petstore/elm/src/Main.elm index b0a2ce0b52c..7c9ddd056d3 100644 --- a/samples/client/petstore/elm/src/Main.elm +++ b/samples/client/petstore/elm/src/Main.elm @@ -1,43 +1,61 @@ -module Main exposing (..) +module Main exposing (main) -import Json.Decode as Decode -import Html exposing (Html, button, div, text) -import Html.Events exposing (onClick) -import Http +import Browser +import Html exposing (Html) -main : Program Never Model Msg +main : Program () Model Msg main = - Html.program + Browser.element { init = init , view = view , update = update , subscriptions = subscriptions } + + +-- MODEL + + type alias Model = - { status : Maybe Int + { value : Int } -init : (Model, Cmd Msg) -init = - ( Model Nothing, Cmd.none ) + +init : () -> ( Model, Cmd Msg ) +init _ = + ( Model 0, Cmd.none ) + + + +-- UPDATE + type Msg = NoOp -update : Msg -> Model -> (Model, Cmd Msg) + +update : Msg -> Model -> ( Model, Cmd Msg ) update msg model = case msg of NoOp -> ( model, Cmd.none ) -view : Model -> Html Msg -view model = - Html.text "main" + +-- SUBSCRIPTIONS subscriptions : Model -> Sub Msg -subscriptions model = +subscriptions _ = Sub.none + + + +-- VIEW + + +view : Model -> Html Msg +view _ = + Html.text "main" diff --git a/samples/client/petstore/elm/src/Request/Pet.elm b/samples/client/petstore/elm/src/Request/Pet.elm index 0a4b5c1769e..aa46bd8df69 100644 --- a/samples/client/petstore/elm/src/Request/Pet.elm +++ b/samples/client/petstore/elm/src/Request/Pet.elm @@ -12,8 +12,8 @@ module Request.Pet exposing (addPet, deletePet, findPetsByStatus, findPetsByTags, getPetById, updatePet, updatePetWithForm, uploadFile) -import Data.Pet exposing (Pet, petDecoder, petEncoder) -import Data.ApiResponse exposing (ApiResponse, apiResponseDecoder) +import Data.ApiResponse as ApiResponse exposing (ApiResponse) +import Data.Pet as Pet exposing (Pet) import Dict import Http import Json.Decode as Decode @@ -29,7 +29,7 @@ addPet model = { method = "POST" , url = basePath ++ "/pet" , headers = [] - , body = Http.jsonBody <| petEncoder model + , body = Http.jsonBody <| Pet.encoder model , expect = Http.expectStringResponse (\_ -> Ok ()) , timeout = Just 30000 , withCredentials = False @@ -40,7 +40,7 @@ addPet model = deletePet : Int -> Http.Request () deletePet petId = { method = "DELETE" - , url = basePath ++ "/pet/" ++ toString petId + , url = basePath ++ "/pet/" ++ String.fromInt petId , headers = [] , body = Http.emptyBody , expect = Http.expectStringResponse (\_ -> Ok ()) @@ -58,7 +58,7 @@ findPetsByStatus = , url = basePath ++ "/pet/findByStatus" , headers = [] , body = Http.emptyBody - , expect = Http.expectJson (Decode.list petDecoder) + , expect = Http.expectJson (Decode.list Pet.decoder) , timeout = Just 30000 , withCredentials = False } @@ -73,7 +73,7 @@ findPetsByTags = , url = basePath ++ "/pet/findByTags" , headers = [] , body = Http.emptyBody - , expect = Http.expectJson (Decode.list petDecoder) + , expect = Http.expectJson (Decode.list Pet.decoder) , timeout = Just 30000 , withCredentials = False } @@ -85,10 +85,10 @@ findPetsByTags = getPetById : Int -> Http.Request Pet getPetById petId = { method = "GET" - , url = basePath ++ "/pet/" ++ toString petId + , url = basePath ++ "/pet/" ++ String.fromInt petId , headers = [] , body = Http.emptyBody - , expect = Http.expectJson petDecoder + , expect = Http.expectJson Pet.decoder , timeout = Just 30000 , withCredentials = False } @@ -100,7 +100,7 @@ updatePet model = { method = "PUT" , url = basePath ++ "/pet" , headers = [] - , body = Http.jsonBody <| petEncoder model + , body = Http.jsonBody <| Pet.encoder model , expect = Http.expectStringResponse (\_ -> Ok ()) , timeout = Just 30000 , withCredentials = False @@ -111,7 +111,7 @@ updatePet model = updatePetWithForm : Int -> Http.Request () updatePetWithForm petId = { method = "POST" - , url = basePath ++ "/pet/" ++ toString petId + , url = basePath ++ "/pet/" ++ String.fromInt petId , headers = [] , body = Http.emptyBody , expect = Http.expectStringResponse (\_ -> Ok ()) @@ -124,10 +124,10 @@ updatePetWithForm petId = uploadFile : Int -> Http.Request ApiResponse uploadFile petId = { method = "POST" - , url = basePath ++ "/pet/" ++ toString petId ++ "/uploadImage" + , url = basePath ++ "/pet/" ++ String.fromInt petId ++ "/uploadImage" , headers = [] , body = Http.emptyBody - , expect = Http.expectJson apiResponseDecoder + , expect = Http.expectJson ApiResponse.decoder , timeout = Just 30000 , withCredentials = False } diff --git a/samples/client/petstore/elm/src/Request/Store.elm b/samples/client/petstore/elm/src/Request/Store.elm index 2e98105a2f4..d0192277a9b 100644 --- a/samples/client/petstore/elm/src/Request/Store.elm +++ b/samples/client/petstore/elm/src/Request/Store.elm @@ -12,7 +12,7 @@ module Request.Store exposing (deleteOrder, getInventory, getOrderById, placeOrder) -import Data.Order_ exposing (Order_, orderDecoder, orderEncoder) +import Data.Order_ as Order_ exposing (Order_) import Dict import Http import Json.Decode as Decode @@ -58,10 +58,10 @@ getInventory = getOrderById : Int -> Http.Request Order_ getOrderById orderId = { method = "GET" - , url = basePath ++ "/store/order/" ++ toString orderId + , url = basePath ++ "/store/order/" ++ String.fromInt orderId , headers = [] , body = Http.emptyBody - , expect = Http.expectJson orderDecoder + , expect = Http.expectJson Order_.decoder , timeout = Just 30000 , withCredentials = False } @@ -73,8 +73,8 @@ placeOrder model = { method = "POST" , url = basePath ++ "/store/order" , headers = [] - , body = Http.jsonBody <| orderEncoder model - , expect = Http.expectJson orderDecoder + , body = Http.jsonBody <| Order_.encoder model + , expect = Http.expectJson Order_.decoder , timeout = Just 30000 , withCredentials = False } diff --git a/samples/client/petstore/elm/src/Request/User.elm b/samples/client/petstore/elm/src/Request/User.elm index e6bbbb32ed5..b466fa6c516 100644 --- a/samples/client/petstore/elm/src/Request/User.elm +++ b/samples/client/petstore/elm/src/Request/User.elm @@ -12,7 +12,7 @@ module Request.User exposing (createUser, createUsersWithArrayInput, createUsersWithListInput, deleteUser, getUserByName, loginUser, logoutUser, updateUser) -import Data.User exposing (User, userDecoder, userEncoder) +import Data.User as User exposing (User) import Dict import Http import Json.Decode as Decode @@ -30,7 +30,7 @@ createUser model = { method = "POST" , url = basePath ++ "/user" , headers = [] - , body = Http.jsonBody <| userEncoder model + , body = Http.jsonBody <| User.encoder model , expect = Http.expectStringResponse (\_ -> Ok ()) , timeout = Just 30000 , withCredentials = False @@ -43,7 +43,7 @@ createUsersWithArrayInput model = { method = "POST" , url = basePath ++ "/user/createWithArray" , headers = [] - , body = Http.jsonBody <| userEncoder model + , body = Http.jsonBody <| User.encoder model , expect = Http.expectStringResponse (\_ -> Ok ()) , timeout = Just 30000 , withCredentials = False @@ -56,7 +56,7 @@ createUsersWithListInput model = { method = "POST" , url = basePath ++ "/user/createWithList" , headers = [] - , body = Http.jsonBody <| userEncoder model + , body = Http.jsonBody <| User.encoder model , expect = Http.expectStringResponse (\_ -> Ok ()) , timeout = Just 30000 , withCredentials = False @@ -85,7 +85,7 @@ getUserByName username = , url = basePath ++ "/user/" ++ username , headers = [] , body = Http.emptyBody - , expect = Http.expectJson userDecoder + , expect = Http.expectJson User.decoder , timeout = Just 30000 , withCredentials = False } @@ -125,7 +125,7 @@ updateUser username model = { method = "PUT" , url = basePath ++ "/user/" ++ username , headers = [] - , body = Http.jsonBody <| userEncoder model + , body = Http.jsonBody <| User.encoder model , expect = Http.expectStringResponse (\_ -> Ok ()) , timeout = Just 30000 , withCredentials = False diff --git a/samples/client/petstore/go/go-petstore-withXml/.openapi-generator/VERSION b/samples/client/petstore/go/go-petstore-withXml/.openapi-generator/VERSION index 4395ff59232..f4cb97d56ce 100644 --- a/samples/client/petstore/go/go-petstore-withXml/.openapi-generator/VERSION +++ b/samples/client/petstore/go/go-petstore-withXml/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/go/go-petstore-withXml/README.md b/samples/client/petstore/go/go-petstore-withXml/README.md index 79673db9e37..610174ac2a8 100644 --- a/samples/client/petstore/go/go-petstore-withXml/README.md +++ b/samples/client/petstore/go/go-petstore-withXml/README.md @@ -30,7 +30,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**TestSpecialTags**](docs/AnotherFakeApi.md#testspecialtags) | **Patch** /another-fake/dummy | To test special tags +*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 | diff --git a/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml b/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml index 1843427a4fc..4009731809f 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml +++ b/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml @@ -954,8 +954,8 @@ paths: - fake /another-fake/dummy: patch: - description: To test special tags - operationId: test_special_tags + description: To test special tags and operation ID starting with number + operationId: 123_test_@#$%_special_tags requestBody: content: application/json: @@ -1487,7 +1487,9 @@ components: type: boolean type: object indirect_map: - $ref: '#/components/schemas/StringBooleanMap' + additionalProperties: + type: boolean + type: object type: object Tag: example: 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 947356f0b8c..2367690cc0e 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 @@ -27,19 +27,19 @@ type AnotherFakeApiService service /* AnotherFakeApiService To test special tags -To test special tags +To test special tags and operation ID starting with number * @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). * @param client client model @return Client */ -func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, client Client) (Client, *http.Response, error) { +func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, client Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Client + localVarReturnValue Client ) // create path and map variables @@ -86,7 +86,7 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, client Clie if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -94,18 +94,18 @@ func (a *AnotherFakeApiService) TestSpecialTags(ctx context.Context, client Clie if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v Client - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } 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 5802c0ab477..46fd09eecf3 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_fake.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_fake.go @@ -37,17 +37,17 @@ Test serialization of outer boolean types */ type FakeOuterBooleanSerializeOpts struct { - Body optional.Bool + Body optional.Bool } func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue bool + localVarReturnValue bool ) // create path and map variables @@ -97,7 +97,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -105,18 +105,18 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v bool - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -134,17 +134,17 @@ Test serialization of object with outer number type */ type FakeOuterCompositeSerializeOpts struct { - OuterComposite optional.Interface + OuterComposite optional.Interface } func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue OuterComposite + localVarReturnValue OuterComposite ) // create path and map variables @@ -198,7 +198,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -206,18 +206,18 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v OuterComposite - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -235,17 +235,17 @@ Test serialization of outer number types */ type FakeOuterNumberSerializeOpts struct { - Body optional.Float32 + Body optional.Float32 } func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue float32 + localVarReturnValue float32 ) // create path and map variables @@ -295,7 +295,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -303,18 +303,18 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v float32 - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -332,17 +332,17 @@ Test serialization of outer string types */ type FakeOuterStringSerializeOpts struct { - Body optional.String + Body optional.String } func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue string + localVarReturnValue string ) // create path and map variables @@ -392,7 +392,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -400,18 +400,18 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -427,7 +427,7 @@ For this test, the body for this request much reference a schema named `Fil */ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaTestClass FileSchemaTestClass) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -478,7 +478,7 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaT if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -495,7 +495,7 @@ FakeApiService */ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, user User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -547,7 +547,7 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query stri if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -565,12 +565,12 @@ To test \"client\" model */ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Client + localVarReturnValue Client ) // create path and map variables @@ -617,7 +617,7 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -625,18 +625,18 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v Client - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -666,21 +666,21 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン */ type TestEndpointParametersOpts struct { - Integer optional.Int32 - Int32_ optional.Int32 - Int64_ optional.Int64 - Float optional.Float32 - String_ optional.String - Binary optional.Interface - Date optional.String - DateTime optional.Time - Password optional.String - Callback optional.String + Integer optional.Int32 + Int32_ optional.Int32 + Int64_ optional.Int64 + Float optional.Float32 + String_ optional.String + Binary optional.Interface + Date optional.String + DateTime optional.Time + Password optional.String + Callback optional.String } func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -787,7 +787,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -812,19 +812,19 @@ To test enum parameters */ type TestEnumParametersOpts struct { - EnumHeaderStringArray optional.Interface - EnumHeaderString optional.String - EnumQueryStringArray optional.Interface - EnumQueryString optional.String - EnumQueryInteger optional.Int32 - EnumQueryDouble optional.Float64 - EnumFormStringArray optional.Interface - EnumFormString optional.String + EnumHeaderStringArray optional.Interface + EnumHeaderString optional.String + EnumQueryStringArray optional.Interface + EnumQueryString optional.String + EnumQueryInteger optional.Int32 + EnumQueryDouble optional.Float64 + EnumFormStringArray optional.Interface + EnumFormString optional.String } func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptionals *TestEnumParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -897,7 +897,7 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -913,7 +913,7 @@ FakeApiService test inline additionalProperties */ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, requestBody map[string]string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -964,7 +964,7 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, req if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -981,7 +981,7 @@ FakeApiService test json serialization of form data */ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, param2 string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -1032,7 +1032,7 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr 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 b2748822bb8..bf433a4a729 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 @@ -34,12 +34,12 @@ To test class name in snake case */ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, client Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Client + localVarReturnValue Client ) // create path and map variables @@ -99,7 +99,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -107,18 +107,18 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v Client - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } 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 2a7fc7f0172..f776e219e29 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_pet.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_pet.go @@ -35,7 +35,7 @@ PetApiService Add a new pet to the store */ func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -86,7 +86,7 @@ func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, er if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -104,12 +104,12 @@ PetApiService Deletes a pet */ type DeletePetOpts struct { - ApiKey optional.String + ApiKey optional.String } func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -162,7 +162,7 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -180,12 +180,12 @@ Multiple status values can be provided with comma separated strings */ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue []Pet + localVarReturnValue []Pet ) // create path and map variables @@ -231,7 +231,7 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ( if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -239,18 +239,18 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ( if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v []Pet - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -267,12 +267,12 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 */ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue []Pet + localVarReturnValue []Pet ) // create path and map variables @@ -318,7 +318,7 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -326,18 +326,18 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v []Pet - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -354,12 +354,12 @@ Returns a single pet */ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Pet + localVarReturnValue Pet ) // create path and map variables @@ -418,7 +418,7 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -426,18 +426,18 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v Pet - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -452,7 +452,7 @@ PetApiService Update an existing pet */ func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -503,7 +503,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -522,13 +522,13 @@ PetApiService Updates a pet in the store with form data */ type UpdatePetWithFormOpts struct { - Name optional.String - Status optional.String + Name optional.String + Status optional.String } func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -584,7 +584,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -604,18 +604,18 @@ PetApiService uploads an image */ type UploadFileOpts struct { - AdditionalMetadata optional.String - File optional.Interface + AdditionalMetadata optional.String + File optional.Interface } func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue ApiResponse + localVarReturnValue ApiResponse ) // create path and map variables @@ -679,7 +679,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -687,18 +687,18 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ApiResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -717,17 +717,17 @@ PetApiService uploads an image (required) */ type UploadFileWithRequiredFileOpts struct { - AdditionalMetadata optional.String + AdditionalMetadata optional.String } func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue ApiResponse + localVarReturnValue ApiResponse ) // create path and map variables @@ -784,7 +784,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -792,18 +792,18 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ApiResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } 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 37bfbd9d1e6..b33c501957d 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_store.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_store.go @@ -34,7 +34,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or */ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -84,7 +84,7 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -101,12 +101,12 @@ Returns a map of status codes to quantities */ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue map[string]int32 + localVarReturnValue map[string]int32 ) // create path and map variables @@ -164,7 +164,7 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, * if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -172,18 +172,18 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, * if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v map[string]int32 - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -200,12 +200,12 @@ For valid response try integer IDs with value <= 5 or > 10. Other val */ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Order + localVarReturnValue Order ) // create path and map variables @@ -257,7 +257,7 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -265,18 +265,18 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v Order - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -292,12 +292,12 @@ StoreApiService Place an order for a pet */ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Order + localVarReturnValue Order ) // create path and map variables @@ -344,7 +344,7 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, * if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -352,18 +352,18 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, * if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v Order - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } 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 5fb7bae8892..1c98e701509 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api_user.go +++ b/samples/client/petstore/go/go-petstore-withXml/api_user.go @@ -34,7 +34,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -85,7 +85,7 @@ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Respo if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -101,7 +101,7 @@ UserApiService Creates list of users with given input array */ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -152,7 +152,7 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []U if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -168,7 +168,7 @@ UserApiService Creates list of users with given input array */ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -219,7 +219,7 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []Us if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -236,7 +236,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -286,7 +286,7 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -303,12 +303,12 @@ UserApiService Get user by user name */ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue User + localVarReturnValue User ) // create path and map variables @@ -354,7 +354,7 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -362,18 +362,18 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v User - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -390,12 +390,12 @@ UserApiService Logs user into the system */ func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue string + localVarReturnValue string ) // create path and map variables @@ -442,7 +442,7 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -450,18 +450,18 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -475,7 +475,7 @@ UserApiService Logs out current logged in user session */ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -524,7 +524,7 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -542,7 +542,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) UpdateUser(ctx context.Context, username string, user User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -594,7 +594,7 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, user U if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr diff --git a/samples/client/petstore/go/go-petstore-withXml/client.go b/samples/client/petstore/go/go-petstore-withXml/client.go index 7f6ae237a71..7e4ec1871a0 100644 --- a/samples/client/petstore/go/go-petstore-withXml/client.go +++ b/samples/client/petstore/go/go-petstore-withXml/client.go @@ -200,7 +200,7 @@ func (c *APIClient) prepareRequest( } // add form parameters and file if available. - if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { if body != nil { return nil, errors.New("Cannot specify postBody and multipart form at the same time.") } @@ -239,6 +239,16 @@ func (c *APIClient) prepareRequest( w.Close() } + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + // Setup path and query parameters url, err := url.Parse(path) if err != nil { @@ -481,4 +491,4 @@ func (e GenericOpenAPIError) Body() []byte { // Model returns the unpacked model of the error func (e GenericOpenAPIError) Model() interface{} { return e.model -} \ No newline at end of file +} diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md index ce9779af264..43c63231137 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/AnotherFakeApi.md @@ -4,14 +4,14 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**TestSpecialTags**](AnotherFakeApi.md#TestSpecialTags) | **Patch** /another-fake/dummy | To test special tags +[**Call123TestSpecialTags**](AnotherFakeApi.md#Call123TestSpecialTags) | **Patch** /another-fake/dummy | To test special tags -# **TestSpecialTags** -> Client TestSpecialTags(ctx, client) +# **Call123TestSpecialTags** +> Client Call123TestSpecialTags(ctx, client) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Required Parameters diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/FakeApi.md b/samples/client/petstore/go/go-petstore-withXml/docs/FakeApi.md index 52b5451b5ae..b89c1abbc1c 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/FakeApi.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/FakeApi.md @@ -39,7 +39,7 @@ Name | Type | Description | Notes ### Return type -[**bool**](boolean.md) +**bool** ### Authorization @@ -109,7 +109,7 @@ Name | Type | Description | Notes ### Return type -[**float32**](number.md) +**float32** ### Authorization diff --git a/samples/client/petstore/go/go-petstore-withXml/docs/MapTest.md b/samples/client/petstore/go/go-petstore-withXml/docs/MapTest.md index fc266d17df9..49381ec4b85 100644 --- a/samples/client/petstore/go/go-petstore-withXml/docs/MapTest.md +++ b/samples/client/petstore/go/go-petstore-withXml/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **MapMapOfString** | [**map[string]map[string]string**](map.md) | | [optional] **MapOfEnumString** | **map[string]string** | | [optional] **DirectMap** | **map[string]bool** | | [optional] -**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**IndirectMap** | **map[string]bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore-withXml/model_map_test_.go b/samples/client/petstore/go/go-petstore-withXml/model_map_test_.go index a15240d0d76..1c8e4459206 100644 --- a/samples/client/petstore/go/go-petstore-withXml/model_map_test_.go +++ b/samples/client/petstore/go/go-petstore-withXml/model_map_test_.go @@ -14,5 +14,5 @@ type MapTest struct { MapMapOfString map[string]map[string]string `json:"map_map_of_string,omitempty" xml:"map_map_of_string"` MapOfEnumString map[string]string `json:"map_of_enum_string,omitempty" xml:"map_of_enum_string"` DirectMap map[string]bool `json:"direct_map,omitempty" xml:"direct_map"` - IndirectMap StringBooleanMap `json:"indirect_map,omitempty" xml:"indirect_map"` + IndirectMap map[string]bool `json:"indirect_map,omitempty" xml:"indirect_map"` } diff --git a/samples/client/petstore/go/go-petstore/.openapi-generator/VERSION b/samples/client/petstore/go/go-petstore/.openapi-generator/VERSION index 4395ff59232..afa63656064 100644 --- a/samples/client/petstore/go/go-petstore/.openapi-generator/VERSION +++ b/samples/client/petstore/go/go-petstore/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/go/go-petstore/api/openapi.yaml b/samples/client/petstore/go/go-petstore/api/openapi.yaml index 1ccb557da3b..4009731809f 100644 --- a/samples/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/client/petstore/go/go-petstore/api/openapi.yaml @@ -1487,7 +1487,9 @@ components: type: boolean type: object indirect_map: - $ref: '#/components/schemas/StringBooleanMap' + additionalProperties: + type: boolean + type: object type: object Tag: example: 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 cf9b1f98673..a7a6f1f75c3 100644 --- a/samples/client/petstore/go/go-petstore/api_another_fake.go +++ b/samples/client/petstore/go/go-petstore/api_another_fake.go @@ -33,12 +33,12 @@ To test special tags and operation ID starting with number */ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, client Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Client + localVarReturnValue Client ) // create path and map variables @@ -85,7 +85,7 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, clie if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -93,18 +93,18 @@ func (a *AnotherFakeApiService) Call123TestSpecialTags(ctx context.Context, clie if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v Client - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } diff --git a/samples/client/petstore/go/go-petstore/api_fake.go b/samples/client/petstore/go/go-petstore/api_fake.go index 237877e063d..f0ba3d30165 100644 --- a/samples/client/petstore/go/go-petstore/api_fake.go +++ b/samples/client/petstore/go/go-petstore/api_fake.go @@ -36,17 +36,17 @@ Test serialization of outer boolean types */ type FakeOuterBooleanSerializeOpts struct { - Body optional.Bool + Body optional.Bool } func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVarOptionals *FakeOuterBooleanSerializeOpts) (bool, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue bool + localVarReturnValue bool ) // create path and map variables @@ -96,7 +96,7 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -104,18 +104,18 @@ func (a *FakeApiService) FakeOuterBooleanSerialize(ctx context.Context, localVar if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v bool - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -133,17 +133,17 @@ Test serialization of object with outer number type */ type FakeOuterCompositeSerializeOpts struct { - OuterComposite optional.Interface + OuterComposite optional.Interface } func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localVarOptionals *FakeOuterCompositeSerializeOpts) (OuterComposite, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue OuterComposite + localVarReturnValue OuterComposite ) // create path and map variables @@ -197,7 +197,7 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -205,18 +205,18 @@ func (a *FakeApiService) FakeOuterCompositeSerialize(ctx context.Context, localV if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v OuterComposite - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -234,17 +234,17 @@ Test serialization of outer number types */ type FakeOuterNumberSerializeOpts struct { - Body optional.Float32 + Body optional.Float32 } func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarOptionals *FakeOuterNumberSerializeOpts) (float32, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue float32 + localVarReturnValue float32 ) // create path and map variables @@ -294,7 +294,7 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -302,18 +302,18 @@ func (a *FakeApiService) FakeOuterNumberSerialize(ctx context.Context, localVarO if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v float32 - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -331,17 +331,17 @@ Test serialization of outer string types */ type FakeOuterStringSerializeOpts struct { - Body optional.String + Body optional.String } func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarOptionals *FakeOuterStringSerializeOpts) (string, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue string + localVarReturnValue string ) // create path and map variables @@ -391,7 +391,7 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -399,18 +399,18 @@ func (a *FakeApiService) FakeOuterStringSerialize(ctx context.Context, localVarO if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -426,7 +426,7 @@ For this test, the body for this request much reference a schema named `Fil */ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaTestClass FileSchemaTestClass) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -477,7 +477,7 @@ func (a *FakeApiService) TestBodyWithFileSchema(ctx context.Context, fileSchemaT if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -494,7 +494,7 @@ FakeApiService */ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query string, user User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -546,7 +546,7 @@ func (a *FakeApiService) TestBodyWithQueryParams(ctx context.Context, query stri if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -564,12 +564,12 @@ To test \"client\" model */ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Client + localVarReturnValue Client ) // create path and map variables @@ -616,7 +616,7 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -624,18 +624,18 @@ func (a *FakeApiService) TestClientModel(ctx context.Context, client Client) (Cl if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v Client - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -665,21 +665,21 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン */ type TestEndpointParametersOpts struct { - Integer optional.Int32 - Int32_ optional.Int32 - Int64_ optional.Int64 - Float optional.Float32 - String_ optional.String - Binary optional.Interface - Date optional.String - DateTime optional.Time - Password optional.String - Callback optional.String + Integer optional.Int32 + Int32_ optional.Int32 + Int64_ optional.Int64 + Float optional.Float32 + String_ optional.String + Binary optional.Interface + Date optional.String + DateTime optional.Time + Password optional.String + Callback optional.String } func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number float32, double float64, patternWithoutDelimiter string, byte_ string, localVarOptionals *TestEndpointParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -786,7 +786,7 @@ func (a *FakeApiService) TestEndpointParameters(ctx context.Context, number floa if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -811,19 +811,19 @@ To test enum parameters */ type TestEnumParametersOpts struct { - EnumHeaderStringArray optional.Interface - EnumHeaderString optional.String - EnumQueryStringArray optional.Interface - EnumQueryString optional.String - EnumQueryInteger optional.Int32 - EnumQueryDouble optional.Float64 - EnumFormStringArray optional.Interface - EnumFormString optional.String + EnumHeaderStringArray optional.Interface + EnumHeaderString optional.String + EnumQueryStringArray optional.Interface + EnumQueryString optional.String + EnumQueryInteger optional.Int32 + EnumQueryDouble optional.Float64 + EnumFormStringArray optional.Interface + EnumFormString optional.String } func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptionals *TestEnumParametersOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -896,7 +896,7 @@ func (a *FakeApiService) TestEnumParameters(ctx context.Context, localVarOptiona if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -912,7 +912,7 @@ FakeApiService test inline additionalProperties */ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, requestBody map[string]string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -963,7 +963,7 @@ func (a *FakeApiService) TestInlineAdditionalProperties(ctx context.Context, req if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -980,7 +980,7 @@ FakeApiService test json serialization of form data */ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, param2 string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -1031,7 +1031,7 @@ func (a *FakeApiService) TestJsonFormData(ctx context.Context, param string, par if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr 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 b194fc53f9c..1b55b578de8 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 @@ -33,12 +33,12 @@ To test class name in snake case */ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, client Client) (Client, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Patch") + localVarHttpMethod = strings.ToUpper("Patch") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Client + localVarReturnValue Client ) // create path and map variables @@ -98,7 +98,7 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -106,18 +106,18 @@ func (a *FakeClassnameTags123ApiService) TestClassname(ctx context.Context, clie if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v Client - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } diff --git a/samples/client/petstore/go/go-petstore/api_pet.go b/samples/client/petstore/go/go-petstore/api_pet.go index 49f60d43de4..f328c787e20 100644 --- a/samples/client/petstore/go/go-petstore/api_pet.go +++ b/samples/client/petstore/go/go-petstore/api_pet.go @@ -34,7 +34,7 @@ PetApiService Add a new pet to the store */ func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -85,7 +85,7 @@ func (a *PetApiService) AddPet(ctx context.Context, pet Pet) (*http.Response, er if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -103,12 +103,12 @@ PetApiService Deletes a pet */ type DeletePetOpts struct { - ApiKey optional.String + ApiKey optional.String } func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOptionals *DeletePetOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -161,7 +161,7 @@ func (a *PetApiService) DeletePet(ctx context.Context, petId int64, localVarOpti if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -179,12 +179,12 @@ Multiple status values can be provided with comma separated strings */ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ([]Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue []Pet + localVarReturnValue []Pet ) // create path and map variables @@ -230,7 +230,7 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ( if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -238,18 +238,18 @@ func (a *PetApiService) FindPetsByStatus(ctx context.Context, status []string) ( if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v []Pet - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -266,12 +266,12 @@ Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 */ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue []Pet + localVarReturnValue []Pet ) // create path and map variables @@ -317,7 +317,7 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -325,18 +325,18 @@ func (a *PetApiService) FindPetsByTags(ctx context.Context, tags []string) ([]Pe if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v []Pet - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -353,12 +353,12 @@ Returns a single pet */ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Pet + localVarReturnValue Pet ) // create path and map variables @@ -417,7 +417,7 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -425,18 +425,18 @@ func (a *PetApiService) GetPetById(ctx context.Context, petId int64) (Pet, *http if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v Pet - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -451,7 +451,7 @@ PetApiService Update an existing pet */ func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -502,7 +502,7 @@ func (a *PetApiService) UpdatePet(ctx context.Context, pet Pet) (*http.Response, if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -521,13 +521,13 @@ PetApiService Updates a pet in the store with form data */ type UpdatePetWithFormOpts struct { - Name optional.String - Status optional.String + Name optional.String + Status optional.String } func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, localVarOptionals *UpdatePetWithFormOpts) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -583,7 +583,7 @@ func (a *PetApiService) UpdatePetWithForm(ctx context.Context, petId int64, loca if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -603,18 +603,18 @@ PetApiService uploads an image */ type UploadFileOpts struct { - AdditionalMetadata optional.String - File optional.Interface + AdditionalMetadata optional.String + File optional.Interface } func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOptionals *UploadFileOpts) (ApiResponse, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue ApiResponse + localVarReturnValue ApiResponse ) // create path and map variables @@ -678,7 +678,7 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -686,18 +686,18 @@ func (a *PetApiService) UploadFile(ctx context.Context, petId int64, localVarOpt if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ApiResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -716,17 +716,17 @@ PetApiService uploads an image (required) */ type UploadFileWithRequiredFileOpts struct { - AdditionalMetadata optional.String + AdditionalMetadata optional.String } func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId int64, requiredFile *os.File, localVarOptionals *UploadFileWithRequiredFileOpts) (ApiResponse, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue ApiResponse + localVarReturnValue ApiResponse ) // create path and map variables @@ -783,7 +783,7 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -791,18 +791,18 @@ func (a *PetApiService) UploadFileWithRequiredFile(ctx context.Context, petId in if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v ApiResponse - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } diff --git a/samples/client/petstore/go/go-petstore/api_store.go b/samples/client/petstore/go/go-petstore/api_store.go index d03e97a27d5..a6844520895 100644 --- a/samples/client/petstore/go/go-petstore/api_store.go +++ b/samples/client/petstore/go/go-petstore/api_store.go @@ -33,7 +33,7 @@ For valid response try integer IDs with value < 1000. Anything above 1000 or */ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -83,7 +83,7 @@ func (a *StoreApiService) DeleteOrder(ctx context.Context, orderId string) (*htt if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -100,12 +100,12 @@ Returns a map of status codes to quantities */ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue map[string]int32 + localVarReturnValue map[string]int32 ) // create path and map variables @@ -163,7 +163,7 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, * if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -171,18 +171,18 @@ func (a *StoreApiService) GetInventory(ctx context.Context) (map[string]int32, * if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v map[string]int32 - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -199,12 +199,12 @@ For valid response try integer IDs with value <= 5 or > 10. Other val */ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Order, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Order + localVarReturnValue Order ) // create path and map variables @@ -256,7 +256,7 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -264,18 +264,18 @@ func (a *StoreApiService) GetOrderById(ctx context.Context, orderId int64) (Orde if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v Order - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -291,12 +291,12 @@ StoreApiService Place an order for a pet */ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue Order + localVarReturnValue Order ) // create path and map variables @@ -343,7 +343,7 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, * if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -351,18 +351,18 @@ func (a *StoreApiService) PlaceOrder(ctx context.Context, order Order) (Order, * if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v Order - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } diff --git a/samples/client/petstore/go/go-petstore/api_user.go b/samples/client/petstore/go/go-petstore/api_user.go index e8fbe7bef04..f1401adfb45 100644 --- a/samples/client/petstore/go/go-petstore/api_user.go +++ b/samples/client/petstore/go/go-petstore/api_user.go @@ -33,7 +33,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -84,7 +84,7 @@ func (a *UserApiService) CreateUser(ctx context.Context, user User) (*http.Respo if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -100,7 +100,7 @@ UserApiService Creates list of users with given input array */ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -151,7 +151,7 @@ func (a *UserApiService) CreateUsersWithArrayInput(ctx context.Context, user []U if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -167,7 +167,7 @@ UserApiService Creates list of users with given input array */ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Post") + localVarHttpMethod = strings.ToUpper("Post") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -218,7 +218,7 @@ func (a *UserApiService) CreateUsersWithListInput(ctx context.Context, user []Us if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -235,7 +235,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Delete") + localVarHttpMethod = strings.ToUpper("Delete") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -285,7 +285,7 @@ func (a *UserApiService) DeleteUser(ctx context.Context, username string) (*http if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -302,12 +302,12 @@ UserApiService Get user by user name */ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (User, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue User + localVarReturnValue User ) // create path and map variables @@ -353,7 +353,7 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -361,18 +361,18 @@ func (a *UserApiService) GetUserByName(ctx context.Context, username string) (Us if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v User - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -389,12 +389,12 @@ UserApiService Logs user into the system */ func (a *UserApiService) LoginUser(ctx context.Context, username string, password string) (string, *http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string localVarFileBytes []byte - localVarReturnValue string + localVarReturnValue string ) // create path and map variables @@ -441,7 +441,7 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor if localVarHttpResponse.StatusCode < 300 { // If we succeed, return the data, otherwise pass on to decode error. - err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); + err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) if err == nil { return localVarReturnValue, localVarHttpResponse, err } @@ -449,18 +449,18 @@ func (a *UserApiService) LoginUser(ctx context.Context, username string, passwor if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } if localVarHttpResponse.StatusCode == 200 { var v string - err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")); - if err != nil { - newErr.error = err.Error() - return localVarReturnValue, localVarHttpResponse, newErr - } - newErr.model = v + err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type")) + if err != nil { + newErr.error = err.Error() return localVarReturnValue, localVarHttpResponse, newErr + } + newErr.model = v + return localVarReturnValue, localVarHttpResponse, newErr } return localVarReturnValue, localVarHttpResponse, newErr } @@ -474,7 +474,7 @@ UserApiService Logs out current logged in user session */ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Get") + localVarHttpMethod = strings.ToUpper("Get") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -523,7 +523,7 @@ func (a *UserApiService) LogoutUser(ctx context.Context) (*http.Response, error) if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr @@ -541,7 +541,7 @@ This can only be done by the logged in user. */ func (a *UserApiService) UpdateUser(ctx context.Context, username string, user User) (*http.Response, error) { var ( - localVarHttpMethod = strings.ToUpper("Put") + localVarHttpMethod = strings.ToUpper("Put") localVarPostBody interface{} localVarFormFileName string localVarFileName string @@ -593,7 +593,7 @@ func (a *UserApiService) UpdateUser(ctx context.Context, username string, user U if localVarHttpResponse.StatusCode >= 300 { newErr := GenericOpenAPIError{ - body: localVarBody, + body: localVarBody, error: localVarHttpResponse.Status, } return localVarHttpResponse, newErr diff --git a/samples/client/petstore/go/go-petstore/client.go b/samples/client/petstore/go/go-petstore/client.go index a51675e447d..deda983f278 100644 --- a/samples/client/petstore/go/go-petstore/client.go +++ b/samples/client/petstore/go/go-petstore/client.go @@ -199,7 +199,7 @@ func (c *APIClient) prepareRequest( } // add form parameters and file if available. - if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") { if body != nil { return nil, errors.New("Cannot specify postBody and multipart form at the same time.") } @@ -238,6 +238,16 @@ func (c *APIClient) prepareRequest( w.Close() } + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + // Setup path and query parameters url, err := url.Parse(path) if err != nil { @@ -480,4 +490,4 @@ func (e GenericOpenAPIError) Body() []byte { // Model returns the unpacked model of the error func (e GenericOpenAPIError) Model() interface{} { return e.model -} \ No newline at end of file +} diff --git a/samples/client/petstore/go/go-petstore/docs/FakeApi.md b/samples/client/petstore/go/go-petstore/docs/FakeApi.md index 52b5451b5ae..b89c1abbc1c 100644 --- a/samples/client/petstore/go/go-petstore/docs/FakeApi.md +++ b/samples/client/petstore/go/go-petstore/docs/FakeApi.md @@ -39,7 +39,7 @@ Name | Type | Description | Notes ### Return type -[**bool**](boolean.md) +**bool** ### Authorization @@ -109,7 +109,7 @@ Name | Type | Description | Notes ### Return type -[**float32**](number.md) +**float32** ### Authorization diff --git a/samples/client/petstore/go/go-petstore/docs/MapTest.md b/samples/client/petstore/go/go-petstore/docs/MapTest.md index fc266d17df9..49381ec4b85 100644 --- a/samples/client/petstore/go/go-petstore/docs/MapTest.md +++ b/samples/client/petstore/go/go-petstore/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **MapMapOfString** | [**map[string]map[string]string**](map.md) | | [optional] **MapOfEnumString** | **map[string]string** | | [optional] **DirectMap** | **map[string]bool** | | [optional] -**IndirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**IndirectMap** | **map[string]bool** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/go/go-petstore/model_map_test_.go b/samples/client/petstore/go/go-petstore/model_map_test_.go index d0c3a6a19ff..830e760fe31 100644 --- a/samples/client/petstore/go/go-petstore/model_map_test_.go +++ b/samples/client/petstore/go/go-petstore/model_map_test_.go @@ -13,5 +13,5 @@ type MapTest struct { MapMapOfString map[string]map[string]string `json:"map_map_of_string,omitempty"` MapOfEnumString map[string]string `json:"map_of_enum_string,omitempty"` DirectMap map[string]bool `json:"direct_map,omitempty"` - IndirectMap StringBooleanMap `json:"indirect_map,omitempty"` + IndirectMap map[string]bool `json:"indirect_map,omitempty"` } diff --git a/samples/client/petstore/go/pet_api_test.go b/samples/client/petstore/go/pet_api_test.go index dd28f689afe..0e23ca936e3 100644 --- a/samples/client/petstore/go/pet_api_test.go +++ b/samples/client/petstore/go/pet_api_test.go @@ -87,6 +87,9 @@ func TestUpdatePetWithForm(t *testing.T) { if r.StatusCode != 200 { t.Log(r) } + + // get the pet with id 12830 from server to verify the update + isPetCorrect(t, 12830, "golang", "available") } func TestFindPetsByTag(t *testing.T) { @@ -104,7 +107,7 @@ func TestFindPetsByTag(t *testing.T) { assert := assert.New(t) for i := 0; i < len(resp); i++ { if resp[i].Id == 12830 { - assert.Equal(resp[i].Status, "pending", "Pet status should be `pending`") + assert.Equal(resp[i].Status, "available", "Pet status should be `pending`") found = true } } @@ -301,3 +304,4 @@ func isPetCorrect(t *testing.T, id int64, name string, status string) { t.Log(r) } } + diff --git a/samples/client/petstore/haskell-http-client/README.md b/samples/client/petstore/haskell-http-client/README.md index 89946e86fc6..df8a3631630 100644 --- a/samples/client/petstore/haskell-http-client/README.md +++ b/samples/client/petstore/haskell-http-client/README.md @@ -2,7 +2,7 @@ The library in `lib` provides auto-generated-from-OpenAPI [http-client](https://www.stackage.org/lts-10.0/package/http-client-0.5.7.1) bindings to the OpenAPI Petstore API. -OpenApi Version: 3.0.0 +OpenApi Version: 3.0.1 ## Installation diff --git a/samples/client/petstore/haskell-http-client/example-app/Main.hs b/samples/client/petstore/haskell-http-client/example-app/Main.hs index f6f215fdb67..fa86cbbbe17 100644 --- a/samples/client/petstore/haskell-http-client/example-app/Main.hs +++ b/samples/client/petstore/haskell-http-client/example-app/Main.hs @@ -155,7 +155,8 @@ runPet mgr config = do -- * STORE - +instance S.Consumes S.PlaceOrder S.MimeJSON + runStore :: NH.Manager -> S.OpenAPIPetstoreConfig -> IO () runStore mgr config = do @@ -167,7 +168,7 @@ runStore mgr config = do -- placeOrder now <- TI.getCurrentTime - let placeOrderRequest = S.placeOrder (S.Accept S.MimeJSON) (S.mkOrder { S.orderId = Just 21, S.orderQuantity = Just 210, S.orderShipDate = Just (S.DateTime now)}) + let placeOrderRequest = S.placeOrder (S.ContentType S.MimeJSON) (S.Accept S.MimeJSON) (S.mkOrder { S.orderId = Just 21, S.orderQuantity = Just 210, S.orderShipDate = Just (S.DateTime now)}) placeOrderResult <- S.dispatchMime mgr config placeOrderRequest mapM_ (\r -> putStrLn $ "placeOrderResult: " <> show r) placeOrderResult @@ -188,22 +189,27 @@ runStore mgr config = do -- * USER +instance S.Consumes S.CreateUser S.MimeJSON +instance S.Consumes S.CreateUsersWithArrayInput S.MimeJSON +instance S.Consumes S.CreateUsersWithListInput S.MimeJSON +instance S.Consumes S.UpdateUser S.MimeJSON + runUser :: NH.Manager -> S.OpenAPIPetstoreConfig -> IO () runUser mgr config = do let username = "hsusername" -- createUser let user = S.mkUser { S.userId = Just 21, S.userUsername = Just username } - let createUserRequest = S.createUser user + let createUserRequest = S.createUser (S.ContentType S.MimeJSON) user _ <- S.dispatchLbs mgr config createUserRequest -- can use lenses (model record names are appended L) to view or modify records let users = take 8 $ drop 1 $ iterate (L.over S.userUsernameL (fmap (<> "*")) . L.over S.userIdL (fmap (+ 1))) user - let createUsersWithArrayInputRequest = S.createUsersWithArrayInput (S.User2 users) + let createUsersWithArrayInputRequest = S.createUsersWithArrayInput (S.ContentType S.MimeJSON) (S.User2 users) _ <- S.dispatchLbs mgr config createUsersWithArrayInputRequest -- createUsersWithArrayInput - let createUsersWithListInputRequest = S.createUsersWithListInput (S.User2 users) + let createUsersWithListInputRequest = S.createUsersWithListInput (S.ContentType S.MimeJSON) (S.User2 users) _ <- S.dispatchLbs mgr config createUsersWithListInputRequest -- getUserByName @@ -217,7 +223,7 @@ runUser mgr config = do BCL.putStrLn $ "loginUser: " <> (NH.responseBody loginUserResult) -- updateUser - let updateUserRequest = S.updateUser (user { S.userEmail = Just "xyz@example.com" }) (S.Username username) + let updateUserRequest = S.updateUser (S.ContentType S.MimeJSON) (user { S.userEmail = Just "xyz@example.com" }) (S.Username username) _ <- S.dispatchLbs mgr config updateUserRequest -- logoutUser diff --git a/samples/client/petstore/haskell-http-client/example-app/stack.yaml b/samples/client/petstore/haskell-http-client/example-app/stack.yaml index de32b243730..76328ae5161 100644 --- a/samples/client/petstore/haskell-http-client/example-app/stack.yaml +++ b/samples/client/petstore/haskell-http-client/example-app/stack.yaml @@ -1,4 +1,4 @@ -resolver: lts-10.0 +resolver: lts-10.10 packages: - location: '.' - location: '..' diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore.hs index 4e71ab9e720..83e607b1ad7 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API.hs index 3c3deada26b..7335a85067e 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/AnotherFake.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/AnotherFake.hs index 8ecaa5703a1..aa3b293eb67 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/AnotherFake.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/AnotherFake.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Fake.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Fake.hs index 51f5f5e51c7..4d73209965f 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Fake.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Fake.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} @@ -64,19 +64,17 @@ import qualified Prelude as P -- Test serialization of outer boolean types -- fakeOuterBooleanSerialize - :: (Consumes FakeOuterBooleanSerialize MimeJSON) - => Accept accept -- ^ request accept ('MimeType') - -> OpenAPIPetstoreRequest FakeOuterBooleanSerialize MimeJSON Bool accept -fakeOuterBooleanSerialize _ = + :: (Consumes FakeOuterBooleanSerialize contentType) + => ContentType contentType -- ^ request content-type ('MimeType') + -> Accept accept -- ^ request accept ('MimeType') + -> OpenAPIPetstoreRequest FakeOuterBooleanSerialize contentType Bool accept +fakeOuterBooleanSerialize _ _ = _mkRequest "POST" ["/fake/outer/boolean"] data FakeOuterBooleanSerialize -- | /Body Param/ "body" - Input boolean as post body -instance HasBodyParam FakeOuterBooleanSerialize Body8 - --- | @application/json@ -instance Consumes FakeOuterBooleanSerialize MimeJSON +instance HasBodyParam FakeOuterBooleanSerialize BodyBool -- | @*/*@ instance MimeType mtype => Produces FakeOuterBooleanSerialize mtype @@ -89,10 +87,11 @@ instance MimeType mtype => Produces FakeOuterBooleanSerialize mtype -- Test serialization of object with outer number type -- fakeOuterCompositeSerialize - :: (Consumes FakeOuterCompositeSerialize MimeJSON) - => Accept accept -- ^ request accept ('MimeType') - -> OpenAPIPetstoreRequest FakeOuterCompositeSerialize MimeJSON OuterComposite accept -fakeOuterCompositeSerialize _ = + :: (Consumes FakeOuterCompositeSerialize contentType) + => ContentType contentType -- ^ request content-type ('MimeType') + -> Accept accept -- ^ request accept ('MimeType') + -> OpenAPIPetstoreRequest FakeOuterCompositeSerialize contentType OuterComposite accept +fakeOuterCompositeSerialize _ _ = _mkRequest "POST" ["/fake/outer/composite"] data FakeOuterCompositeSerialize @@ -100,9 +99,6 @@ data FakeOuterCompositeSerialize -- | /Body Param/ "OuterComposite" - Input composite as post body instance HasBodyParam FakeOuterCompositeSerialize OuterComposite --- | @application/json@ -instance Consumes FakeOuterCompositeSerialize MimeJSON - -- | @*/*@ instance MimeType mtype => Produces FakeOuterCompositeSerialize mtype @@ -114,19 +110,17 @@ instance MimeType mtype => Produces FakeOuterCompositeSerialize mtype -- Test serialization of outer number types -- fakeOuterNumberSerialize - :: (Consumes FakeOuterNumberSerialize MimeJSON) - => Accept accept -- ^ request accept ('MimeType') - -> OpenAPIPetstoreRequest FakeOuterNumberSerialize MimeJSON Double accept -fakeOuterNumberSerialize _ = + :: (Consumes FakeOuterNumberSerialize contentType) + => ContentType contentType -- ^ request content-type ('MimeType') + -> Accept accept -- ^ request accept ('MimeType') + -> OpenAPIPetstoreRequest FakeOuterNumberSerialize contentType Double accept +fakeOuterNumberSerialize _ _ = _mkRequest "POST" ["/fake/outer/number"] data FakeOuterNumberSerialize -- | /Body Param/ "body" - Input number as post body -instance HasBodyParam FakeOuterNumberSerialize Body6 - --- | @application/json@ -instance Consumes FakeOuterNumberSerialize MimeJSON +instance HasBodyParam FakeOuterNumberSerialize Body -- | @*/*@ instance MimeType mtype => Produces FakeOuterNumberSerialize mtype @@ -139,19 +133,17 @@ instance MimeType mtype => Produces FakeOuterNumberSerialize mtype -- Test serialization of outer string types -- fakeOuterStringSerialize - :: (Consumes FakeOuterStringSerialize MimeJSON) - => Accept accept -- ^ request accept ('MimeType') - -> OpenAPIPetstoreRequest FakeOuterStringSerialize MimeJSON Text accept -fakeOuterStringSerialize _ = + :: (Consumes FakeOuterStringSerialize contentType) + => ContentType contentType -- ^ request content-type ('MimeType') + -> Accept accept -- ^ request accept ('MimeType') + -> OpenAPIPetstoreRequest FakeOuterStringSerialize contentType Text accept +fakeOuterStringSerialize _ _ = _mkRequest "POST" ["/fake/outer/string"] data FakeOuterStringSerialize -- | /Body Param/ "body" - Input string as post body -instance HasBodyParam FakeOuterStringSerialize Body7 - --- | @application/json@ -instance Consumes FakeOuterStringSerialize MimeJSON +instance HasBodyParam FakeOuterStringSerialize BodyText -- | @*/*@ instance MimeType mtype => Produces FakeOuterStringSerialize mtype @@ -353,7 +345,7 @@ instance HasOptionalParam TestEnumParameters EnumHeaderString where -- | /Optional Param/ "enum_query_string_array" - Query parameter enum test (string array) instance HasOptionalParam TestEnumParameters EnumQueryStringArray where applyOptionalParam req (EnumQueryStringArray xs) = - req `setQuery` toQueryColl MultiParamArray ("enum_query_string_array", Just xs) + req `setQuery` toQueryColl CommaSeparated ("enum_query_string_array", Just xs) -- | /Optional Param/ "enum_query_string" - Query parameter enum test (string) instance HasOptionalParam TestEnumParameters EnumQueryString where diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/FakeClassnameTags123.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/FakeClassnameTags123.hs index e1776cbfd8b..5719e3c4cd4 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/FakeClassnameTags123.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/FakeClassnameTags123.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Pet.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Pet.hs index 11c9352c582..7b6de84e74b 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Pet.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Pet.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Store.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Store.hs index 628da518121..12bcd0bc94a 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Store.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/Store.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} @@ -128,11 +128,12 @@ instance Produces GetOrderById MimeJSON -- Place an order for a pet -- placeOrder - :: (Consumes PlaceOrder MimeJSON, MimeRender MimeJSON Order) - => Accept accept -- ^ request accept ('MimeType') + :: (Consumes PlaceOrder contentType, MimeRender contentType Order) + => ContentType contentType -- ^ request content-type ('MimeType') + -> Accept accept -- ^ request accept ('MimeType') -> Order -- ^ "order" - order placed for purchasing the pet - -> OpenAPIPetstoreRequest PlaceOrder MimeJSON Order accept -placeOrder _ order = + -> OpenAPIPetstoreRequest PlaceOrder contentType Order accept +placeOrder _ _ order = _mkRequest "POST" ["/store/order"] `setBodyParam` order @@ -141,9 +142,6 @@ data PlaceOrder -- | /Body Param/ "Order" - order placed for purchasing the pet instance HasBodyParam PlaceOrder Order --- | @application/json@ -instance Consumes PlaceOrder MimeJSON - -- | @application/xml@ instance Produces PlaceOrder MimeXML -- | @application/json@ diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/User.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/User.hs index 76b4963a8f1..efc6ad66f31 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/User.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/API/User.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} @@ -66,10 +66,11 @@ import qualified Prelude as P -- This can only be done by the logged in user. -- createUser - :: (Consumes CreateUser MimeJSON, MimeRender MimeJSON User) - => User -- ^ "user" - Created user object - -> OpenAPIPetstoreRequest CreateUser MimeJSON NoContent MimeNoContent -createUser user = + :: (Consumes CreateUser contentType, MimeRender contentType User) + => ContentType contentType -- ^ request content-type ('MimeType') + -> User -- ^ "user" - Created user object + -> OpenAPIPetstoreRequest CreateUser contentType NoContent MimeNoContent +createUser _ user = _mkRequest "POST" ["/user"] `setBodyParam` user @@ -78,9 +79,6 @@ data CreateUser -- | /Body Param/ "User" - Created user object instance HasBodyParam CreateUser User --- | @application/json@ -instance Consumes CreateUser MimeJSON - instance Produces CreateUser MimeNoContent @@ -91,10 +89,11 @@ instance Produces CreateUser MimeNoContent -- Creates list of users with given input array -- createUsersWithArrayInput - :: (Consumes CreateUsersWithArrayInput MimeJSON, MimeRender MimeJSON User2) - => User2 -- ^ "user" - List of user object - -> OpenAPIPetstoreRequest CreateUsersWithArrayInput MimeJSON NoContent MimeNoContent -createUsersWithArrayInput user = + :: (Consumes CreateUsersWithArrayInput contentType, MimeRender contentType User2) + => ContentType contentType -- ^ request content-type ('MimeType') + -> User2 -- ^ "user" - List of user object + -> OpenAPIPetstoreRequest CreateUsersWithArrayInput contentType NoContent MimeNoContent +createUsersWithArrayInput _ user = _mkRequest "POST" ["/user/createWithArray"] `setBodyParam` user @@ -103,9 +102,6 @@ data CreateUsersWithArrayInput -- | /Body Param/ "User" - List of user object instance HasBodyParam CreateUsersWithArrayInput User2 --- | @application/json@ -instance Consumes CreateUsersWithArrayInput MimeJSON - instance Produces CreateUsersWithArrayInput MimeNoContent @@ -116,10 +112,11 @@ instance Produces CreateUsersWithArrayInput MimeNoContent -- Creates list of users with given input array -- createUsersWithListInput - :: (Consumes CreateUsersWithListInput MimeJSON, MimeRender MimeJSON User2) - => User2 -- ^ "user" - List of user object - -> OpenAPIPetstoreRequest CreateUsersWithListInput MimeJSON NoContent MimeNoContent -createUsersWithListInput user = + :: (Consumes CreateUsersWithListInput contentType, MimeRender contentType User2) + => ContentType contentType -- ^ request content-type ('MimeType') + -> User2 -- ^ "user" - List of user object + -> OpenAPIPetstoreRequest CreateUsersWithListInput contentType NoContent MimeNoContent +createUsersWithListInput _ user = _mkRequest "POST" ["/user/createWithList"] `setBodyParam` user @@ -128,9 +125,6 @@ data CreateUsersWithListInput -- | /Body Param/ "User" - List of user object instance HasBodyParam CreateUsersWithListInput User2 --- | @application/json@ -instance Consumes CreateUsersWithListInput MimeJSON - instance Produces CreateUsersWithListInput MimeNoContent @@ -223,11 +217,12 @@ instance Produces LogoutUser MimeNoContent -- This can only be done by the logged in user. -- updateUser - :: (Consumes UpdateUser MimeJSON, MimeRender MimeJSON User) - => User -- ^ "user" - Updated user object + :: (Consumes UpdateUser contentType, MimeRender contentType User) + => ContentType contentType -- ^ request content-type ('MimeType') + -> User -- ^ "user" - Updated user object -> Username -- ^ "username" - name that need to be deleted - -> OpenAPIPetstoreRequest UpdateUser MimeJSON NoContent MimeNoContent -updateUser user (Username username) = + -> OpenAPIPetstoreRequest UpdateUser contentType NoContent MimeNoContent +updateUser _ user (Username username) = _mkRequest "PUT" ["/user/",toPath username] `setBodyParam` user @@ -236,8 +231,5 @@ data UpdateUser -- | /Body Param/ "User" - Updated user object instance HasBodyParam UpdateUser User --- | @application/json@ -instance Consumes UpdateUser MimeJSON - instance Produces UpdateUser MimeNoContent diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Client.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Client.hs index d9203a5bd4f..31cd12f7ada 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Client.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Client.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs index 019f2ce6131..6fbc9899d34 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Core.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Logging.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Logging.hs index 3241dbd85a5..8e3d4ac772b 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Logging.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Logging.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/MimeTypes.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/MimeTypes.hs index 33b2868d0fa..0da4b6310f0 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/MimeTypes.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/MimeTypes.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs index f4a0f43dbad..dcbcef0b83f 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/Model.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} @@ -72,14 +72,14 @@ newtype AdditionalMetadata = AdditionalMetadata { unAdditionalMetadata :: Text } -- ** ApiKey newtype ApiKey = ApiKey { unApiKey :: Text } deriving (P.Eq, P.Show) --- ** Body6 -newtype Body6 = Body6 { unBody6 :: Double } deriving (P.Eq, P.Show, A.ToJSON) +-- ** Body +newtype Body = Body { unBody :: Double } deriving (P.Eq, P.Show, A.ToJSON) --- ** Body7 -newtype Body7 = Body7 { unBody7 :: Text } deriving (P.Eq, P.Show, A.ToJSON) +-- ** BodyBool +newtype BodyBool = BodyBool { unBodyBool :: Bool } deriving (P.Eq, P.Show, A.ToJSON) --- ** Body8 -newtype Body8 = Body8 { unBody8 :: Bool } deriving (P.Eq, P.Show, A.ToJSON) +-- ** BodyText +newtype BodyText = BodyText { unBodyText :: Text } deriving (P.Eq, P.Show, A.ToJSON) -- ** Byte newtype Byte = Byte { unByte :: ByteArray } deriving (P.Eq, P.Show) @@ -416,253 +416,6 @@ mkArrayTest = , arrayTestArrayArrayOfModel = Nothing } --- ** Body --- | Body -data Body = Body - { bodyName :: !(Maybe Text) -- ^ "name" - Updated name of the pet - , bodyStatus :: !(Maybe Text) -- ^ "status" - Updated status of the pet - } deriving (P.Show, P.Eq, P.Typeable) - --- | FromJSON Body -instance A.FromJSON Body where - parseJSON = A.withObject "Body" $ \o -> - Body - <$> (o .:? "name") - <*> (o .:? "status") - --- | ToJSON Body -instance A.ToJSON Body where - toJSON Body {..} = - _omitNulls - [ "name" .= bodyName - , "status" .= bodyStatus - ] - - --- | Construct a value of type 'Body' (by applying it's required fields, if any) -mkBody - :: Body -mkBody = - Body - { bodyName = Nothing - , bodyStatus = Nothing - } - --- ** Body1 --- | Body1 -data Body1 = Body1 - { body1AdditionalMetadata :: !(Maybe Text) -- ^ "additionalMetadata" - Additional data to pass to server - , body1File :: !(Maybe FilePath) -- ^ "file" - file to upload - } deriving (P.Show, P.Eq, P.Typeable) - --- | FromJSON Body1 -instance A.FromJSON Body1 where - parseJSON = A.withObject "Body1" $ \o -> - Body1 - <$> (o .:? "additionalMetadata") - <*> (o .:? "file") - --- | ToJSON Body1 -instance A.ToJSON Body1 where - toJSON Body1 {..} = - _omitNulls - [ "additionalMetadata" .= body1AdditionalMetadata - , "file" .= body1File - ] - - --- | Construct a value of type 'Body1' (by applying it's required fields, if any) -mkBody1 - :: Body1 -mkBody1 = - Body1 - { body1AdditionalMetadata = Nothing - , body1File = Nothing - } - --- ** Body2 --- | Body2 -data Body2 = Body2 - { body2EnumFormStringArray :: !(Maybe [E'EnumFormStringArray]) -- ^ "enum_form_string_array" - Form parameter enum test (string array) - , body2EnumFormString :: !(Maybe E'EnumFormString) -- ^ "enum_form_string" - Form parameter enum test (string) - } deriving (P.Show, P.Eq, P.Typeable) - --- | FromJSON Body2 -instance A.FromJSON Body2 where - parseJSON = A.withObject "Body2" $ \o -> - Body2 - <$> (o .:? "enum_form_string_array") - <*> (o .:? "enum_form_string") - --- | ToJSON Body2 -instance A.ToJSON Body2 where - toJSON Body2 {..} = - _omitNulls - [ "enum_form_string_array" .= body2EnumFormStringArray - , "enum_form_string" .= body2EnumFormString - ] - - --- | Construct a value of type 'Body2' (by applying it's required fields, if any) -mkBody2 - :: Body2 -mkBody2 = - Body2 - { body2EnumFormStringArray = Nothing - , body2EnumFormString = Nothing - } - --- ** Body3 --- | Body3 -data Body3 = Body3 - { body3Integer :: !(Maybe Int) -- ^ "integer" - None - , body3Int32 :: !(Maybe Int) -- ^ "int32" - None - , body3Int64 :: !(Maybe Integer) -- ^ "int64" - None - , body3Number :: !(Double) -- ^ /Required/ "number" - None - , body3Float :: !(Maybe Float) -- ^ "float" - None - , body3Double :: !(Double) -- ^ /Required/ "double" - None - , body3String :: !(Maybe Text) -- ^ "string" - None - , body3PatternWithoutDelimiter :: !(Text) -- ^ /Required/ "pattern_without_delimiter" - None - , body3Byte :: !(ByteArray) -- ^ /Required/ "byte" - None - , body3Binary :: !(Maybe FilePath) -- ^ "binary" - None - , body3Date :: !(Maybe Date) -- ^ "date" - None - , body3DateTime :: !(Maybe DateTime) -- ^ "dateTime" - None - , body3Password :: !(Maybe Text) -- ^ "password" - None - , body3Callback :: !(Maybe Text) -- ^ "callback" - None - } deriving (P.Show, P.Eq, P.Typeable) - --- | FromJSON Body3 -instance A.FromJSON Body3 where - parseJSON = A.withObject "Body3" $ \o -> - Body3 - <$> (o .:? "integer") - <*> (o .:? "int32") - <*> (o .:? "int64") - <*> (o .: "number") - <*> (o .:? "float") - <*> (o .: "double") - <*> (o .:? "string") - <*> (o .: "pattern_without_delimiter") - <*> (o .: "byte") - <*> (o .:? "binary") - <*> (o .:? "date") - <*> (o .:? "dateTime") - <*> (o .:? "password") - <*> (o .:? "callback") - --- | ToJSON Body3 -instance A.ToJSON Body3 where - toJSON Body3 {..} = - _omitNulls - [ "integer" .= body3Integer - , "int32" .= body3Int32 - , "int64" .= body3Int64 - , "number" .= body3Number - , "float" .= body3Float - , "double" .= body3Double - , "string" .= body3String - , "pattern_without_delimiter" .= body3PatternWithoutDelimiter - , "byte" .= body3Byte - , "binary" .= body3Binary - , "date" .= body3Date - , "dateTime" .= body3DateTime - , "password" .= body3Password - , "callback" .= body3Callback - ] - - --- | Construct a value of type 'Body3' (by applying it's required fields, if any) -mkBody3 - :: Double -- ^ 'body3Number': None - -> Double -- ^ 'body3Double': None - -> Text -- ^ 'body3PatternWithoutDelimiter': None - -> ByteArray -- ^ 'body3Byte': None - -> Body3 -mkBody3 body3Number body3Double body3PatternWithoutDelimiter body3Byte = - Body3 - { body3Integer = Nothing - , body3Int32 = Nothing - , body3Int64 = Nothing - , body3Number - , body3Float = Nothing - , body3Double - , body3String = Nothing - , body3PatternWithoutDelimiter - , body3Byte - , body3Binary = Nothing - , body3Date = Nothing - , body3DateTime = Nothing - , body3Password = Nothing - , body3Callback = Nothing - } - --- ** Body4 --- | Body4 -data Body4 = Body4 - { body4Param :: !(Text) -- ^ /Required/ "param" - field1 - , body4Param2 :: !(Text) -- ^ /Required/ "param2" - field2 - } deriving (P.Show, P.Eq, P.Typeable) - --- | FromJSON Body4 -instance A.FromJSON Body4 where - parseJSON = A.withObject "Body4" $ \o -> - Body4 - <$> (o .: "param") - <*> (o .: "param2") - --- | ToJSON Body4 -instance A.ToJSON Body4 where - toJSON Body4 {..} = - _omitNulls - [ "param" .= body4Param - , "param2" .= body4Param2 - ] - - --- | Construct a value of type 'Body4' (by applying it's required fields, if any) -mkBody4 - :: Text -- ^ 'body4Param': field1 - -> Text -- ^ 'body4Param2': field2 - -> Body4 -mkBody4 body4Param body4Param2 = - Body4 - { body4Param - , body4Param2 - } - --- ** Body5 --- | Body5 -data Body5 = Body5 - { body5AdditionalMetadata :: !(Maybe Text) -- ^ "additionalMetadata" - Additional data to pass to server - , body5RequiredFile :: !(FilePath) -- ^ /Required/ "requiredFile" - file to upload - } deriving (P.Show, P.Eq, P.Typeable) - --- | FromJSON Body5 -instance A.FromJSON Body5 where - parseJSON = A.withObject "Body5" $ \o -> - Body5 - <$> (o .:? "additionalMetadata") - <*> (o .: "requiredFile") - --- | ToJSON Body5 -instance A.ToJSON Body5 where - toJSON Body5 {..} = - _omitNulls - [ "additionalMetadata" .= body5AdditionalMetadata - , "requiredFile" .= body5RequiredFile - ] - - --- | Construct a value of type 'Body5' (by applying it's required fields, if any) -mkBody5 - :: FilePath -- ^ 'body5RequiredFile': file to upload - -> Body5 -mkBody5 body5RequiredFile = - Body5 - { body5AdditionalMetadata = Nothing - , body5RequiredFile - } - -- ** Capitalization -- | Capitalization data Capitalization = Capitalization @@ -1130,7 +883,7 @@ data MapTest = MapTest { mapTestMapMapOfString :: !(Maybe (Map.Map String (Map.Map String Text))) -- ^ "map_map_of_string" , mapTestMapOfEnumString :: !(Maybe (Map.Map String E'Inner)) -- ^ "map_of_enum_string" , mapTestDirectMap :: !(Maybe (Map.Map String Bool)) -- ^ "direct_map" - , mapTestIndirectMap :: !(Maybe StringBooleanMap) -- ^ "indirect_map" + , mapTestIndirectMap :: !(Maybe (Map.Map String Bool)) -- ^ "indirect_map" } deriving (P.Show, P.Eq, P.Typeable) -- | FromJSON MapTest diff --git a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs index 317dbe109c8..a093ca73ca0 100644 --- a/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs +++ b/samples/client/petstore/haskell-http-client/lib/OpenAPIPetstore/ModelLens.hs @@ -3,7 +3,7 @@ This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - OpenAPI Version: 3.0.0 + OpenAPI Version: 3.0.1 OpenAPI Petstore API version: 1.0.0 Generated by OpenAPI Generator (https://openapi-generator.tech) -} @@ -124,150 +124,6 @@ arrayTestArrayArrayOfModelL f ArrayTest{..} = (\arrayTestArrayArrayOfModel -> Ar --- * Body - --- | 'bodyName' Lens -bodyNameL :: Lens_' Body (Maybe Text) -bodyNameL f Body{..} = (\bodyName -> Body { bodyName, ..} ) <$> f bodyName -{-# INLINE bodyNameL #-} - --- | 'bodyStatus' Lens -bodyStatusL :: Lens_' Body (Maybe Text) -bodyStatusL f Body{..} = (\bodyStatus -> Body { bodyStatus, ..} ) <$> f bodyStatus -{-# INLINE bodyStatusL #-} - - - --- * Body1 - --- | 'body1AdditionalMetadata' Lens -body1AdditionalMetadataL :: Lens_' Body1 (Maybe Text) -body1AdditionalMetadataL f Body1{..} = (\body1AdditionalMetadata -> Body1 { body1AdditionalMetadata, ..} ) <$> f body1AdditionalMetadata -{-# INLINE body1AdditionalMetadataL #-} - --- | 'body1File' Lens -body1FileL :: Lens_' Body1 (Maybe FilePath) -body1FileL f Body1{..} = (\body1File -> Body1 { body1File, ..} ) <$> f body1File -{-# INLINE body1FileL #-} - - - --- * Body2 - --- | 'body2EnumFormStringArray' Lens -body2EnumFormStringArrayL :: Lens_' Body2 (Maybe [E'EnumFormStringArray]) -body2EnumFormStringArrayL f Body2{..} = (\body2EnumFormStringArray -> Body2 { body2EnumFormStringArray, ..} ) <$> f body2EnumFormStringArray -{-# INLINE body2EnumFormStringArrayL #-} - --- | 'body2EnumFormString' Lens -body2EnumFormStringL :: Lens_' Body2 (Maybe E'EnumFormString) -body2EnumFormStringL f Body2{..} = (\body2EnumFormString -> Body2 { body2EnumFormString, ..} ) <$> f body2EnumFormString -{-# INLINE body2EnumFormStringL #-} - - - --- * Body3 - --- | 'body3Integer' Lens -body3IntegerL :: Lens_' Body3 (Maybe Int) -body3IntegerL f Body3{..} = (\body3Integer -> Body3 { body3Integer, ..} ) <$> f body3Integer -{-# INLINE body3IntegerL #-} - --- | 'body3Int32' Lens -body3Int32L :: Lens_' Body3 (Maybe Int) -body3Int32L f Body3{..} = (\body3Int32 -> Body3 { body3Int32, ..} ) <$> f body3Int32 -{-# INLINE body3Int32L #-} - --- | 'body3Int64' Lens -body3Int64L :: Lens_' Body3 (Maybe Integer) -body3Int64L f Body3{..} = (\body3Int64 -> Body3 { body3Int64, ..} ) <$> f body3Int64 -{-# INLINE body3Int64L #-} - --- | 'body3Number' Lens -body3NumberL :: Lens_' Body3 (Double) -body3NumberL f Body3{..} = (\body3Number -> Body3 { body3Number, ..} ) <$> f body3Number -{-# INLINE body3NumberL #-} - --- | 'body3Float' Lens -body3FloatL :: Lens_' Body3 (Maybe Float) -body3FloatL f Body3{..} = (\body3Float -> Body3 { body3Float, ..} ) <$> f body3Float -{-# INLINE body3FloatL #-} - --- | 'body3Double' Lens -body3DoubleL :: Lens_' Body3 (Double) -body3DoubleL f Body3{..} = (\body3Double -> Body3 { body3Double, ..} ) <$> f body3Double -{-# INLINE body3DoubleL #-} - --- | 'body3String' Lens -body3StringL :: Lens_' Body3 (Maybe Text) -body3StringL f Body3{..} = (\body3String -> Body3 { body3String, ..} ) <$> f body3String -{-# INLINE body3StringL #-} - --- | 'body3PatternWithoutDelimiter' Lens -body3PatternWithoutDelimiterL :: Lens_' Body3 (Text) -body3PatternWithoutDelimiterL f Body3{..} = (\body3PatternWithoutDelimiter -> Body3 { body3PatternWithoutDelimiter, ..} ) <$> f body3PatternWithoutDelimiter -{-# INLINE body3PatternWithoutDelimiterL #-} - --- | 'body3Byte' Lens -body3ByteL :: Lens_' Body3 (ByteArray) -body3ByteL f Body3{..} = (\body3Byte -> Body3 { body3Byte, ..} ) <$> f body3Byte -{-# INLINE body3ByteL #-} - --- | 'body3Binary' Lens -body3BinaryL :: Lens_' Body3 (Maybe FilePath) -body3BinaryL f Body3{..} = (\body3Binary -> Body3 { body3Binary, ..} ) <$> f body3Binary -{-# INLINE body3BinaryL #-} - --- | 'body3Date' Lens -body3DateL :: Lens_' Body3 (Maybe Date) -body3DateL f Body3{..} = (\body3Date -> Body3 { body3Date, ..} ) <$> f body3Date -{-# INLINE body3DateL #-} - --- | 'body3DateTime' Lens -body3DateTimeL :: Lens_' Body3 (Maybe DateTime) -body3DateTimeL f Body3{..} = (\body3DateTime -> Body3 { body3DateTime, ..} ) <$> f body3DateTime -{-# INLINE body3DateTimeL #-} - --- | 'body3Password' Lens -body3PasswordL :: Lens_' Body3 (Maybe Text) -body3PasswordL f Body3{..} = (\body3Password -> Body3 { body3Password, ..} ) <$> f body3Password -{-# INLINE body3PasswordL #-} - --- | 'body3Callback' Lens -body3CallbackL :: Lens_' Body3 (Maybe Text) -body3CallbackL f Body3{..} = (\body3Callback -> Body3 { body3Callback, ..} ) <$> f body3Callback -{-# INLINE body3CallbackL #-} - - - --- * Body4 - --- | 'body4Param' Lens -body4ParamL :: Lens_' Body4 (Text) -body4ParamL f Body4{..} = (\body4Param -> Body4 { body4Param, ..} ) <$> f body4Param -{-# INLINE body4ParamL #-} - --- | 'body4Param2' Lens -body4Param2L :: Lens_' Body4 (Text) -body4Param2L f Body4{..} = (\body4Param2 -> Body4 { body4Param2, ..} ) <$> f body4Param2 -{-# INLINE body4Param2L #-} - - - --- * Body5 - --- | 'body5AdditionalMetadata' Lens -body5AdditionalMetadataL :: Lens_' Body5 (Maybe Text) -body5AdditionalMetadataL f Body5{..} = (\body5AdditionalMetadata -> Body5 { body5AdditionalMetadata, ..} ) <$> f body5AdditionalMetadata -{-# INLINE body5AdditionalMetadataL #-} - --- | 'body5RequiredFile' Lens -body5RequiredFileL :: Lens_' Body5 (FilePath) -body5RequiredFileL f Body5{..} = (\body5RequiredFile -> Body5 { body5RequiredFile, ..} ) <$> f body5RequiredFile -{-# INLINE body5RequiredFileL #-} - - - -- * Capitalization -- | 'capitalizationSmallCamel' Lens @@ -543,7 +399,7 @@ mapTestDirectMapL f MapTest{..} = (\mapTestDirectMap -> MapTest { mapTestDirectM {-# INLINE mapTestDirectMapL #-} -- | 'mapTestIndirectMap' Lens -mapTestIndirectMapL :: Lens_' MapTest (Maybe StringBooleanMap) +mapTestIndirectMapL :: Lens_' MapTest (Maybe (Map.Map String Bool)) mapTestIndirectMapL f MapTest{..} = (\mapTestIndirectMap -> MapTest { mapTestIndirectMap, ..} ) <$> f mapTestIndirectMap {-# INLINE mapTestIndirectMapL #-} diff --git a/samples/client/petstore/haskell-http-client/openapi-petstore.cabal b/samples/client/petstore/haskell-http-client/openapi-petstore.cabal index 456867d6512..a4c4bbb6e9f 100644 --- a/samples/client/petstore/haskell-http-client/openapi-petstore.cabal +++ b/samples/client/petstore/haskell-http-client/openapi-petstore.cabal @@ -10,7 +10,7 @@ description: . . OpenAPI Petstore API version: 1.0.0 . - OpenAPI version: 3.0.0 + OpenAPI version: 3.0.1 . category: Web homepage: https://openapi-generator.tech diff --git a/samples/client/petstore/haskell-http-client/openapi.yaml b/samples/client/petstore/haskell-http-client/openapi.yaml index 688703b430a..4009731809f 100644 --- a/samples/client/petstore/haskell-http-client/openapi.yaml +++ b/samples/client/petstore/haskell-http-client/openapi.yaml @@ -1,4 +1,4 @@ -openapi: 3.0.0 +openapi: 3.0.1 info: description: 'This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: @@ -22,9 +22,18 @@ paths: post: operationId: addPet requestBody: - $ref: '#/components/requestBodies/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 responses: 405: + content: {} description: Invalid input security: - petstore_auth: @@ -36,13 +45,24 @@ paths: put: operationId: updatePet requestBody: - $ref: '#/components/requestBodies/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 responses: 400: + content: {} description: Invalid ID supplied 404: + content: {} description: Pet not found 405: + content: {} description: Validation exception security: - petstore_auth: @@ -86,6 +106,7 @@ paths: type: array description: successful operation 400: + content: {} description: Invalid status value security: - petstore_auth: @@ -125,6 +146,7 @@ paths: type: array description: successful operation 400: + content: {} description: Invalid tag value security: - petstore_auth: @@ -137,24 +159,20 @@ paths: delete: operationId: deletePet parameters: - - explode: false - in: header + - in: header name: api_key - required: false schema: type: string - style: simple - description: Pet id to delete - explode: false in: path name: petId required: true schema: format: int64 type: integer - style: simple responses: 400: + content: {} description: Invalid pet value security: - petstore_auth: @@ -168,14 +186,12 @@ paths: operationId: getPetById parameters: - description: ID of pet to return - explode: false in: path name: petId required: true schema: format: int64 type: integer - style: simple responses: 200: content: @@ -187,8 +203,10 @@ paths: $ref: '#/components/schemas/Pet' description: successful operation 400: + content: {} description: Invalid ID supplied 404: + content: {} description: Pet not found security: - api_key: [] @@ -199,21 +217,26 @@ paths: operationId: updatePetWithForm parameters: - description: ID of pet that needs to be updated - explode: false in: path name: petId required: true schema: format: int64 type: integer - style: simple requestBody: content: application/x-www-form-urlencoded: schema: - $ref: '#/components/schemas/body' + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string responses: 405: + content: {} description: Invalid input security: - petstore_auth: @@ -227,19 +250,24 @@ paths: operationId: uploadFile parameters: - description: ID of pet to update - explode: false in: path name: petId required: true schema: format: int64 type: integer - style: simple requestBody: content: multipart/form-data: schema: - $ref: '#/components/schemas/body_1' + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string responses: 200: content: @@ -278,7 +306,7 @@ paths: operationId: placeOrder requestBody: content: - application/json: + '*/*': schema: $ref: '#/components/schemas/Order' description: order placed for purchasing the pet @@ -294,6 +322,7 @@ paths: $ref: '#/components/schemas/Order' description: successful operation 400: + content: {} description: Invalid Order summary: Place an order for a pet tags: @@ -304,17 +333,17 @@ paths: operationId: deleteOrder parameters: - description: ID of the order that needs to be deleted - explode: false in: path name: order_id required: true schema: type: string - style: simple responses: 400: + content: {} description: Invalid ID supplied 404: + content: {} description: Order not found summary: Delete purchase order by ID tags: @@ -324,7 +353,6 @@ paths: operationId: getOrderById parameters: - description: ID of pet that needs to be fetched - explode: false in: path name: order_id required: true @@ -333,7 +361,6 @@ paths: maximum: 5 minimum: 1 type: integer - style: simple responses: 200: content: @@ -345,8 +372,10 @@ paths: $ref: '#/components/schemas/Order' description: successful operation 400: + content: {} description: Invalid ID supplied 404: + content: {} description: Order not found summary: Find purchase order by ID tags: @@ -357,13 +386,14 @@ paths: operationId: createUser requestBody: content: - application/json: + '*/*': schema: $ref: '#/components/schemas/User' description: Created user object required: true responses: default: + content: {} description: successful operation summary: Create user tags: @@ -372,9 +402,17 @@ paths: post: operationId: createUsersWithArrayInput requestBody: - $ref: '#/components/requestBodies/UserArray' + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true responses: default: + content: {} description: successful operation summary: Creates list of users with given input array tags: @@ -383,9 +421,17 @@ paths: post: operationId: createUsersWithListInput requestBody: - $ref: '#/components/requestBodies/UserArray' + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true responses: default: + content: {} description: successful operation summary: Creates list of users with given input array tags: @@ -395,21 +441,17 @@ paths: operationId: loginUser parameters: - description: The user name for login - explode: true in: query name: username required: true schema: type: string - style: form - description: The password for login in clear text - explode: true in: query name: password required: true schema: type: string - style: form responses: 200: content: @@ -423,19 +465,16 @@ paths: headers: X-Rate-Limit: description: calls per hour allowed by the user - explode: false schema: format: int32 type: integer - style: simple X-Expires-After: description: date in UTC when token expires - explode: false schema: format: date-time type: string - style: simple 400: + content: {} description: Invalid username/password supplied summary: Logs user into the system tags: @@ -445,6 +484,7 @@ paths: operationId: logoutUser responses: default: + content: {} description: successful operation summary: Logs out current logged in user session tags: @@ -455,17 +495,17 @@ paths: operationId: deleteUser parameters: - description: The name that needs to be deleted - explode: false in: path name: username required: true schema: type: string - style: simple responses: 400: + content: {} description: Invalid username supplied 404: + content: {} description: User not found summary: Delete user tags: @@ -474,13 +514,11 @@ paths: operationId: getUserByName parameters: - description: The name that needs to be fetched. Use user1 for testing. - explode: false in: path name: username required: true schema: type: string - style: simple responses: 200: content: @@ -492,8 +530,10 @@ paths: $ref: '#/components/schemas/User' description: successful operation 400: + content: {} description: Invalid username supplied 404: + content: {} description: User not found summary: Get user by user name tags: @@ -503,24 +543,24 @@ paths: operationId: updateUser parameters: - description: name that need to be deleted - explode: false in: path name: username required: true schema: type: string - style: simple requestBody: content: - application/json: + '*/*': schema: $ref: '#/components/schemas/User' description: Updated user object required: true responses: 400: + content: {} description: Invalid user supplied 404: + content: {} description: User not found summary: Updated user tags: @@ -530,7 +570,12 @@ paths: description: To test class name in snake case operationId: testClassname requestBody: - $ref: '#/components/requestBodies/Client' + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true responses: 200: content: @@ -552,7 +597,6 @@ paths: explode: false in: header name: enum_header_string_array - required: false schema: items: default: $ @@ -563,10 +607,8 @@ paths: type: array style: simple - description: Header parameter enum test (string) - explode: false in: header name: enum_header_string - required: false schema: default: -efg enum: @@ -574,12 +616,10 @@ paths: - -efg - (xyz) type: string - style: simple - description: Query parameter enum test (string array) - explode: true + explode: false in: query name: enum_query_string_array - required: false schema: items: default: $ @@ -590,10 +630,8 @@ paths: type: array style: form - description: Query parameter enum test (string) - explode: true in: query name: enum_query_string - required: false schema: default: -efg enum: @@ -601,40 +639,52 @@ paths: - -efg - (xyz) type: string - style: form - description: Query parameter enum test (double) - explode: true in: query name: enum_query_integer - required: false schema: enum: - 1 - -2 format: int32 type: integer - style: form - description: Query parameter enum test (double) - explode: true in: query name: enum_query_double - required: false schema: enum: - 1.1 - -1.2 format: double type: number - style: form requestBody: content: application/x-www-form-urlencoded: schema: - $ref: '#/components/schemas/body_2' + properties: + enum_form_string_array: + description: Form parameter enum test (string array) + items: + default: $ + enum: + - '>' + - $ + type: string + type: array + enum_form_string: + default: -efg + description: Form parameter enum test (string) + enum: + - _abc + - -efg + - (xyz) + type: string responses: 400: + content: {} description: Invalid request 404: + content: {} description: Not found summary: To test enum parameters tags: @@ -643,7 +693,12 @@ paths: description: To test "client" model operationId: testClientModel requestBody: - $ref: '#/components/requestBodies/Client' + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true responses: 200: content: @@ -665,11 +720,83 @@ paths: content: application/x-www-form-urlencoded: schema: - $ref: '#/components/schemas/body_3' + properties: + integer: + description: None + maximum: 100 + minimum: 10 + type: integer + int32: + description: None + format: int32 + maximum: 200 + minimum: 20 + type: integer + int64: + description: None + format: int64 + type: integer + number: + description: None + maximum: 543.2 + minimum: 32.1 + type: number + float: + description: None + format: float + maximum: 987.6 + type: number + double: + description: None + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + description: None + pattern: /[a-z]/i + type: string + pattern_without_delimiter: + description: None + pattern: ^[A-Z].* + type: string + byte: + description: None + format: byte + type: string + binary: + description: None + format: binary + type: string + date: + description: None + format: date + type: string + dateTime: + description: None + format: date-time + type: string + password: + description: None + format: password + maxLength: 64 + minLength: 10 + type: string + callback: + description: None + type: string + required: + - byte + - double + - number + - pattern_without_delimiter + required: true responses: 400: + content: {} description: Invalid username supplied 404: + content: {} description: User not found security: - http_basic_test: [] @@ -686,10 +813,11 @@ paths: operationId: fakeOuterNumberSerialize requestBody: content: - application/json: + '*/*': schema: $ref: '#/components/schemas/OuterNumber' description: Input number as post body + required: false responses: 200: content: @@ -705,10 +833,11 @@ paths: operationId: fakeOuterStringSerialize requestBody: content: - application/json: + '*/*': schema: $ref: '#/components/schemas/OuterString' description: Input string as post body + required: false responses: 200: content: @@ -724,10 +853,11 @@ paths: operationId: fakeOuterBooleanSerialize requestBody: content: - application/json: + '*/*': schema: $ref: '#/components/schemas/OuterBoolean' description: Input boolean as post body + required: false responses: 200: content: @@ -743,10 +873,11 @@ paths: operationId: fakeOuterCompositeSerialize requestBody: content: - application/json: + '*/*': schema: $ref: '#/components/schemas/OuterComposite' description: Input composite as post body + required: false responses: 200: content: @@ -763,9 +894,20 @@ paths: content: application/x-www-form-urlencoded: schema: - $ref: '#/components/schemas/body_4' + properties: + param: + description: field1 + type: string + param2: + description: field2 + type: string + required: + - param + - param2 + required: true responses: 200: + content: {} description: successful operation summary: test json serialization of form data tags: @@ -784,6 +926,7 @@ paths: required: true responses: 200: + content: {} description: successful operation summary: test inline additionalProperties tags: @@ -792,13 +935,11 @@ paths: put: operationId: testBodyWithQueryParams parameters: - - explode: true - in: query + - in: query name: query required: true schema: type: string - style: form requestBody: content: application/json: @@ -807,6 +948,7 @@ paths: required: true responses: 200: + content: {} description: Success tags: - fake @@ -815,7 +957,12 @@ paths: description: To test special tags and operation ID starting with number operationId: 123_test_@#$%_special_tags requestBody: - $ref: '#/components/requestBodies/Client' + content: + application/json: + schema: + $ref: '#/components/schemas/Client' + description: client model + required: true responses: 200: content: @@ -838,6 +985,7 @@ paths: required: true responses: 200: + content: {} description: Success tags: - fake @@ -846,19 +994,27 @@ paths: operationId: uploadFileWithRequiredFile parameters: - description: ID of pet to update - explode: false in: path name: petId required: true schema: format: int64 type: integer - style: simple requestBody: content: multipart/form-data: schema: - $ref: '#/components/schemas/body_5' + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + requiredFile: + description: file to upload + format: binary + type: string + required: + - requiredFile + required: true responses: 200: content: @@ -874,68 +1030,7 @@ paths: tags: - pet components: - requestBodies: - UserArray: - content: - application/json: - schema: - items: - $ref: '#/components/schemas/User' - type: array - description: List of user object - required: true - Client: - content: - application/json: - schema: - $ref: '#/components/schemas/Client' - description: client model - 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 schemas: - Order: - example: - petId: 6 - quantity: 1 - id: 0 - shipDate: 2000-01-23T04:56:07.000+00:00 - complete: false - status: placed - properties: - id: - format: int64 - type: integer - petId: - format: int64 - type: integer - quantity: - format: int32 - type: integer - shipDate: - format: date-time - type: string - status: - description: Order Status - enum: - - placed - - approved - - delivered - type: string - complete: - default: false - type: boolean - type: object - xml: - name: Order Category: example: name: name @@ -983,6 +1078,419 @@ components: type: object xml: name: User + OuterNumber: + type: number + ArrayOfNumberOnly: + properties: + ArrayNumber: + items: + type: number + type: array + type: object + Capitalization: + properties: + smallCamel: + type: string + CapitalCamel: + type: string + small_Snake: + type: string + Capital_Snake: + type: string + SCA_ETH_Flow_Points: + type: string + ATT_NAME: + description: | + Name of the pet + type: string + type: object + MixedPropertiesAndAdditionalPropertiesClass: + properties: + uuid: + format: uuid + type: string + dateTime: + format: date-time + type: string + map: + additionalProperties: + $ref: '#/components/schemas/Animal' + type: object + type: object + ApiResponse: + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + type: object + Name: + description: Model for testing model name same as property name + properties: + name: + format: int32 + type: integer + snake_case: + format: int32 + readOnly: true + type: integer + property: + type: string + 123Number: + readOnly: true + type: integer + required: + - name + type: object + xml: + name: Name + EnumClass: + default: -efg + enum: + - _abc + - -efg + - (xyz) + type: string + List: + properties: + 123-list: + type: string + type: object + NumberOnly: + properties: + JustNumber: + type: number + type: object + 200_response: + description: Model for testing model name starting with number + properties: + name: + format: int32 + type: integer + class: + type: string + type: object + xml: + name: Name + Client: + example: + client: client + properties: + client: + type: string + type: object + Dog: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + breed: + type: string + type: object + Enum_Test: + properties: + enum_string: + enum: + - UPPER + - lower + - "" + type: string + enum_string_required: + enum: + - UPPER + - lower + - "" + type: string + enum_integer: + enum: + - 1 + - -1 + format: int32 + type: integer + enum_number: + enum: + - 1.1 + - -1.2 + format: double + type: number + outerEnum: + $ref: '#/components/schemas/OuterEnum' + required: + - enum_string_required + type: object + Order: + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + type: object + xml: + name: Order + AdditionalPropertiesClass: + properties: + map_property: + additionalProperties: + type: string + type: object + map_of_map_property: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + type: object + $special[model.name]: + properties: + $special[property.name]: + format: int64 + type: integer + type: object + xml: + name: $special[model.name] + Return: + description: Model for testing reserved words + properties: + return: + format: int32 + type: integer + type: object + xml: + name: Return + ReadOnlyFirst: + properties: + bar: + readOnly: true + type: string + baz: + type: string + type: object + ArrayOfArrayOfNumberOnly: + properties: + ArrayArrayNumber: + items: + items: + type: number + type: array + type: array + type: object + OuterEnum: + enum: + - placed + - approved + - delivered + type: string + ArrayTest: + properties: + array_of_string: + items: + type: string + type: array + array_array_of_integer: + items: + items: + format: int64 + type: integer + type: array + type: array + array_array_of_model: + items: + items: + $ref: '#/components/schemas/ReadOnlyFirst' + type: array + type: array + type: object + OuterComposite: + example: + my_string: my_string + my_number: 0.80082819046101150206595775671303272247314453125 + my_boolean: true + properties: + my_number: + type: number + my_string: + type: string + my_boolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + type: object + format_test: + properties: + integer: + maximum: 1E+2 + minimum: 1E+1 + type: integer + int32: + format: int32 + maximum: 2E+2 + minimum: 2E+1 + type: integer + int64: + format: int64 + type: integer + number: + maximum: 543.2 + minimum: 32.1 + type: number + float: + format: float + maximum: 987.6 + minimum: 54.3 + type: number + double: + format: double + maximum: 123.4 + minimum: 67.8 + type: number + string: + pattern: /[a-z]/i + type: string + byte: + format: byte + pattern: ^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$ + type: string + binary: + format: binary + type: string + date: + format: date + type: string + dateTime: + format: date-time + type: string + uuid: + format: uuid + type: string + password: + format: password + maxLength: 64 + minLength: 10 + type: string + required: + - byte + - date + - number + - password + type: object + EnumArrays: + properties: + just_symbol: + enum: + - '>=' + - $ + type: string + array_enum: + items: + enum: + - fish + - crab + type: string + type: array + type: object + OuterString: + type: string + ClassModel: + description: Model for testing model with "_class" property + properties: + _class: + type: string + type: object + OuterBoolean: + type: boolean + x-codegen-body-parameter-name: boolean_post_body + FileSchemaTestClass: + example: + file: + sourceURI: sourceURI + files: + - sourceURI: sourceURI + - sourceURI: sourceURI + properties: + file: + $ref: '#/components/schemas/File' + files: + items: + $ref: '#/components/schemas/File' + type: array + type: object + Animal: + discriminator: + propertyName: className + properties: + className: + type: string + color: + default: red + type: string + required: + - className + type: object + StringBooleanMap: + additionalProperties: + type: boolean + type: object + Cat: + allOf: + - $ref: '#/components/schemas/Animal' + - properties: + declawed: + type: boolean + type: object + MapTest: + properties: + map_map_of_string: + additionalProperties: + additionalProperties: + type: string + type: object + type: object + map_of_enum_string: + additionalProperties: + enum: + - UPPER + - lower + type: string + type: object + direct_map: + additionalProperties: + type: boolean + type: object + indirect_map: + additionalProperties: + type: boolean + type: object + type: object Tag: example: name: name @@ -996,6 +1504,19 @@ components: type: object xml: name: Tag + AnimalFarm: + items: + $ref: '#/components/schemas/Animal' + type: array + File: + description: Must be named `File` for test. + example: + sourceURI: sourceURI + properties: + sourceURI: + description: Test capitalization + type: string + type: object Pet: example: photoUrls: @@ -1049,235 +1570,6 @@ components: type: object xml: name: Pet - ApiResponse: - example: - code: 0 - type: type - message: message - properties: - code: - format: int32 - type: integer - type: - type: string - message: - type: string - type: object - Return: - description: Model for testing reserved words - properties: - return: - format: int32 - type: integer - xml: - name: Return - Name: - description: Model for testing model name same as property name - properties: - name: - format: int32 - type: integer - snake_case: - format: int32 - readOnly: true - type: integer - property: - type: string - 123Number: - format: int32 - readOnly: true - type: integer - required: - - name - xml: - name: Name - 200_response: - description: Model for testing model name starting with number - properties: - name: - format: int32 - type: integer - class: - type: string - xml: - name: Name - ClassModel: - description: Model for testing model with "_class" property - properties: - _class: - type: string - Dog: - allOf: - - $ref: '#/components/schemas/Animal' - - properties: - breed: - type: string - type: object - Cat: - allOf: - - $ref: '#/components/schemas/Animal' - - properties: - declawed: - type: boolean - type: object - Animal: - discriminator: - propertyName: className - properties: - className: - type: string - color: - default: red - type: string - required: - - className - type: object - AnimalFarm: - items: - $ref: '#/components/schemas/Animal' - type: array - format_test: - properties: - integer: - format: int32 - maximum: 100 - minimum: 10 - type: integer - int32: - format: int32 - maximum: 200 - minimum: 20 - type: integer - int64: - format: int64 - type: integer - number: - maximum: 543.2 - minimum: 32.1 - type: number - float: - format: float - maximum: 987.6 - minimum: 54.3 - type: number - double: - format: double - maximum: 123.4 - minimum: 67.8 - type: number - string: - pattern: /[a-z]/i - type: string - byte: - format: byte - type: string - binary: - format: binary - type: string - date: - format: date - type: string - dateTime: - format: date-time - type: string - uuid: - format: uuid - type: string - password: - format: password - maxLength: 64 - minLength: 10 - type: string - required: - - byte - - date - - number - - password - type: object - EnumClass: - default: -efg - enum: - - _abc - - -efg - - (xyz) - type: string - Enum_Test: - properties: - enum_string: - enum: - - UPPER - - lower - - "" - type: string - enum_string_required: - enum: - - UPPER - - lower - - "" - type: string - enum_integer: - enum: - - 1 - - -1 - format: int32 - type: integer - enum_number: - enum: - - 1.1 - - -1.2 - format: double - type: number - outerEnum: - $ref: '#/components/schemas/OuterEnum' - required: - - enum_string_required - type: object - AdditionalPropertiesClass: - properties: - map_property: - additionalProperties: - type: string - type: object - map_of_map_property: - additionalProperties: - additionalProperties: - type: string - type: object - type: object - type: object - MixedPropertiesAndAdditionalPropertiesClass: - properties: - uuid: - format: uuid - type: string - dateTime: - format: date-time - type: string - map: - additionalProperties: - $ref: '#/components/schemas/Animal' - type: object - type: object - List: - properties: - 123-list: - type: string - type: object - Client: - example: - client: client - properties: - client: - type: string - type: object - ReadOnlyFirst: - properties: - bar: - readOnly: true - type: string - baz: - type: string - type: object hasOnlyReadOnly: properties: bar: @@ -1287,298 +1579,6 @@ components: readOnly: true type: string type: object - Capitalization: - properties: - smallCamel: - type: string - CapitalCamel: - type: string - small_Snake: - type: string - Capital_Snake: - type: string - SCA_ETH_Flow_Points: - type: string - ATT_NAME: - description: | - Name of the pet - type: string - type: object - MapTest: - properties: - map_map_of_string: - additionalProperties: - additionalProperties: - type: string - type: object - type: object - map_of_enum_string: - additionalProperties: - enum: - - UPPER - - lower - type: string - type: object - direct_map: - additionalProperties: - type: boolean - type: object - indirect_map: - $ref: '#/components/schemas/StringBooleanMap' - type: object - ArrayTest: - properties: - array_of_string: - items: - type: string - type: array - array_array_of_integer: - items: - items: - format: int64 - type: integer - type: array - type: array - array_array_of_model: - items: - items: - $ref: '#/components/schemas/ReadOnlyFirst' - type: array - type: array - type: object - NumberOnly: - properties: - JustNumber: - type: number - type: object - ArrayOfNumberOnly: - properties: - ArrayNumber: - items: - type: number - type: array - type: object - ArrayOfArrayOfNumberOnly: - properties: - ArrayArrayNumber: - items: - items: - type: number - type: array - type: array - type: object - EnumArrays: - properties: - just_symbol: - enum: - - '>=' - - $ - type: string - array_enum: - items: - enum: - - fish - - crab - type: string - type: array - type: object - OuterEnum: - enum: - - placed - - approved - - delivered - type: string - OuterComposite: - example: - my_string: my_string - my_number: 0.80082819046101150206595775671303272247314453125 - my_boolean: true - properties: - my_number: - type: number - my_string: - type: string - my_boolean: - type: boolean - x-codegen-body-parameter-name: boolean_post_body - type: object - OuterNumber: - type: number - OuterString: - type: string - OuterBoolean: - type: boolean - x-codegen-body-parameter-name: boolean_post_body - StringBooleanMap: - additionalProperties: - type: boolean - FileSchemaTestClass: - example: - file: - sourceURI: sourceURI - files: - - sourceURI: sourceURI - - sourceURI: sourceURI - properties: - file: - $ref: '#/components/schemas/File' - files: - items: - $ref: '#/components/schemas/File' - type: array - type: object - File: - description: Must be named `File` for test. - example: - sourceURI: sourceURI - properties: - sourceURI: - description: Test capitalization - type: string - type: object - _special_model.name_: - properties: - $special[property.name]: - format: int64 - type: integer - xml: - name: $special[model.name] - body: - properties: - name: - description: Updated name of the pet - type: string - status: - description: Updated status of the pet - type: string - type: object - body_1: - properties: - additionalMetadata: - description: Additional data to pass to server - type: string - file: - description: file to upload - format: binary - type: string - type: object - body_2: - properties: - enum_form_string_array: - description: Form parameter enum test (string array) - items: - default: $ - enum: - - '>' - - $ - type: string - type: array - enum_form_string: - default: -efg - description: Form parameter enum test (string) - enum: - - _abc - - -efg - - (xyz) - type: string - type: object - body_3: - properties: - integer: - description: None - format: int32 - maximum: 100 - minimum: 10 - type: integer - int32: - description: None - format: int32 - maximum: 200 - minimum: 20 - type: integer - int64: - description: None - format: int64 - type: integer - number: - description: None - maximum: 543.2 - minimum: 32.1 - type: number - float: - description: None - format: float - maximum: 987.6 - type: number - double: - description: None - format: double - maximum: 123.4 - minimum: 67.8 - type: number - string: - description: None - pattern: /[a-z]/i - type: string - pattern_without_delimiter: - description: None - pattern: ^[A-Z].* - type: string - byte: - description: None - format: byte - type: string - binary: - description: None - format: binary - type: string - date: - description: None - format: date - type: string - dateTime: - description: None - format: date-time - type: string - password: - description: None - format: password - maxLength: 64 - minLength: 10 - type: string - callback: - description: None - type: string - required: - - byte - - double - - number - - pattern_without_delimiter - type: object - body_4: - properties: - param: - description: field1 - type: string - param2: - description: field2 - type: string - required: - - param - - param2 - type: object - body_5: - properties: - additionalMetadata: - description: Additional data to pass to server - type: string - requiredFile: - description: file to upload - format: binary - type: string - required: - - requiredFile - type: object securitySchemes: petstore_auth: flows: @@ -1588,6 +1588,9 @@ components: write:pets: modify pets in your account read:pets: read your pets type: oauth2 + http_basic_test: + scheme: basic + type: http api_key: in: header name: api_key @@ -1596,6 +1599,3 @@ components: in: query name: api_key_query type: apiKey - http_basic_test: - scheme: basic - type: http diff --git a/samples/client/petstore/haskell-http-client/tests-integration/tests/Test.hs b/samples/client/petstore/haskell-http-client/tests-integration/tests/Test.hs index 21e5157bc08..fa8a2bf8ddc 100644 --- a/samples/client/petstore/haskell-http-client/tests-integration/tests/Test.hs +++ b/samples/client/petstore/haskell-http-client/tests-integration/tests/Test.hs @@ -164,6 +164,7 @@ testPetOps mgr config = -- * STORE TESTS +instance S.Consumes S.PlaceOrder S.MimeJSON testStoreOps :: NH.Manager -> S.OpenAPIPetstoreConfig -> Spec testStoreOps mgr config = do @@ -183,7 +184,7 @@ testStoreOps mgr config = do it "placeOrder" $ do now <- TI.getCurrentTime - let placeOrderRequest = S.placeOrder (S.Accept S.MimeJSON) + let placeOrderRequest = S.placeOrder (S.ContentType S.MimeJSON) (S.Accept S.MimeJSON) (S.mkOrder { S.orderId = Just 21 , S.orderQuantity = Just 210 @@ -221,6 +222,11 @@ testStoreOps mgr config = do -- * USER TESTS +instance S.Consumes S.CreateUser S.MimeJSON +instance S.Consumes S.CreateUsersWithArrayInput S.MimeJSON +instance S.Consumes S.CreateUsersWithListInput S.MimeJSON +instance S.Consumes S.UpdateUser S.MimeJSON + testUserOps :: NH.Manager -> S.OpenAPIPetstoreConfig -> Spec testUserOps mgr config = do @@ -245,19 +251,19 @@ testUserOps mgr config = do before (pure _user) $ it "createUser" $ \user -> do - let createUserRequest = S.createUser user + let createUserRequest = S.createUser (S.ContentType S.MimeJSON) user createUserResult <- S.dispatchLbs mgr config createUserRequest NH.responseStatus createUserResult `shouldBe` NH.status200 before (pure _users) $ it "createUsersWithArrayInput" $ \users -> do - let createUsersWithArrayInputRequest = S.createUsersWithArrayInput (S.User2 users) + let createUsersWithArrayInputRequest = S.createUsersWithArrayInput (S.ContentType S.MimeJSON) (S.User2 users) createUsersWithArrayInputResult <- S.dispatchLbs mgr config createUsersWithArrayInputRequest NH.responseStatus createUsersWithArrayInputResult `shouldBe` NH.status200 before (pure _users) $ it "createUsersWithListInput" $ \users -> do - let createUsersWithListInputRequest = S.createUsersWithListInput (S.User2 users) + let createUsersWithListInputRequest = S.createUsersWithListInput (S.ContentType S.MimeJSON) (S.User2 users) createUsersWithListInputResult <- S.dispatchLbs mgr config createUsersWithListInputRequest NH.responseStatus createUsersWithListInputResult `shouldBe` NH.status200 @@ -278,7 +284,7 @@ testUserOps mgr config = do before (pure (_username, _user)) $ it "updateUser" $ \(username, user) -> do - let updateUserRequest = S.updateUser user (S.Username username) + let updateUserRequest = S.updateUser (S.ContentType S.MimeJSON) user (S.Username username) updateUserResult <- S.dispatchLbs mgr config updateUserRequest NH.responseStatus updateUserResult `shouldBe` NH.status200 diff --git a/samples/client/petstore/haskell-http-client/tests/Instances.hs b/samples/client/petstore/haskell-http-client/tests/Instances.hs index 6e54830ccfa..dc1a79b93dd 100644 --- a/samples/client/petstore/haskell-http-client/tests/Instances.hs +++ b/samples/client/petstore/haskell-http-client/tests/Instances.hs @@ -130,54 +130,6 @@ instance Arbitrary ArrayTest where <*> arbitrary -- arrayTestArrayArrayOfInteger :: Maybe [[Integer]] <*> arbitrary -- arrayTestArrayArrayOfModel :: Maybe [[ReadOnlyFirst]] -instance Arbitrary Body where - arbitrary = - Body - <$> arbitrary -- bodyName :: Maybe Text - <*> arbitrary -- bodyStatus :: Maybe Text - -instance Arbitrary Body1 where - arbitrary = - Body1 - <$> arbitrary -- body1AdditionalMetadata :: Maybe Text - <*> arbitrary -- body1File :: Maybe FilePath - -instance Arbitrary Body2 where - arbitrary = - Body2 - <$> arbitrary -- body2EnumFormStringArray :: Maybe [Text] - <*> arbitrary -- body2EnumFormString :: Maybe Text - -instance Arbitrary Body3 where - arbitrary = - Body3 - <$> arbitrary -- body3Integer :: Maybe Int - <*> arbitrary -- body3Int32 :: Maybe Int - <*> arbitrary -- body3Int64 :: Maybe Integer - <*> arbitrary -- body3Number :: Double - <*> arbitrary -- body3Float :: Maybe Float - <*> arbitrary -- body3Double :: Double - <*> arbitrary -- body3String :: Maybe Text - <*> arbitrary -- body3PatternWithoutDelimiter :: Text - <*> arbitrary -- body3Byte :: ByteArray - <*> arbitrary -- body3Binary :: Maybe FilePath - <*> arbitrary -- body3Date :: Maybe Date - <*> arbitrary -- body3DateTime :: Maybe DateTime - <*> arbitrary -- body3Password :: Maybe Text - <*> arbitrary -- body3Callback :: Maybe Text - -instance Arbitrary Body4 where - arbitrary = - Body4 - <$> arbitrary -- body4Param :: Text - <*> arbitrary -- body4Param2 :: Text - -instance Arbitrary Body5 where - arbitrary = - Body5 - <$> arbitrary -- body5AdditionalMetadata :: Maybe Text - <*> arbitrary -- body5RequiredFile :: FilePath - instance Arbitrary Capitalization where arbitrary = Capitalization @@ -273,7 +225,7 @@ instance Arbitrary MapTest where <$> arbitrary -- mapTestMapMapOfString :: Maybe (Map.Map String (Map.Map String Text)) <*> arbitrary -- mapTestMapOfEnumString :: Maybe (Map.Map String Text) <*> arbitrary -- mapTestDirectMap :: Maybe (Map.Map String Bool) - <*> arbitrary -- mapTestIndirectMap :: Maybe StringBooleanMap + <*> arbitrary -- mapTestIndirectMap :: Maybe (Map.Map String Bool) instance Arbitrary MixedPropertiesAndAdditionalPropertiesClass where arbitrary = diff --git a/samples/client/petstore/haskell-http-client/tests/Test.hs b/samples/client/petstore/haskell-http-client/tests/Test.hs index ee6483020f4..ea6fff251e3 100644 --- a/samples/client/petstore/haskell-http-client/tests/Test.hs +++ b/samples/client/petstore/haskell-http-client/tests/Test.hs @@ -27,12 +27,6 @@ main = propMimeEq MimeJSON (Proxy :: Proxy ArrayOfArrayOfNumberOnly) propMimeEq MimeJSON (Proxy :: Proxy ArrayOfNumberOnly) propMimeEq MimeJSON (Proxy :: Proxy ArrayTest) - propMimeEq MimeJSON (Proxy :: Proxy Body) - propMimeEq MimeJSON (Proxy :: Proxy Body1) - propMimeEq MimeJSON (Proxy :: Proxy Body2) - propMimeEq MimeJSON (Proxy :: Proxy Body3) - propMimeEq MimeJSON (Proxy :: Proxy Body4) - propMimeEq MimeJSON (Proxy :: Proxy Body5) propMimeEq MimeJSON (Proxy :: Proxy Capitalization) propMimeEq MimeJSON (Proxy :: Proxy Cat) propMimeEq MimeJSON (Proxy :: Proxy Category) diff --git a/samples/client/petstore/java/feign/build.gradle b/samples/client/petstore/java/feign/build.gradle index b4d7da79267..e2126b12432 100644 --- a/samples/client/petstore/java/feign/build.gradle +++ b/samples/client/petstore/java/feign/build.gradle @@ -94,7 +94,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.9" + swagger_annotations_version = "1.5.21" jackson_version = "2.8.7" threepane_version = "2.6.4" feign_version = "9.4.0" diff --git a/samples/client/petstore/java/feign/build.sbt b/samples/client/petstore/java/feign/build.sbt index 0b09ff26bd1..b387ad56e61 100644 --- a/samples/client/petstore/java/feign/build.sbt +++ b/samples/client/petstore/java/feign/build.sbt @@ -9,7 +9,7 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.9" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", "io.github.openfeign" % "feign-core" % "9.4.0" % "compile", "io.github.openfeign" % "feign-jackson" % "9.4.0" % "compile", "io.github.openfeign" % "feign-slf4j" % "9.4.0" % "compile", diff --git a/samples/client/petstore/java/feign/pom.xml b/samples/client/petstore/java/feign/pom.xml index ce837265abd..58b7d4d7e0e 100644 --- a/samples/client/petstore/java/feign/pom.xml +++ b/samples/client/petstore/java/feign/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -191,7 +189,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} @@ -268,11 +266,11 @@ 1.7 ${java.version} ${java.version} - 1.5.18 + 1.5.21 9.4.0 2.1.0 2.8.9 - 2.6.4 + 2.6.4 4.12 1.0.0 1.0.1 diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index f41fb1dec4f..9ad8bb8da66 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -18,7 +18,7 @@ public interface AnotherFakeApi extends ApiClient.Api { /** * To test special tags * To test special tags and operation ID starting with number - * @param client client model (required) + * @param client client model (required) * @return Client */ @RequestLine("PATCH /another-fake/dummy") diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java index 4f644cb493c..ddfdca531a9 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeApi.java @@ -25,7 +25,7 @@ public interface FakeApi extends ApiClient.Api { /** * * Test serialization of outer boolean types - * @param body Input boolean as post body (optional) + * @param body Input boolean as post body (optional) * @return Boolean */ @RequestLine("POST /fake/outer/boolean") @@ -38,7 +38,7 @@ public interface FakeApi extends ApiClient.Api { /** * * Test serialization of object with outer number type - * @param outerComposite Input composite as post body (optional) + * @param outerComposite Input composite as post body (optional) * @return OuterComposite */ @RequestLine("POST /fake/outer/composite") @@ -51,7 +51,7 @@ public interface FakeApi extends ApiClient.Api { /** * * Test serialization of outer number types - * @param body Input number as post body (optional) + * @param body Input number as post body (optional) * @return BigDecimal */ @RequestLine("POST /fake/outer/number") @@ -64,7 +64,7 @@ public interface FakeApi extends ApiClient.Api { /** * * Test serialization of outer string types - * @param body Input string as post body (optional) + * @param body Input string as post body (optional) * @return String */ @RequestLine("POST /fake/outer/string") @@ -77,7 +77,7 @@ public interface FakeApi extends ApiClient.Api { /** * * For this test, the body for this request much reference a schema named `File`. - * @param fileSchemaTestClass (required) + * @param fileSchemaTestClass (required) */ @RequestLine("PUT /fake/body-with-file-schema") @Headers({ @@ -89,8 +89,8 @@ public interface FakeApi extends ApiClient.Api { /** * * - * @param query (required) - * @param user (required) + * @param query (required) + * @param user (required) */ @RequestLine("PUT /fake/body-with-query-params?query={query}") @Headers({ @@ -135,7 +135,7 @@ public interface FakeApi extends ApiClient.Api { /** * To test \"client\" model * To test \"client\" model - * @param client client model (required) + * @param client client model (required) * @return Client */ @RequestLine("PATCH /fake") @@ -148,20 +148,20 @@ public interface FakeApi extends ApiClient.Api { /** * 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, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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) */ @RequestLine("POST /fake") @Headers({ @@ -173,14 +173,14 @@ public interface FakeApi extends ApiClient.Api { /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) - * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional) - * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) - * @param enumQueryInteger Query parameter enum test (double) (optional) - * @param enumQueryDouble Query parameter enum test (double) (optional) - * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) - * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) */ @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}") @Headers({ @@ -202,7 +202,7 @@ public interface FakeApi extends ApiClient.Api { * building up this map in a fluent style. * @param enumHeaderStringArray Header parameter enum test (string array) (optional) * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormStringArray Form parameter enum test (string array) (optional) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @param queryParams Map of query parameters as name-value pairs *

The following elements may be specified in the query map:

@@ -249,7 +249,7 @@ public interface FakeApi extends ApiClient.Api { /** * test inline additionalProperties * - * @param requestBody request body (required) + * @param requestBody request body (required) */ @RequestLine("POST /fake/inline-additionalProperties") @Headers({ @@ -261,8 +261,8 @@ public interface FakeApi extends ApiClient.Api { /** * test json serialization of form data * - * @param param field1 (required) - * @param param2 field2 (required) + * @param param field1 (required) + * @param param2 field2 (required) */ @RequestLine("GET /fake/jsonFormData") @Headers({ diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 5819866038b..5ae6e9ff4f4 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -18,7 +18,7 @@ public interface FakeClassnameTags123Api extends ApiClient.Api { /** * To test class name in snake case * To test class name in snake case - * @param client client model (required) + * @param client client model (required) * @return Client */ @RequestLine("PATCH /fake_classname_test") diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java index e7c2ded72fb..56028b417c4 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/PetApi.java @@ -20,7 +20,7 @@ public interface PetApi extends ApiClient.Api { /** * Add a new pet to the store * - * @param pet Pet object that needs to be added to the store (required) + * @param pet Pet object that needs to be added to the store (required) */ @RequestLine("POST /pet") @Headers({ @@ -32,8 +32,8 @@ public interface PetApi extends ApiClient.Api { /** * Deletes a pet * - * @param petId Pet id to delete (required) - * @param apiKey (optional) + * @param petId Pet id to delete (required) + * @param apiKey (optional) */ @RequestLine("DELETE /pet/{petId}") @Headers({ @@ -45,7 +45,7 @@ public interface PetApi extends ApiClient.Api { /** * 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) + * @param status Status values that need to be considered for filter (required) * @return List<Pet> */ @RequestLine("GET /pet/findByStatus?status={status}") @@ -89,7 +89,7 @@ public interface PetApi extends ApiClient.Api { /** * 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) + * @param tags Tags to filter by (required) * @return List<Pet> */ @RequestLine("GET /pet/findByTags?tags={tags}") @@ -133,7 +133,7 @@ public interface PetApi extends ApiClient.Api { /** * Find pet by ID * Returns a single pet - * @param petId ID of pet to return (required) + * @param petId ID of pet to return (required) * @return Pet */ @RequestLine("GET /pet/{petId}") @@ -145,7 +145,7 @@ public interface PetApi extends ApiClient.Api { /** * Update an existing pet * - * @param pet Pet object that needs to be added to the store (required) + * @param pet Pet object that needs to be added to the store (required) */ @RequestLine("PUT /pet") @Headers({ @@ -157,9 +157,9 @@ public interface PetApi extends ApiClient.Api { /** * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @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) */ @RequestLine("POST /pet/{petId}") @Headers({ @@ -171,9 +171,9 @@ public interface PetApi extends ApiClient.Api { /** * uploads an image * - * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ModelApiResponse */ @RequestLine("POST /pet/{petId}/uploadImage") @@ -186,9 +186,9 @@ public interface PetApi extends ApiClient.Api { /** * 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, default to null) + * @param petId ID of pet to update (required) + * @param requiredFile file to upload (required) + * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse */ @RequestLine("POST /fake/{petId}/uploadImageWithRequiredFile") diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/StoreApi.java index 164df7fcc30..cd2a5c7d10e 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/StoreApi.java @@ -18,7 +18,7 @@ public interface StoreApi extends ApiClient.Api { /** * 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) + * @param orderId ID of the order that needs to be deleted (required) */ @RequestLine("DELETE /store/order/{orderId}") @Headers({ @@ -40,7 +40,7 @@ public interface StoreApi extends ApiClient.Api { /** * 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) + * @param orderId ID of pet that needs to be fetched (required) * @return Order */ @RequestLine("GET /store/order/{orderId}") @@ -52,7 +52,7 @@ public interface StoreApi extends ApiClient.Api { /** * Place an order for a pet * - * @param order order placed for purchasing the pet (required) + * @param order order placed for purchasing the pet (required) * @return Order */ @RequestLine("POST /store/order") diff --git a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java index cb4a80decb6..664aa9216ee 100644 --- a/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/feign/src/main/java/org/openapitools/client/api/UserApi.java @@ -18,7 +18,7 @@ public interface UserApi extends ApiClient.Api { /** * Create user * This can only be done by the logged in user. - * @param user Created user object (required) + * @param user Created user object (required) */ @RequestLine("POST /user") @Headers({ @@ -30,7 +30,7 @@ public interface UserApi extends ApiClient.Api { /** * Creates list of users with given input array * - * @param user List of user object (required) + * @param user List of user object (required) */ @RequestLine("POST /user/createWithArray") @Headers({ @@ -42,7 +42,7 @@ public interface UserApi extends ApiClient.Api { /** * Creates list of users with given input array * - * @param user List of user object (required) + * @param user List of user object (required) */ @RequestLine("POST /user/createWithList") @Headers({ @@ -54,7 +54,7 @@ public interface UserApi extends ApiClient.Api { /** * Delete user * This can only be done by the logged in user. - * @param username The name that needs to be deleted (required) + * @param username The name that needs to be deleted (required) */ @RequestLine("DELETE /user/{username}") @Headers({ @@ -65,7 +65,7 @@ public interface UserApi extends ApiClient.Api { /** * Get user by user name * - * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @param username The name that needs to be fetched. Use user1 for testing. (required) * @return User */ @RequestLine("GET /user/{username}") @@ -77,8 +77,8 @@ public interface UserApi extends ApiClient.Api { /** * Logs user into the system * - * @param username The user name for login (required) - * @param password The password for login in clear text (required) + * @param username The user name for login (required) + * @param password The password for login in clear text (required) * @return String */ @RequestLine("GET /user/login?username={username}&password={password}") @@ -137,8 +137,8 @@ public interface UserApi extends ApiClient.Api { /** * Updated user * This can only be done by the logged in user. - * @param username name that need to be deleted (required) - * @param user Updated user object (required) + * @param username name that need to be deleted (required) + * @param user Updated user object (required) */ @RequestLine("PUT /user/{username}") @Headers({ 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 6819bd7fe7d..5c049e200ff 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 @@ -35,7 +35,7 @@ import io.swagger.annotations.ApiModelProperty; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; 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 f0b2d5cd99f..061063eff71 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 @@ -27,22 +27,22 @@ import io.swagger.annotations.ApiModelProperty; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = 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 2121c5c2793..9fc4fda3e20 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 @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.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 60f4d2b07b2..ffc9482ffc0 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 @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.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 d16a676db3d..4076399e9c5 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 @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; 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 290c475cb54..2fd30addec8 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 @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.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 b7beed2df53..a36ad9d7475 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 @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.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 3b1b51c26a3..0596441db15 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 @@ -64,7 +64,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum 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 122f370cef9..27e6dee1d11 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 @@ -65,7 +65,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -105,7 +105,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -143,7 +143,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -181,7 +181,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; 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 de08419d1db..bdcfdca6dd8 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 @@ -32,43 +32,43 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.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 ddd9bfbf678..c9307f90621 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 @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get 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 f67fb22c45c..92128acfc7a 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 @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -75,7 +74,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -155,21 +154,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } 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 a12b7048008..c8e0ae1545a 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 @@ -33,10 +33,10 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; 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 edef1b3e626..4d2da937512 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 @@ -28,10 +28,10 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.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 2f89b60db0b..04e167c98f6 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 @@ -27,13 +27,13 @@ import io.swagger.annotations.ApiModelProperty; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.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 4adcfed3c3d..6c3bf33c6b1 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 @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._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 1f55823fcf4..da57f200d58 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 @@ -28,16 +28,16 @@ import io.swagger.annotations.ApiModelProperty; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.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 7372bf2d2fd..e8952b8568d 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 @@ -28,7 +28,7 @@ import java.math.BigDecimal; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = 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 cff13953de0..e9fabf83f81 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 @@ -28,16 +28,16 @@ import org.threeten.bp.OffsetDateTime; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -77,7 +77,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; 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 0abe10bcfc2..a360a821676 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 @@ -28,13 +28,13 @@ import java.math.BigDecimal; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; 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 183260074e2..18845f5a6ff 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 @@ -31,13 +31,13 @@ import org.openapitools.client.model.Tag; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList(); @@ -83,7 +83,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.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 17bd805fa5c..edade3b2a37 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 @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get 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 f0181742543..494c9cd98ad 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 @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; 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 2607dc2a1a5..10334b74be4 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 @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; 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 42d73dd62dc..0d0cd0d2908 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 @@ -27,28 +27,28 @@ import io.swagger.annotations.ApiModelProperty; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/feign10x/.gitignore b/samples/client/petstore/java/feign10x/.gitignore new file mode 100644 index 00000000000..a530464afa1 --- /dev/null +++ b/samples/client/petstore/java/feign10x/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/feign10x/.openapi-generator-ignore b/samples/client/petstore/java/feign10x/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/java/feign10x/.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/feign10x/.openapi-generator/VERSION b/samples/client/petstore/java/feign10x/.openapi-generator/VERSION new file mode 100644 index 00000000000..afa63656064 --- /dev/null +++ b/samples/client/petstore/java/feign10x/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/java/feign10x/.travis.yml b/samples/client/petstore/java/feign10x/.travis.yml new file mode 100644 index 00000000000..80a7f2fc66c --- /dev/null +++ b/samples/client/petstore/java/feign10x/.travis.yml @@ -0,0 +1,17 @@ +# +# Generated by: https://openapi-generator.tech +# +language: java +jdk: + - oraclejdk8 + - oraclejdk7 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + - mvn test + # uncomment below to test using gradle + # - gradle test + # uncomment below to test using sbt + # - sbt test diff --git a/samples/client/petstore/java/feign10x/README.md b/samples/client/petstore/java/feign10x/README.md new file mode 100644 index 00000000000..646dfdc4e2b --- /dev/null +++ b/samples/client/petstore/java/feign10x/README.md @@ -0,0 +1,43 @@ +# petstore-feign + +## Requirements + +Building the API client library requires [Maven](https://maven.apache.org/) to be installed. + +## Installation & Usage + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn deploy +``` + +Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. + +After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: + +```xml + + org.openapitools + petstore-feign + 1.0.0 + compile + + +``` + +## Recommendation + +It's recommended to create an instance of `ApiClient` per thread in a multithreaded environment to avoid any potential issues. + +## Author + + + + diff --git a/samples/client/petstore/java/feign10x/build.gradle b/samples/client/petstore/java/feign10x/build.gradle new file mode 100644 index 00000000000..fb153ad6e2b --- /dev/null +++ b/samples/client/petstore/java/feign10x/build.gradle @@ -0,0 +1,119 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = 'org.openapitools' +version = '1.0.0' + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' + } +} + +repositories { + jcenter() +} + + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_7 + targetCompatibility JavaVersion.VERSION_1_7 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided 'javax.annotation:jsr250-api:1.0' + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven' + + sourceCompatibility = JavaVersion.VERSION_1_7 + targetCompatibility = JavaVersion.VERSION_1_7 + + install { + repositories.mavenInstaller { + pom.artifactId = 'petstore-feign-10x' + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + swagger_annotations_version = "1.5.21" + jackson_version = "2.8.7" + threepane_version = "2.6.4" + feign_version = "10.0.1" + feign_form_version = "2.1.0" + junit_version = "4.12" + oltu_version = "1.0.1" +} + +dependencies { + compile "io.swagger:swagger-annotations:$swagger_annotations_version" + compile "io.github.openfeign:feign-core:$feign_version" + compile "io.github.openfeign:feign-jackson:$feign_version" + compile "io.github.openfeign:feign-slf4j:$feign_version" + compile "io.github.openfeign.form:feign-form:$feign_form_version" + compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version" + compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threepane_version" + compile "org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version" + compile "com.brsanthu:migbase64:2.2" + testCompile "junit:junit:$junit_version" +} diff --git a/samples/client/petstore/java/feign10x/build.sbt b/samples/client/petstore/java/feign10x/build.sbt new file mode 100644 index 00000000000..89fecfb0655 --- /dev/null +++ b/samples/client/petstore/java/feign10x/build.sbt @@ -0,0 +1,26 @@ +lazy val root = (project in file(".")). + settings( + organization := "org.openapitools", + name := "petstore-feign-10x", + version := "1.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", + "io.github.openfeign" % "feign-core" % "10.0.1" % "compile", + "io.github.openfeign" % "feign-jackson" % "10.0.1" % "compile", + "io.github.openfeign" % "feign-slf4j" % "10.0.1" % "compile", + "io.github.openfeign.form" % "feign-form" % "2.1.0" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.7" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.7" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.7" % "compile", + "com.fasterxml.jackson.datatype" % "jackson-datatype-joda" % "2.8.7" % "compile", + "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "com.brsanthu" % "migbase64" % "2.2" % "compile", + "junit" % "junit" % "4.12" % "test", + "com.novocode" % "junit-interface" % "0.10" % "test" + ) + ) diff --git a/samples/client/petstore/java/feign10x/git_push.sh b/samples/client/petstore/java/feign10x/git_push.sh new file mode 100644 index 00000000000..8442b80bb44 --- /dev/null +++ b/samples/client/petstore/java/feign10x/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +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://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/java/feign10x/gradle.properties b/samples/client/petstore/java/feign10x/gradle.properties new file mode 100644 index 00000000000..05644f0754a --- /dev/null +++ b/samples/client/petstore/java/feign10x/gradle.properties @@ -0,0 +1,2 @@ +# Uncomment to build for Android +#target = android \ No newline at end of file diff --git a/samples/client/petstore/java/feign10x/gradle/wrapper/gradle-wrapper.jar b/samples/client/petstore/java/feign10x/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000000..2c6137b8789 Binary files /dev/null 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 new file mode 100644 index 00000000000..b7a36473955 --- /dev/null +++ b/samples/client/petstore/java/feign10x/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue May 17 23:08:05 CST 2016 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip diff --git a/samples/client/petstore/java/feign10x/gradlew b/samples/client/petstore/java/feign10x/gradlew new file mode 100644 index 00000000000..9d82f789151 --- /dev/null +++ b/samples/client/petstore/java/feign10x/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# 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 +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# 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 + +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" ] ; 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 + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/client/petstore/java/feign10x/gradlew.bat b/samples/client/petstore/java/feign10x/gradlew.bat new file mode 100644 index 00000000000..5f192121eb4 --- /dev/null +++ b/samples/client/petstore/java/feign10x/gradlew.bat @@ -0,0 +1,90 @@ +@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 + +@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 DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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 +if "%@eval[2+2]" == "4" goto 4NT_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=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +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/samples/client/petstore/java/feign10x/pom.xml b/samples/client/petstore/java/feign10x/pom.xml new file mode 100644 index 00000000000..6ff244e2384 --- /dev/null +++ b/samples/client/petstore/java/feign10x/pom.xml @@ -0,0 +1,278 @@ + + 4.0.0 + org.openapitools + petstore-feign-10x + jar + petstore-feign-10x + 1.0.0 + https://github.com/openapitools/openapi-generator + OpenAPI Java + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + http://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + OpenAPI + team@openapitools.org + OpenAPI + http://openapitools.org + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + pertest + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + jar + test-jar + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.10 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + + + + io.github.openfeign + feign-core + ${feign-version} + + + io.github.openfeign + feign-jackson + ${feign-version} + + + io.github.openfeign + feign-slf4j + ${feign-version} + + + io.github.openfeign.form + feign-form + ${feign-form-version} + + + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-version} + + + com.github.joschi.jackson + jackson-datatype-threetenbp + ${jackson-threetenbp-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + ${oltu-version} + + + + + junit + junit + ${junit-version} + test + + + com.squareup.okhttp3 + mockwebserver + 3.6.0 + test + + + org.assertj + assertj-core + 1.7.1 + test + + + + UTF-8 + 1.7 + ${java.version} + ${java.version} + 1.5.21 + 10.0.1 + 2.1.0 + 2.8.9 + 2.6.4 + 4.12 + 1.0.0 + 1.0.1 + + diff --git a/samples/client/petstore/java/feign10x/settings.gradle b/samples/client/petstore/java/feign10x/settings.gradle new file mode 100644 index 00000000000..659467b7f43 --- /dev/null +++ b/samples/client/petstore/java/feign10x/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-feign-10x" \ No newline at end of file diff --git a/samples/client/petstore/java/feign10x/src/main/AndroidManifest.xml b/samples/client/petstore/java/feign10x/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..54fbcb3da1e --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 00000000000..1ba11f9c0a9 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,336 @@ +package org.openapitools.client; + +import java.util.LinkedHashMap; +import java.util.Map; + +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.threeten.bp.*; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import com.fasterxml.jackson.datatype.threetenbp.ThreeTenModule; + +import feign.Feign; +import feign.RequestInterceptor; +import feign.form.FormEncoder; +import feign.jackson.JacksonDecoder; +import feign.jackson.JacksonEncoder; +import feign.slf4j.Slf4jLogger; +import org.openapitools.client.auth.*; +import org.openapitools.client.auth.OAuth.AccessTokenListener; + + +public class ApiClient { + public interface Api {} + + protected ObjectMapper objectMapper; + private String basePath = "http://petstore.swagger.io:80/v2"; + private Map apiAuthorizations; + private Feign.Builder feignBuilder; + + public ApiClient() { + objectMapper = createObjectMapper(); + apiAuthorizations = new LinkedHashMap(); + feignBuilder = Feign.builder() + .encoder(new FormEncoder(new JacksonEncoder(objectMapper))) + .decoder(new JacksonDecoder(objectMapper)) + .logger(new Slf4jLogger()); + } + + public ApiClient(String[] authNames) { + this(); + for(String authName : authNames) { + RequestInterceptor auth; + if ("api_key".equals(authName)) { + auth = new ApiKeyAuth("header", "api_key"); + } else if ("api_key_query".equals(authName)) { + auth = new ApiKeyAuth("query", "api_key_query"); + } else if ("http_basic_test".equals(authName)) { + auth = new HttpBasicAuth(); + } else if ("petstore_auth".equals(authName)) { + auth = new OAuth(OAuthFlow.implicit, "http://petstore.swagger.io/api/oauth/dialog", "", "write:pets, read:pets"); + } else { + throw new RuntimeException("auth name \"" + authName + "\" not found in available auth names"); + } + addAuthorization(authName, auth); + } + } + + /** + * Basic constructor for single auth name + * @param authName + */ + public ApiClient(String authName) { + this(new String[]{authName}); + } + + /** + * Helper constructor for single api key + * @param authName + * @param apiKey + */ + public ApiClient(String authName, String apiKey) { + this(authName); + this.setApiKey(apiKey); + } + + /** + * Helper constructor for single basic auth or password oauth2 + * @param authName + * @param username + * @param password + */ + public ApiClient(String authName, String username, String password) { + this(authName); + this.setCredentials(username, password); + } + + /** + * Helper constructor for single password oauth2 + * @param authName + * @param clientId + * @param secret + * @param username + * @param password + */ + public ApiClient(String authName, String clientId, String secret, String username, String password) { + this(authName); + this.getTokenEndPoint() + .setClientId(clientId) + .setClientSecret(secret) + .setUsername(username) + .setPassword(password); + } + + public String getBasePath() { + return basePath; + } + + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + public Map getApiAuthorizations() { + return apiAuthorizations; + } + + public void setApiAuthorizations(Map apiAuthorizations) { + this.apiAuthorizations = apiAuthorizations; + } + + public Feign.Builder getFeignBuilder() { + return feignBuilder; + } + + public ApiClient setFeignBuilder(Feign.Builder feignBuilder) { + this.feignBuilder = feignBuilder; + return this; + } + + private ObjectMapper createObjectMapper() { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING); + objectMapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING); + objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES); + objectMapper.disable(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE); + objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS); + objectMapper.setDateFormat(new RFC3339DateFormat()); + ThreeTenModule module = new ThreeTenModule(); + module.addDeserializer(Instant.class, CustomInstantDeserializer.INSTANT); + module.addDeserializer(OffsetDateTime.class, CustomInstantDeserializer.OFFSET_DATE_TIME); + module.addDeserializer(ZonedDateTime.class, CustomInstantDeserializer.ZONED_DATE_TIME); + objectMapper.registerModule(module); + return objectMapper; + } + + public ObjectMapper getObjectMapper(){ + return objectMapper; + } + + /** + * Creates a feign client for given API interface. + * + * Usage: + * ApiClient apiClient = new ApiClient(); + * apiClient.setBasePath("http://localhost:8080"); + * XYZApi api = apiClient.buildClient(XYZApi.class); + * XYZResponse response = api.someMethod(...); + * @param Type + * @param clientClass Client class + * @return The Client + */ + public T buildClient(Class clientClass) { + return feignBuilder.target(clientClass, basePath); + } + + /** + * Select the Accept header's value from the given accepts array: + * if JSON exists in the given array, use it; + * otherwise use all of them (joining into a string) + * + * @param accepts The accepts array to select from + * @return The Accept header to use. If the given array is empty, + * null will be returned (not to set the Accept header explicitly). + */ + public String selectHeaderAccept(String[] accepts) { + if (accepts.length == 0) return null; + if (StringUtil.containsIgnoreCase(accepts, "application/json")) return "application/json"; + return StringUtil.join(accepts, ","); + } + + /** + * Select the Content-Type header's value from the given array: + * if JSON exists in the given array, use it; + * otherwise use the first one of the array. + * + * @param contentTypes The Content-Type array to select from + * @return The Content-Type header to use. If the given array is empty, + * JSON will be used. + */ + public String selectHeaderContentType(String[] contentTypes) { + if (contentTypes.length == 0) return "application/json"; + if (StringUtil.containsIgnoreCase(contentTypes, "application/json")) return "application/json"; + return contentTypes[0]; + } + + /** + * Helper method to configure the first api key found + * @param apiKey API key + */ + public void setApiKey(String apiKey) { + for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof ApiKeyAuth) { + ApiKeyAuth keyAuth = (ApiKeyAuth) apiAuthorization; + keyAuth.setApiKey(apiKey); + return ; + } + } + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to configure the username/password for basic auth or password OAuth + * @param username Username + * @param password Password + */ + public void setCredentials(String username, String password) { + for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof HttpBasicAuth) { + HttpBasicAuth basicAuth = (HttpBasicAuth) apiAuthorization; + basicAuth.setCredentials(username, password); + return; + } + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.getTokenRequestBuilder().setUsername(username).setPassword(password); + return; + } + } + throw new RuntimeException("No Basic authentication or OAuth configured!"); + } + + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + return oauth.getTokenRequestBuilder(); + } + } + return null; + } + + /** + * Helper method to configure authorization endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * @return Authentication request builder + */ + public AuthenticationRequestBuilder getAuthorizationEndPoint() { + for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + return oauth.getAuthenticationRequestBuilder(); + } + } + return null; + } + + /** + * Helper method to pre-set the oauth access token of the first oauth found in the apiAuthorizations (there should be only one) + * @param accessToken Access Token + * @param expiresIn Validity period in seconds + */ + public void setAccessToken(String accessToken, Long expiresIn) { + for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.setAccessToken(accessToken, expiresIn); + return; + } + } + } + + /** + * Helper method to configure the oauth accessCode/implicit flow parameters + * @param clientId Client ID + * @param clientSecret Client secret + * @param redirectURI Redirect URI + */ + public void configureAuthorizationFlow(String clientId, String clientSecret, String redirectURI) { + for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.getTokenRequestBuilder() + .setClientId(clientId) + .setClientSecret(clientSecret) + .setRedirectURI(redirectURI); + oauth.getAuthenticationRequestBuilder() + .setClientId(clientId) + .setRedirectURI(redirectURI); + return; + } + } + } + + /** + * Configures a listener which is notified when a new access token is received. + * @param accessTokenListener Acesss token listener + */ + public void registerAccessTokenListener(AccessTokenListener accessTokenListener) { + for(RequestInterceptor apiAuthorization : apiAuthorizations.values()) { + if (apiAuthorization instanceof OAuth) { + OAuth oauth = (OAuth) apiAuthorization; + oauth.registerAccessTokenListener(accessTokenListener); + return; + } + } + } + + /** + * Gets request interceptor based on authentication name + * @param authName Authentiation name + * @return Request Interceptor + */ + public RequestInterceptor getAuthorization(String authName) { + return apiAuthorizations.get(authName); + } + + /** + * Adds an authorization to be used by the client + * @param authName Authentication name + * @param authorization Request interceptor + */ + public void addAuthorization(String authName, RequestInterceptor authorization) { + if (apiAuthorizations.containsKey(authName)) { + throw new RuntimeException("auth name \"" + authName + "\" already in api authorizations"); + } + apiAuthorizations.put(authName, authorization); + feignBuilder.requestInterceptor(authorization); + } + +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/CustomInstantDeserializer.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/CustomInstantDeserializer.java new file mode 100644 index 00000000000..7e115295be6 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/CustomInstantDeserializer.java @@ -0,0 +1,232 @@ +package org.openapitools.client; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonTokenId; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.datatype.threetenbp.DateTimeUtils; +import com.fasterxml.jackson.datatype.threetenbp.DecimalUtils; +import com.fasterxml.jackson.datatype.threetenbp.deser.ThreeTenDateTimeDeserializerBase; +import com.fasterxml.jackson.datatype.threetenbp.function.BiFunction; +import com.fasterxml.jackson.datatype.threetenbp.function.Function; +import org.threeten.bp.DateTimeException; +import org.threeten.bp.Instant; +import org.threeten.bp.OffsetDateTime; +import org.threeten.bp.ZoneId; +import org.threeten.bp.ZonedDateTime; +import org.threeten.bp.format.DateTimeFormatter; +import org.threeten.bp.temporal.Temporal; +import org.threeten.bp.temporal.TemporalAccessor; + +import java.io.IOException; +import java.math.BigDecimal; + +/** + * Deserializer for ThreeTen temporal {@link Instant}s, {@link OffsetDateTime}, and {@link ZonedDateTime}s. + * Adapted from the jackson threetenbp InstantDeserializer to add support for deserializing rfc822 format. + * + * @author Nick Williams + */ +public class CustomInstantDeserializer + extends ThreeTenDateTimeDeserializerBase { + private static final long serialVersionUID = 1L; + + public static final CustomInstantDeserializer INSTANT = new CustomInstantDeserializer( + Instant.class, DateTimeFormatter.ISO_INSTANT, + new Function() { + @Override + public Instant apply(TemporalAccessor temporalAccessor) { + return Instant.from(temporalAccessor); + } + }, + new Function() { + @Override + public Instant apply(FromIntegerArguments a) { + return Instant.ofEpochMilli(a.value); + } + }, + new Function() { + @Override + public Instant apply(FromDecimalArguments a) { + return Instant.ofEpochSecond(a.integer, a.fraction); + } + }, + null + ); + + public static final CustomInstantDeserializer OFFSET_DATE_TIME = new CustomInstantDeserializer( + OffsetDateTime.class, DateTimeFormatter.ISO_OFFSET_DATE_TIME, + new Function() { + @Override + public OffsetDateTime apply(TemporalAccessor temporalAccessor) { + return OffsetDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromIntegerArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public OffsetDateTime apply(FromDecimalArguments a) { + return OffsetDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public OffsetDateTime apply(OffsetDateTime d, ZoneId z) { + return d.withOffsetSameInstant(z.getRules().getOffset(d.toLocalDateTime())); + } + } + ); + + public static final CustomInstantDeserializer ZONED_DATE_TIME = new CustomInstantDeserializer( + ZonedDateTime.class, DateTimeFormatter.ISO_ZONED_DATE_TIME, + new Function() { + @Override + public ZonedDateTime apply(TemporalAccessor temporalAccessor) { + return ZonedDateTime.from(temporalAccessor); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromIntegerArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochMilli(a.value), a.zoneId); + } + }, + new Function() { + @Override + public ZonedDateTime apply(FromDecimalArguments a) { + return ZonedDateTime.ofInstant(Instant.ofEpochSecond(a.integer, a.fraction), a.zoneId); + } + }, + new BiFunction() { + @Override + public ZonedDateTime apply(ZonedDateTime zonedDateTime, ZoneId zoneId) { + return zonedDateTime.withZoneSameInstant(zoneId); + } + } + ); + + protected final Function fromMilliseconds; + + protected final Function fromNanoseconds; + + protected final Function parsedToValue; + + protected final BiFunction adjust; + + protected CustomInstantDeserializer(Class supportedType, + DateTimeFormatter parser, + Function parsedToValue, + Function fromMilliseconds, + Function fromNanoseconds, + BiFunction adjust) { + super(supportedType, parser); + this.parsedToValue = parsedToValue; + this.fromMilliseconds = fromMilliseconds; + this.fromNanoseconds = fromNanoseconds; + this.adjust = adjust == null ? new BiFunction() { + @Override + public T apply(T t, ZoneId zoneId) { + return t; + } + } : adjust; + } + + @SuppressWarnings("unchecked") + protected CustomInstantDeserializer(CustomInstantDeserializer base, DateTimeFormatter f) { + super((Class) base.handledType(), f); + parsedToValue = base.parsedToValue; + fromMilliseconds = base.fromMilliseconds; + fromNanoseconds = base.fromNanoseconds; + adjust = base.adjust; + } + + @Override + protected JsonDeserializer withDateFormat(DateTimeFormatter dtf) { + if (dtf == _formatter) { + return this; + } + return new CustomInstantDeserializer(this, dtf); + } + + @Override + public T deserialize(JsonParser parser, DeserializationContext context) throws IOException { + //NOTE: Timestamps contain no timezone info, and are always in configured TZ. Only + //string values have to be adjusted to the configured TZ. + switch (parser.getCurrentTokenId()) { + case JsonTokenId.ID_NUMBER_FLOAT: { + BigDecimal value = parser.getDecimalValue(); + long seconds = value.longValue(); + int nanoseconds = DecimalUtils.extractNanosecondDecimal(value, seconds); + return fromNanoseconds.apply(new FromDecimalArguments( + seconds, nanoseconds, getZone(context))); + } + + case JsonTokenId.ID_NUMBER_INT: { + long timestamp = parser.getLongValue(); + if (context.isEnabled(DeserializationFeature.READ_DATE_TIMESTAMPS_AS_NANOSECONDS)) { + return this.fromNanoseconds.apply(new FromDecimalArguments( + timestamp, 0, this.getZone(context) + )); + } + return this.fromMilliseconds.apply(new FromIntegerArguments( + timestamp, this.getZone(context) + )); + } + + case JsonTokenId.ID_STRING: { + String string = parser.getText().trim(); + if (string.length() == 0) { + return null; + } + if (string.endsWith("+0000")) { + string = string.substring(0, string.length() - 5) + "Z"; + } + T value; + try { + TemporalAccessor acc = _formatter.parse(string); + value = parsedToValue.apply(acc); + if (context.isEnabled(DeserializationFeature.ADJUST_DATES_TO_CONTEXT_TIME_ZONE)) { + return adjust.apply(value, this.getZone(context)); + } + } catch (DateTimeException e) { + throw _peelDTE(e); + } + return value; + } + } + throw context.mappingException("Expected type float, integer, or string."); + } + + private ZoneId getZone(DeserializationContext context) { + // Instants are always in UTC, so don't waste compute cycles + return (_valueClass == Instant.class) ? null : DateTimeUtils.timeZoneToZoneId(context.getTimeZone()); + } + + private static class FromIntegerArguments { + public final long value; + public final ZoneId zoneId; + + private FromIntegerArguments(long value, ZoneId zoneId) { + this.value = value; + this.zoneId = zoneId; + } + } + + private static class FromDecimalArguments { + public final long integer; + public final int fraction; + public final ZoneId zoneId; + + private FromDecimalArguments(long integer, int fraction, ZoneId zoneId) { + this.integer = integer; + this.fraction = fraction; + this.zoneId = zoneId; + } + } +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/EncodingUtils.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/EncodingUtils.java new file mode 100644 index 00000000000..1b061a1972f --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/EncodingUtils.java @@ -0,0 +1,86 @@ +package org.openapitools.client; + +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +/** +* Utilities to support Swagger encoding formats in Feign. +*/ +public final class EncodingUtils { + + /** + * Private constructor. Do not construct this class. + */ + private EncodingUtils() {} + + /** + *

Encodes a collection of query parameters according to the Swagger + * collection format.

+ * + *

Of the various collection formats defined by Swagger ("csv", "tsv", + * etc), Feign only natively supports "multi". This utility generates the + * other format types so it will be properly processed by Feign.

+ * + *

Note, as part of reformatting, it URL encodes the parameters as + * well.

+ * @param parameters The collection object to be formatted. This object will + * not be changed. + * @param collectionFormat The Swagger collection format (eg, "csv", "tsv", + * "pipes"). See the + * + * OpenAPI Spec for more details. + * @return An object that will be correctly formatted by Feign. + */ + public static Object encodeCollection(Collection parameters, + String collectionFormat) { + if (parameters == null) { + return parameters; + } + List stringValues = new ArrayList<>(parameters.size()); + for (Object parameter : parameters) { + // ignore null values (same behavior as Feign) + if (parameter != null) { + stringValues.add(encode(parameter)); + } + } + // Feign natively handles single-element lists and the "multi" format. + if (stringValues.size() < 2 || "multi".equals(collectionFormat)) { + return stringValues; + } + // Otherwise return a formatted String + String[] stringArray = stringValues.toArray(new String[0]); + switch (collectionFormat) { + case "csv": + default: + return StringUtil.join(stringArray, ","); + case "ssv": + return StringUtil.join(stringArray, " "); + case "tsv": + return StringUtil.join(stringArray, "\t"); + case "pipes": + return StringUtil.join(stringArray, "|"); + } + } + + /** + * URL encode a single query parameter. + * @param parameter The query parameter to encode. This object will not be + * changed. + * @return The URL encoded string representation of the parameter. If the + * parameter is null, returns null. + */ + public static String encode(Object parameter) { + if (parameter == null) { + return null; + } + try { + return URLEncoder.encode(parameter.toString(), "UTF-8"); + } catch (UnsupportedEncodingException e) { + // Should never happen, UTF-8 is always supported + throw new RuntimeException(e); + } + } +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/ParamExpander.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/ParamExpander.java new file mode 100644 index 00000000000..2331d87fdbd --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/ParamExpander.java @@ -0,0 +1,22 @@ +package org.openapitools.client; + +import feign.Param; + +import java.text.DateFormat; +import java.util.Date; + +/** + * Param Expander to convert {@link Date} to RFC3339 + */ +public class ParamExpander implements Param.Expander { + + private static final DateFormat dateformat = new RFC3339DateFormat(); + + @Override + public String expand(Object value) { + if (value instanceof Date) { + return dateformat.format(value); + } + return value.toString(); + } +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 00000000000..4ed672bced9 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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; + +import com.fasterxml.jackson.databind.util.ISO8601DateFormat; +import com.fasterxml.jackson.databind.util.ISO8601Utils; + +import java.text.FieldPosition; +import java.util.Date; + + +public class RFC3339DateFormat extends ISO8601DateFormat { + + // Same as ISO8601DateFormat but serializing milliseconds. + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + String value = ISO8601Utils.format(date, true); + toAppendTo.append(value); + return toAppendTo; + } + +} \ No newline at end of file diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 00000000000..c51b3bcf661 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,61 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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; + + +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 00000000000..9ad8bb8da66 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,30 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.EncodingUtils; + +import org.openapitools.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import feign.*; + + +public interface AnotherFakeApi extends ApiClient.Api { + + + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @return Client + */ + @RequestLine("PATCH /another-fake/dummy") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + Client call123testSpecialTags(Client client); +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 00000000000..ddfdca531a9 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,273 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.EncodingUtils; + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.User; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import feign.*; + + +public interface FakeApi extends ApiClient.Api { + + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + */ + @RequestLine("POST /fake/outer/boolean") + @Headers({ + "Content-Type: */*", + "Accept: */*", + }) + Boolean fakeOuterBooleanSerialize(Boolean body); + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return OuterComposite + */ + @RequestLine("POST /fake/outer/composite") + @Headers({ + "Content-Type: */*", + "Accept: */*", + }) + OuterComposite fakeOuterCompositeSerialize(OuterComposite outerComposite); + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + */ + @RequestLine("POST /fake/outer/number") + @Headers({ + "Content-Type: */*", + "Accept: */*", + }) + BigDecimal fakeOuterNumberSerialize(BigDecimal body); + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + */ + @RequestLine("POST /fake/outer/string") + @Headers({ + "Content-Type: */*", + "Accept: */*", + }) + String fakeOuterStringSerialize(String body); + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + */ + @RequestLine("PUT /fake/body-with-file-schema") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + void testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); + + /** + * + * + * @param query (required) + * @param user (required) + */ + @RequestLine("PUT /fake/body-with-query-params?query={query}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + void testBodyWithQueryParams(@Param("query") String query, User user); + + /** + * + * + * Note, this is equivalent to the other testBodyWithQueryParams method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link TestBodyWithQueryParamsQueryParams} class that allows for + * building up this map in a fluent style. + * @param user (required) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • query - (required)
  • + *
+ */ + @RequestLine("PUT /fake/body-with-query-params?query={query}") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + void testBodyWithQueryParams(User user, @QueryMap(encoded=true) Map queryParams); + + /** + * A convenience class for generating query parameters for the + * testBodyWithQueryParams method in a fluent style. + */ + public static class TestBodyWithQueryParamsQueryParams extends HashMap { + public TestBodyWithQueryParamsQueryParams query(final String value) { + put("query", EncodingUtils.encode(value)); + return this; + } + } + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return Client + */ + @RequestLine("PATCH /fake") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + Client testClientModel(Client client); + + /** + * 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) + */ + @RequestLine("POST /fake") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + void testEndpointParameters(@Param("number") BigDecimal number, @Param("_double") Double _double, @Param("patternWithoutDelimiter") String patternWithoutDelimiter, @Param("_byte") byte[] _byte, @Param("integer") Integer integer, @Param("int32") Integer int32, @Param("int64") Long int64, @Param("_float") Float _float, @Param("string") String string, @Param("binary") File binary, @Param("date") LocalDate date, @Param("dateTime") OffsetDateTime dateTime, @Param("password") String password, @Param("paramCallback") String paramCallback); + + /** + * To test enum parameters + * To test enum parameters + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) + * @param enumQueryInteger Query parameter enum test (double) (optional) + * @param enumQueryDouble Query parameter enum test (double) (optional) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + */ + @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + "enum_header_string_array: {enumHeaderStringArray}", + + "enum_header_string: {enumHeaderString}" + }) + void testEnumParameters(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumQueryStringArray") List enumQueryStringArray, @Param("enumQueryString") String enumQueryString, @Param("enumQueryInteger") Integer enumQueryInteger, @Param("enumQueryDouble") Double enumQueryDouble, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString); + + /** + * To test enum parameters + * To test enum parameters + * Note, this is equivalent to the other testEnumParameters method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link TestEnumParametersQueryParams} class that allows for + * building up this map in a fluent style. + * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) + * @param enumFormStringArray Form parameter enum test (string array) (optional) + * @param enumFormString Form parameter enum test (string) (optional, default to -efg) + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • enumQueryStringArray - Query parameter enum test (string array) (optional)
  • + *
  • enumQueryString - Query parameter enum test (string) (optional, default to -efg)
  • + *
  • enumQueryInteger - Query parameter enum test (double) (optional)
  • + *
  • enumQueryDouble - Query parameter enum test (double) (optional)
  • + *
+ */ + @RequestLine("GET /fake?enum_query_string_array={enumQueryStringArray}&enum_query_string={enumQueryString}&enum_query_integer={enumQueryInteger}&enum_query_double={enumQueryDouble}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + "enum_header_string_array: {enumHeaderStringArray}", + + "enum_header_string: {enumHeaderString}" + }) + void testEnumParameters(@Param("enumHeaderStringArray") List enumHeaderStringArray, @Param("enumHeaderString") String enumHeaderString, @Param("enumFormStringArray") List enumFormStringArray, @Param("enumFormString") String enumFormString, @QueryMap(encoded=true) Map queryParams); + + /** + * A convenience class for generating query parameters for the + * testEnumParameters method in a fluent style. + */ + public static class TestEnumParametersQueryParams extends HashMap { + public TestEnumParametersQueryParams enumQueryStringArray(final List value) { + put("enum_query_string_array", EncodingUtils.encodeCollection(value, "csv")); + return this; + } + public TestEnumParametersQueryParams enumQueryString(final String value) { + put("enum_query_string", EncodingUtils.encode(value)); + return this; + } + public TestEnumParametersQueryParams enumQueryInteger(final Integer value) { + put("enum_query_integer", EncodingUtils.encode(value)); + return this; + } + public TestEnumParametersQueryParams enumQueryDouble(final Double value) { + put("enum_query_double", EncodingUtils.encode(value)); + return this; + } + } + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + */ + @RequestLine("POST /fake/inline-additionalProperties") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + void testInlineAdditionalProperties(Map requestBody); + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + */ + @RequestLine("GET /fake/jsonFormData") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + void testJsonFormData(@Param("param") String param, @Param("param2") String param2); +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..5ae6e9ff4f4 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,30 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.EncodingUtils; + +import org.openapitools.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import feign.*; + + +public interface FakeClassnameTags123Api extends ApiClient.Api { + + + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @return Client + */ + @RequestLine("PATCH /fake_classname_test") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + Client testClassname(Client client); +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 00000000000..56028b417c4 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,200 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.EncodingUtils; + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import feign.*; + + +public interface PetApi extends ApiClient.Api { + + + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + */ + @RequestLine("POST /pet") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + void addPet(Pet pet); + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + */ + @RequestLine("DELETE /pet/{petId}") + @Headers({ + "Accept: application/json", + "api_key: {apiKey}" + }) + void deletePet(@Param("petId") Long petId, @Param("apiKey") String apiKey); + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * @param status Status values that need to be considered for filter (required) + * @return List<Pet> + */ + @RequestLine("GET /pet/findByStatus?status={status}") + @Headers({ + "Accept: application/json", + }) + List findPetsByStatus(@Param("status") List status); + + /** + * Finds Pets by status + * Multiple status values can be provided with comma separated strings + * Note, this is equivalent to the other findPetsByStatus method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link FindPetsByStatusQueryParams} class that allows for + * building up this map in a fluent style. + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • status - Status values that need to be considered for filter (required)
  • + *
+ * @return List<Pet> + */ + @RequestLine("GET /pet/findByStatus?status={status}") + @Headers({ + "Accept: application/json", + }) + List findPetsByStatus(@QueryMap(encoded=true) Map queryParams); + + /** + * A convenience class for generating query parameters for the + * findPetsByStatus method in a fluent style. + */ + public static class FindPetsByStatusQueryParams extends HashMap { + public FindPetsByStatusQueryParams status(final List value) { + put("status", EncodingUtils.encodeCollection(value, "csv")); + return this; + } + } + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @param tags Tags to filter by (required) + * @return List<Pet> + */ + @RequestLine("GET /pet/findByTags?tags={tags}") + @Headers({ + "Accept: application/json", + }) + List findPetsByTags(@Param("tags") List tags); + + /** + * Finds Pets by tags + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * Note, this is equivalent to the other findPetsByTags method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link FindPetsByTagsQueryParams} class that allows for + * building up this map in a fluent style. + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • tags - Tags to filter by (required)
  • + *
+ * @return List<Pet> + */ + @RequestLine("GET /pet/findByTags?tags={tags}") + @Headers({ + "Accept: application/json", + }) + List findPetsByTags(@QueryMap(encoded=true) Map queryParams); + + /** + * A convenience class for generating query parameters for the + * findPetsByTags method in a fluent style. + */ + public static class FindPetsByTagsQueryParams extends HashMap { + public FindPetsByTagsQueryParams tags(final List value) { + put("tags", EncodingUtils.encodeCollection(value, "csv")); + return this; + } + } + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Pet + */ + @RequestLine("GET /pet/{petId}") + @Headers({ + "Accept: application/json", + }) + Pet getPetById(@Param("petId") Long petId); + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + */ + @RequestLine("PUT /pet") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + void updatePet(Pet pet); + + /** + * 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) + */ + @RequestLine("POST /pet/{petId}") + @Headers({ + "Content-Type: application/x-www-form-urlencoded", + "Accept: application/json", + }) + void updatePetWithForm(@Param("petId") Long petId, @Param("name") String name, @Param("status") String status); + + /** + * uploads an image + * + * @param petId ID of pet to update (required) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) + * @return ModelApiResponse + */ + @RequestLine("POST /pet/{petId}/uploadImage") + @Headers({ + "Content-Type: multipart/form-data", + "Accept: application/json", + }) + ModelApiResponse uploadFile(@Param("petId") Long petId, @Param("additionalMetadata") String additionalMetadata, @Param("file") File file); + + /** + * 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 ModelApiResponse + */ + @RequestLine("POST /fake/{petId}/uploadImageWithRequiredFile") + @Headers({ + "Content-Type: multipart/form-data", + "Accept: application/json", + }) + ModelApiResponse uploadFileWithRequiredFile(@Param("petId") Long petId, @Param("requiredFile") File requiredFile, @Param("additionalMetadata") String additionalMetadata); +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 00000000000..cd2a5c7d10e --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,64 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.EncodingUtils; + +import org.openapitools.client.model.Order; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import feign.*; + + +public interface StoreApi extends ApiClient.Api { + + + /** + * 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) + */ + @RequestLine("DELETE /store/order/{orderId}") + @Headers({ + "Accept: application/json", + }) + void deleteOrder(@Param("orderId") String orderId); + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Map<String, Integer> + */ + @RequestLine("GET /store/inventory") + @Headers({ + "Accept: application/json", + }) + Map getInventory(); + + /** + * Find purchase order by ID + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @param orderId ID of pet that needs to be fetched (required) + * @return Order + */ + @RequestLine("GET /store/order/{orderId}") + @Headers({ + "Accept: application/json", + }) + Order getOrderById(@Param("orderId") Long orderId); + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Order + */ + @RequestLine("POST /store/order") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + Order placeOrder(Order order); +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 00000000000..664aa9216ee --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,149 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.EncodingUtils; + +import org.openapitools.client.model.User; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import feign.*; + + +public interface UserApi extends ApiClient.Api { + + + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + */ + @RequestLine("POST /user") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + void createUser(User user); + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + */ + @RequestLine("POST /user/createWithArray") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + void createUsersWithArrayInput(List user); + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + */ + @RequestLine("POST /user/createWithList") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + void createUsersWithListInput(List user); + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + */ + @RequestLine("DELETE /user/{username}") + @Headers({ + "Accept: application/json", + }) + void deleteUser(@Param("username") String username); + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return User + */ + @RequestLine("GET /user/{username}") + @Headers({ + "Accept: application/json", + }) + User getUserByName(@Param("username") String username); + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return String + */ + @RequestLine("GET /user/login?username={username}&password={password}") + @Headers({ + "Accept: application/json", + }) + String loginUser(@Param("username") String username, @Param("password") String password); + + /** + * Logs user into the system + * + * Note, this is equivalent to the other loginUser method, + * but with the query parameters collected into a single Map parameter. This + * is convenient for services with optional query parameters, especially when + * used with the {@link LoginUserQueryParams} class that allows for + * building up this map in a fluent style. + * @param queryParams Map of query parameters as name-value pairs + *

The following elements may be specified in the query map:

+ *
    + *
  • username - The user name for login (required)
  • + *
  • password - The password for login in clear text (required)
  • + *
+ * @return String + */ + @RequestLine("GET /user/login?username={username}&password={password}") + @Headers({ + "Accept: application/json", + }) + String loginUser(@QueryMap(encoded=true) Map queryParams); + + /** + * A convenience class for generating query parameters for the + * loginUser method in a fluent style. + */ + public static class LoginUserQueryParams extends HashMap { + public LoginUserQueryParams username(final String value) { + put("username", EncodingUtils.encode(value)); + return this; + } + public LoginUserQueryParams password(final String value) { + put("password", EncodingUtils.encode(value)); + return this; + } + } + + /** + * Logs out current logged in user session + * + */ + @RequestLine("GET /user/logout") + @Headers({ + "Accept: application/json", + }) + void logoutUser(); + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + */ + @RequestLine("PUT /user/{username}") + @Headers({ + "Content-Type: */*", + "Accept: application/json", + }) + void updateUser(@Param("username") String username, User user); +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 00000000000..1ff60b8b7a4 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,41 @@ +package org.openapitools.client.auth; + +import feign.RequestInterceptor; +import feign.RequestTemplate; + +public class ApiKeyAuth implements RequestInterceptor { + private final String location; + private final String paramName; + + private String apiKey; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + @Override + public void apply(RequestTemplate template) { + if ("query".equals(location)) { + template.query(paramName, apiKey); + } else if ("header".equals(location)) { + template.header(paramName, apiKey); + } + } +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java new file mode 100644 index 00000000000..b275826472a --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/auth/HttpBasicAuth.java @@ -0,0 +1,41 @@ +package org.openapitools.client.auth; + +import feign.RequestInterceptor; +import feign.RequestTemplate; +import feign.auth.BasicAuthRequestInterceptor; + +/** + * An interceptor that adds the request header needed to use HTTP basic authentication. + */ +public class HttpBasicAuth implements RequestInterceptor { + + private String username; + private String password; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public void setCredentials(String username, String password) { + this.username = username; + this.password = password; + } + + @Override + public void apply(RequestTemplate template) { + RequestInterceptor requestInterceptor = new BasicAuthRequestInterceptor(username, password); + requestInterceptor.apply(template); + } +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/auth/OAuth.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/auth/OAuth.java new file mode 100644 index 00000000000..75c86a7d61b --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/auth/OAuth.java @@ -0,0 +1,198 @@ +package org.openapitools.client.auth; + +import java.io.IOException; +import java.util.Collection; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.AuthenticationRequestBuilder; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; +import org.apache.oltu.oauth2.common.token.BasicOAuthToken; + +import feign.Client; +import feign.Request.HttpMethod; +import feign.Request.Options; +import feign.RequestInterceptor; +import feign.RequestTemplate; +import feign.Response; +import feign.RetryableException; +import feign.Util; +import org.openapitools.client.StringUtil; + + +public class OAuth implements RequestInterceptor { + + static final int MILLIS_PER_SECOND = 1000; + + public interface AccessTokenListener { + void notify(BasicOAuthToken token); + } + + private volatile String accessToken; + private Long expirationTimeMillis; + private OAuthClient oauthClient; + private TokenRequestBuilder tokenRequestBuilder; + private AuthenticationRequestBuilder authenticationRequestBuilder; + private AccessTokenListener accessTokenListener; + + public OAuth(Client client, TokenRequestBuilder requestBuilder) { + this.oauthClient = new OAuthClient(new OAuthFeignClient(client)); + this.tokenRequestBuilder = requestBuilder; + } + + public OAuth(Client client, OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { + this(client, OAuthClientRequest.tokenLocation(tokenUrl).setScope(scopes)); + + switch(flow) { + case accessCode: + case implicit: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case password: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case application: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + authenticationRequestBuilder = OAuthClientRequest.authorizationLocation(authorizationUrl); + } + + public OAuth(OAuthFlow flow, String authorizationUrl, String tokenUrl, String scopes) { + this(new Client.Default(null, null), flow, authorizationUrl, tokenUrl, scopes); + } + + @Override + public void apply(RequestTemplate template) { + // If the request already have an authorization (eg. Basic auth), do nothing + if (template.headers().containsKey("Authorization")) { + return; + } + // If first time, get the token + if (expirationTimeMillis == null || System.currentTimeMillis() >= expirationTimeMillis) { + updateAccessToken(); + } + if (getAccessToken() != null) { + template.header("Authorization", "Bearer " + getAccessToken()); + } + } + + public synchronized void updateAccessToken() { + OAuthJSONAccessTokenResponse accessTokenResponse; + try { + accessTokenResponse = oauthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + } catch (Exception e) { + throw new RetryableException(e.getMessage(), HttpMethod.POST, e, null); + } + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken(), accessTokenResponse.getExpiresIn()); + if (accessTokenListener != null) { + accessTokenListener.notify((BasicOAuthToken) accessTokenResponse.getOAuthToken()); + } + } + } + + public synchronized void registerAccessTokenListener(AccessTokenListener accessTokenListener) { + this.accessTokenListener = accessTokenListener; + } + + public synchronized String getAccessToken() { + return accessToken; + } + + public synchronized void setAccessToken(String accessToken, Long expiresIn) { + this.accessToken = accessToken; + this.expirationTimeMillis = System.currentTimeMillis() + expiresIn * MILLIS_PER_SECOND; + } + + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } + + public AuthenticationRequestBuilder getAuthenticationRequestBuilder() { + return authenticationRequestBuilder; + } + + public void setAuthenticationRequestBuilder(AuthenticationRequestBuilder authenticationRequestBuilder) { + this.authenticationRequestBuilder = authenticationRequestBuilder; + } + + public OAuthClient getOauthClient() { + return oauthClient; + } + + public void setOauthClient(OAuthClient oauthClient) { + this.oauthClient = oauthClient; + } + + public void setOauthClient(Client client) { + this.oauthClient = new OAuthClient( new OAuthFeignClient(client)); + } + + public static class OAuthFeignClient implements HttpClient { + + private Client client; + + public OAuthFeignClient() { + this.client = new Client.Default(null, null); + } + + public OAuthFeignClient(Client client) { + this.client = client; + } + + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + RequestTemplate req = new RequestTemplate() + .append(request.getLocationUri()) + .method(requestMethod) + .body(request.getBody()); + + for (Entry entry : headers.entrySet()) { + req.header(entry.getKey(), entry.getValue()); + } + Response feignResponse; + String body = ""; + try { + feignResponse = client.execute(req.request(), new Options()); + body = Util.toString(feignResponse.body().asReader()); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + + String contentType = null; + Collection contentTypeHeader = feignResponse.headers().get("Content-Type"); + if(contentTypeHeader != null) { + contentType = StringUtil.join(contentTypeHeader.toArray(new String[0]), ";"); + } + + return OAuthClientResponseFactory.createCustomResponse( + body, + contentType, + feignResponse.status(), + responseClass + ); + } + + public void shutdown() { + // Nothing to do here + } + } +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/auth/OAuthFlow.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/auth/OAuthFlow.java new file mode 100644 index 00000000000..9bf8f9605c7 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/auth/OAuthFlow.java @@ -0,0 +1,18 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.auth; + +public enum OAuthFlow { + accessCode, implicit, password, application +} diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 00000000000..e1ada4c7d42 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,133 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * AdditionalPropertiesClass + */ + +public class AdditionalPropertiesClass { + @JsonProperty("map_property") + private Map mapProperty = null; + + @JsonProperty("map_of_map_property") + private Map> mapOfMapProperty = null; + + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap(); + } + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + /** + * Get mapProperty + * @return mapProperty + **/ + @ApiModelProperty(value = "") + public Map getMapProperty() { + return mapProperty; + } + + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap>(); + } + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + /** + * Get mapOfMapProperty + * @return mapOfMapProperty + **/ + @ApiModelProperty(value = "") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 00000000000..5c049e200ff --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,122 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Animal + */ + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "Cat"), +}) + +public class Animal { + @JsonProperty("className") + private String className; + + @JsonProperty("color") + private String color = "red"; + + public Animal className(String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public Animal color(String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + **/ + @ApiModelProperty(value = "") + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/AnimalFarm.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/AnimalFarm.java new file mode 100644 index 00000000000..2f43f1b1a96 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/AnimalFarm.java @@ -0,0 +1,66 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Animal; + +/** + * AnimalFarm + */ + +public class AnimalFarm extends ArrayList { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 00000000000..f3663caed16 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,102 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * ArrayOfArrayOfNumberOnly + */ + +public class ArrayOfArrayOfNumberOnly { + @JsonProperty("ArrayArrayNumber") + private List> arrayArrayNumber = null; + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList>(); + } + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + /** + * Get arrayArrayNumber + * @return arrayArrayNumber + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 00000000000..21938baa130 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -0,0 +1,102 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; + +/** + * ArrayOfNumberOnly + */ + +public class ArrayOfNumberOnly { + @JsonProperty("ArrayNumber") + private List arrayNumber = null; + + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList(); + } + this.arrayNumber.add(arrayNumberItem); + return this; + } + + /** + * Get arrayNumber + * @return arrayNumber + **/ + @ApiModelProperty(value = "") + public List getArrayNumber() { + return arrayNumber; + } + + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 00000000000..5e7b32643f6 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -0,0 +1,164 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; + +/** + * ArrayTest + */ + +public class ArrayTest { + @JsonProperty("array_of_string") + private List arrayOfString = null; + + @JsonProperty("array_array_of_integer") + private List> arrayArrayOfInteger = null; + + @JsonProperty("array_array_of_model") + private List> arrayArrayOfModel = null; + + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList(); + } + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + /** + * Get arrayOfString + * @return arrayOfString + **/ + @ApiModelProperty(value = "") + public List getArrayOfString() { + return arrayOfString; + } + + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList>(); + } + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList>(); + } + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @ApiModelProperty(value = "") + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 00000000000..061063eff71 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,206 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Capitalization + */ + +public class Capitalization { + @JsonProperty("smallCamel") + private String smallCamel; + + @JsonProperty("CapitalCamel") + private String capitalCamel; + + @JsonProperty("small_Snake") + private String smallSnake; + + @JsonProperty("Capital_Snake") + private String capitalSnake; + + @JsonProperty("SCA_ETH_Flow_Points") + private String scAETHFlowPoints; + + @JsonProperty("ATT_NAME") + private String ATT_NAME; + + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @ApiModelProperty(value = "") + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @ApiModelProperty(value = "") + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @ApiModelProperty(value = "") + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @ApiModelProperty(value = "") + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @ApiModelProperty(value = "") + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @ApiModelProperty(value = "Name of the pet ") + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 00000000000..9fc4fda3e20 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Animal; + +/** + * Cat + */ + +public class Cat extends Animal { + @JsonProperty("declawed") + private Boolean declawed; + + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @ApiModelProperty(value = "") + public Boolean isDeclawed() { + return declawed; + } + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 00000000000..ffc9482ffc0 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Category + */ + +public class Category { + @JsonProperty("id") + private Long id; + + @JsonProperty("name") + private String name; + + public Category id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Category name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 00000000000..4076399e9c5 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ClassModel.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") + +public class ClassModel { + @JsonProperty("_class") + private String propertyClass; + + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @ApiModelProperty(value = "") + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 00000000000..2fd30addec8 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Client.java @@ -0,0 +1,91 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Client + */ + +public class Client { + @JsonProperty("client") + private String client; + + public Client client(String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + **/ + @ApiModelProperty(value = "") + public String getClient() { + return client; + } + + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + + sb.append(" client: ").append(toIndentedString(client)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 00000000000..a36ad9d7475 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Animal; + +/** + * Dog + */ + +public class Dog extends Animal { + @JsonProperty("breed") + private String breed; + + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @ApiModelProperty(value = "") + public String getBreed() { + return breed; + } + + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 00000000000..0596441db15 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,194 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +/** + * EnumArrays + */ + +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String text) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("just_symbol") + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String text) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("array_enum") + private List arrayEnum = null; + + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + **/ + @ApiModelProperty(value = "") + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList(); + } + this.arrayEnum.add(arrayEnumItem); + return this; + } + + /** + * Get arrayEnum + * @return arrayEnum + **/ + @ApiModelProperty(value = "") + public List getArrayEnum() { + return arrayEnum; + } + + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 00000000000..444bb0f3c48 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/EnumClass.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String text) { + for (EnumClass b : EnumClass.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 00000000000..27e6dee1d11 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,328 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.OuterEnum; + +/** + * EnumTest + */ + +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringEnum fromValue(String text) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_string") + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(String text) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_integer") + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @JsonValue + public Double getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumNumberEnum fromValue(String text) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_number") + private EnumNumberEnum enumNumber; + + @JsonProperty("outerEnum") + private OuterEnum outerEnum = null; + + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + **/ + @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { + return enumString; + } + + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + **/ + @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @ApiModelProperty(value = "") + public OuterEnum getOuterEnum() { + return outerEnum; + } + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 00000000000..2a8385412f0 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,124 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; + +/** + * FileSchemaTestClass + */ + +public class FileSchemaTestClass { + @JsonProperty("file") + private java.io.File file = null; + + @JsonProperty("files") + private List files = null; + + public FileSchemaTestClass file(java.io.File file) { + this.file = file; + return this; + } + + /** + * Get file + * @return file + **/ + @ApiModelProperty(value = "") + public java.io.File getFile() { + return file; + } + + public void setFile(java.io.File file) { + this.file = file; + } + + public FileSchemaTestClass files(List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(java.io.File filesItem) { + if (this.files == null) { + this.files = new ArrayList(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + **/ + @ApiModelProperty(value = "") + public List getFiles() { + return files; + } + + public void setFiles(List files) { + this.files = files; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this.file, fileSchemaTestClass.file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(file, files); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 00000000000..bdcfdca6dd8 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,382 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.util.UUID; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; + +/** + * FormatTest + */ + +public class FormatTest { + @JsonProperty("integer") + private Integer integer; + + @JsonProperty("int32") + private Integer int32; + + @JsonProperty("int64") + private Long int64; + + @JsonProperty("number") + private BigDecimal number; + + @JsonProperty("float") + private Float _float; + + @JsonProperty("double") + private Double _double; + + @JsonProperty("string") + private String string; + + @JsonProperty("byte") + private byte[] _byte; + + @JsonProperty("binary") + private File binary; + + @JsonProperty("date") + private LocalDate date; + + @JsonProperty("dateTime") + private OffsetDateTime dateTime; + + @JsonProperty("uuid") + private UUID uuid; + + @JsonProperty("password") + private String password; + + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @ApiModelProperty(value = "") + public Integer getInteger() { + return integer; + } + + public void setInteger(Integer integer) { + this.integer = integer; + } + + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @ApiModelProperty(value = "") + public Integer getInt32() { + return int32; + } + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + **/ + @ApiModelProperty(value = "") + public Long getInt64() { + return int64; + } + + public void setInt64(Long int64) { + this.int64 = int64; + } + + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @ApiModelProperty(required = true, value = "") + public BigDecimal getNumber() { + return number; + } + + public void setNumber(BigDecimal number) { + this.number = number; + } + + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @ApiModelProperty(value = "") + public Float getFloat() { + return _float; + } + + public void setFloat(Float _float) { + this._float = _float; + } + + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @ApiModelProperty(value = "") + public Double getDouble() { + return _double; + } + + public void setDouble(Double _double) { + this._double = _double; + } + + public FormatTest string(String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @ApiModelProperty(value = "") + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + **/ + @ApiModelProperty(required = true, value = "") + public byte[] getByte() { + return _byte; + } + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + public FormatTest binary(File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + **/ + @ApiModelProperty(value = "") + public File getBinary() { + return binary; + } + + public void setBinary(File binary) { + this.binary = binary; + } + + public FormatTest date(LocalDate date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + **/ + @ApiModelProperty(required = true, value = "") + public LocalDate getDate() { + return date; + } + + public void setDate(LocalDate date) { + this.date = date; + } + + public FormatTest dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @ApiModelProperty(value = "") + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public FormatTest password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(required = true, value = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.string, formatTest.string) && + Arrays.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 00000000000..c9307f90621 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -0,0 +1,96 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * HasOnlyReadOnly + */ + +public class HasOnlyReadOnly { + @JsonProperty("bar") + private String bar; + + @JsonProperty("foo") + private String foo; + + /** + * Get bar + * @return bar + **/ + @ApiModelProperty(value = "") + public String getBar() { + return bar; + } + + /** + * Get foo + * @return foo + **/ + @ApiModelProperty(value = "") + public String getFoo() { + return foo; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 00000000000..92128acfc7a --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,230 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * MapTest + */ + +public class MapTest { + @JsonProperty("map_map_of_string") + private Map> mapMapOfString = null; + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InnerEnum fromValue(String text) { + for (InnerEnum b : InnerEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("map_of_enum_string") + private Map mapOfEnumString = null; + + @JsonProperty("direct_map") + private Map directMap = null; + + @JsonProperty("indirect_map") + private Map indirectMap = null; + + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap>(); + } + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + /** + * Get mapMapOfString + * @return mapMapOfString + **/ + @ApiModelProperty(value = "") + public Map> getMapMapOfString() { + return mapMapOfString; + } + + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap(); + } + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + /** + * Get mapOfEnumString + * @return mapOfEnumString + **/ + @ApiModelProperty(value = "") + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + public MapTest directMap(Map directMap) { + this.directMap = directMap; + return this; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap(); + } + this.directMap.put(key, directMapItem); + return this; + } + + /** + * Get directMap + * @return directMap + **/ + @ApiModelProperty(value = "") + public Map getDirectMap() { + return directMap; + } + + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + public MapTest indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @ApiModelProperty(value = "") + public Map getIndirectMap() { + return indirectMap; + } + + public void setIndirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 00000000000..c8e0ae1545a --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,151 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import org.threeten.bp.OffsetDateTime; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ + +public class MixedPropertiesAndAdditionalPropertiesClass { + @JsonProperty("uuid") + private UUID uuid; + + @JsonProperty("dateTime") + private OffsetDateTime dateTime; + + @JsonProperty("map") + private Map map = null; + + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @ApiModelProperty(value = "") + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap(); + } + this.map.put(key, mapItem); + return this; + } + + /** + * Get map + * @return map + **/ + @ApiModelProperty(value = "") + public Map getMap() { + return map; + } + + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 00000000000..4d2da937512 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Model200Response.java @@ -0,0 +1,115 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Model for testing model name starting with number + */ +@ApiModel(description = "Model for testing model name starting with number") + +public class Model200Response { + @JsonProperty("name") + private Integer name; + + @JsonProperty("class") + private String propertyClass; + + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @ApiModelProperty(value = "") + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 00000000000..04e167c98f6 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,137 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * ModelApiResponse + */ + +public class ModelApiResponse { + @JsonProperty("code") + private Integer code; + + @JsonProperty("type") + private String type; + + @JsonProperty("message") + private String message; + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @ApiModelProperty(value = "") + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(value = "") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @ApiModelProperty(value = "") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 00000000000..6c3bf33c6b1 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Model for testing reserved words + */ +@ApiModel(description = "Model for testing reserved words") + +public class ModelReturn { + @JsonProperty("return") + private Integer _return; + + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + **/ + @ApiModelProperty(value = "") + public Integer getReturn() { + return _return; + } + + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 00000000000..da57f200d58 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,143 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Model for testing model name same as property name + */ +@ApiModel(description = "Model for testing model name same as property name") + +public class Name { + @JsonProperty("name") + private Integer name; + + @JsonProperty("snake_case") + private Integer snakeCase; + + @JsonProperty("property") + private String property; + + @JsonProperty("123Number") + private Integer _123number; + + public Name name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + /** + * Get snakeCase + * @return snakeCase + **/ + @ApiModelProperty(value = "") + public Integer getSnakeCase() { + return snakeCase; + } + + public Name property(String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + **/ + @ApiModelProperty(value = "") + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + /** + * Get _123number + * @return _123number + **/ + @ApiModelProperty(value = "") + public Integer get123number() { + return _123number; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 00000000000..e8952b8568d --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,92 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * NumberOnly + */ + +public class NumberOnly { + @JsonProperty("JustNumber") + private BigDecimal justNumber; + + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getJustNumber() { + return justNumber; + } + + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + + sb.append(" justNumber: ").append(toIndentedString(justNumber)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 00000000000..e9fabf83f81 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,244 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.threeten.bp.OffsetDateTime; + +/** + * Order + */ + +public class Order { + @JsonProperty("id") + private Long id; + + @JsonProperty("petId") + private Long petId; + + @JsonProperty("quantity") + private Integer quantity; + + @JsonProperty("shipDate") + private OffsetDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("status") + private StatusEnum status; + + @JsonProperty("complete") + private Boolean complete = false; + + public Order id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + **/ + @ApiModelProperty(value = "") + public Long getPetId() { + return petId; + } + + public void setPetId(Long petId) { + this.petId = petId; + } + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @ApiModelProperty(value = "") + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Order shipDate(OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @ApiModelProperty(value = "") + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + **/ + @ApiModelProperty(value = "Order Status") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + **/ + @ApiModelProperty(value = "") + public Boolean isComplete() { + return complete; + } + + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 00000000000..a360a821676 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,138 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber; + + @JsonProperty("my_string") + private String myString; + + @JsonProperty("my_boolean") + private Boolean myBoolean; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean isMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 00000000000..f2906d1c36f --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,59 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String text) { + for (OuterEnum b : OuterEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 00000000000..18845f5a6ff --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,260 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; + +/** + * Pet + */ + +public class Pet { + @JsonProperty("id") + private Long id; + + @JsonProperty("category") + private Category category = null; + + @JsonProperty("name") + private String name; + + @JsonProperty("photoUrls") + private List photoUrls = new ArrayList(); + + @JsonProperty("tags") + private List tags = null; + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("status") + private StatusEnum status; + + public Pet id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Pet category(Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + **/ + @ApiModelProperty(value = "") + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + public Pet name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "doggie", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @ApiModelProperty(required = true, value = "") + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @ApiModelProperty(value = "") + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + **/ + @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 00000000000..edade3b2a37 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -0,0 +1,105 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * ReadOnlyFirst + */ + +public class ReadOnlyFirst { + @JsonProperty("bar") + private String bar; + + @JsonProperty("baz") + private String baz; + + /** + * Get bar + * @return bar + **/ + @ApiModelProperty(value = "") + public String getBar() { + return bar; + } + + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + **/ + @ApiModelProperty(value = "") + public String getBaz() { + return baz; + } + + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 00000000000..494c9cd98ad --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -0,0 +1,91 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * SpecialModelName + */ + +public class SpecialModelName { + @JsonProperty("$special[property.name]") + private Long $specialPropertyName; + + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + **/ + @ApiModelProperty(value = "") + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName $specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/StringBooleanMap.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/StringBooleanMap.java new file mode 100644 index 00000000000..8b18b0c9b51 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/StringBooleanMap.java @@ -0,0 +1,65 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; + +/** + * StringBooleanMap + */ + +public class StringBooleanMap extends HashMap { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StringBooleanMap {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 00000000000..10334b74be4 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,114 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * Tag + */ + +public class Tag { + @JsonProperty("id") + private Long id; + + @JsonProperty("name") + private String name; + + public Tag id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Tag name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 00000000000..0d0cd0d2908 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,252 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +/** + * User + */ + +public class User { + @JsonProperty("id") + private Long id; + + @JsonProperty("username") + private String username; + + @JsonProperty("firstName") + private String firstName; + + @JsonProperty("lastName") + private String lastName; + + @JsonProperty("email") + private String email; + + @JsonProperty("password") + private String password; + + @JsonProperty("phone") + private String phone; + + @JsonProperty("userStatus") + private Integer userStatus; + + public User id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public User username(String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @ApiModelProperty(value = "") + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @ApiModelProperty(value = "") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @ApiModelProperty(value = "") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public User email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @ApiModelProperty(value = "") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public User password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(value = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public User phone(String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @ApiModelProperty(value = "") + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @ApiModelProperty(value = "User Status") + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/StringUtilTest.java b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/StringUtilTest.java new file mode 100644 index 00000000000..aa7c81759ec --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/StringUtilTest.java @@ -0,0 +1,33 @@ +package org.openapitools.client; + +import org.junit.*; +import static org.junit.Assert.*; + + +public class StringUtilTest { + @Test + public void testContainsIgnoreCase() { + assertTrue(StringUtil.containsIgnoreCase(new String[]{"abc"}, "abc")); + assertTrue(StringUtil.containsIgnoreCase(new String[]{"abc"}, "ABC")); + assertTrue(StringUtil.containsIgnoreCase(new String[]{"ABC"}, "abc")); + assertTrue(StringUtil.containsIgnoreCase(new String[]{null, "abc"}, "ABC")); + assertTrue(StringUtil.containsIgnoreCase(new String[]{null, "abc"}, null)); + + assertFalse(StringUtil.containsIgnoreCase(new String[]{"abc"}, "def")); + assertFalse(StringUtil.containsIgnoreCase(new String[]{}, "ABC")); + assertFalse(StringUtil.containsIgnoreCase(new String[]{}, null)); + } + + @Test + public void testJoin() { + String[] array = {"aa", "bb", "cc"}; + assertEquals("aa,bb,cc", StringUtil.join(array, ",")); + assertEquals("aa, bb, cc", StringUtil.join(array, ", ")); + assertEquals("aabbcc", StringUtil.join(array, "")); + assertEquals("aa bb cc", StringUtil.join(array, " ")); + assertEquals("aa\nbb\ncc", StringUtil.join(array, "\n")); + + assertEquals("", StringUtil.join(new String[]{}, ",")); + assertEquals("abc", StringUtil.join(new String[]{"abc"}, ",")); + } +} diff --git a/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java new file mode 100644 index 00000000000..f9319e14530 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -0,0 +1,40 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.Client; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for AnotherFakeApi + */ +public class AnotherFakeApiTest { + + private AnotherFakeApi api; + + @Before + public void setup() { + api = new ApiClient().buildClient(AnotherFakeApi.class); + } + + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + */ + @Test + public void call123testSpecialTagsTest() { + Client client = null; + // Client response = api.call123testSpecialTags(client); + + // TODO: test validations + } + + +} diff --git a/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 00000000000..c5153830112 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,249 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.User; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +public class FakeApiTest { + + private FakeApi api; + + @Before + public void setup() { + api = new ApiClient().buildClient(FakeApi.class); + } + + + /** + * + * + * Test serialization of outer boolean types + */ + @Test + public void fakeOuterBooleanSerializeTest() { + Boolean body = null; + // Boolean response = api.fakeOuterBooleanSerialize(body); + + // TODO: test validations + } + + + /** + * + * + * Test serialization of object with outer number type + */ + @Test + public void fakeOuterCompositeSerializeTest() { + OuterComposite outerComposite = null; + // OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite); + + // TODO: test validations + } + + + /** + * + * + * Test serialization of outer number types + */ + @Test + public void fakeOuterNumberSerializeTest() { + BigDecimal body = null; + // BigDecimal response = api.fakeOuterNumberSerialize(body); + + // TODO: test validations + } + + + /** + * + * + * Test serialization of outer string types + */ + @Test + public void fakeOuterStringSerializeTest() { + String body = null; + // String response = api.fakeOuterStringSerialize(body); + + // TODO: test validations + } + + + /** + * + * + * For this test, the body for this request much reference a schema named `File`. + */ + @Test + public void testBodyWithFileSchemaTest() { + FileSchemaTestClass fileSchemaTestClass = null; + // api.testBodyWithFileSchema(fileSchemaTestClass); + + // TODO: test validations + } + + + /** + * + * + * + */ + @Test + public void testBodyWithQueryParamsTest() { + String query = null; + User user = null; + // api.testBodyWithQueryParams(query, user); + + // TODO: test validations + } + + /** + * + * + * + * + * This tests the overload of the method that uses a Map for query parameters instead of + * listing them out individually. + */ + @Test + public void testBodyWithQueryParamsTestQueryMap() { + User user = null; + FakeApi.TestBodyWithQueryParamsQueryParams queryParams = new FakeApi.TestBodyWithQueryParamsQueryParams() + .query(null); + // api.testBodyWithQueryParams(user, queryParams); + + // TODO: test validations + } + + /** + * To test \"client\" model + * + * To test \"client\" model + */ + @Test + public void testClientModelTest() { + Client client = null; + // Client response = api.testClientModel(client); + + // TODO: test validations + } + + + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + */ + @Test + public void testEndpointParametersTest() { + BigDecimal number = null; + Double _double = null; + String patternWithoutDelimiter = null; + byte[] _byte = null; + Integer integer = null; + Integer int32 = null; + Long int64 = null; + Float _float = null; + String string = null; + File binary = null; + LocalDate date = null; + OffsetDateTime dateTime = null; + String password = null; + String paramCallback = null; + // api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + + // TODO: test validations + } + + + /** + * To test enum parameters + * + * To test enum parameters + */ + @Test + public void testEnumParametersTest() { + List enumHeaderStringArray = null; + String enumHeaderString = null; + List enumQueryStringArray = null; + String enumQueryString = null; + Integer enumQueryInteger = null; + Double enumQueryDouble = null; + List enumFormStringArray = null; + String enumFormString = null; + // api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + + // TODO: test validations + } + + /** + * To test enum parameters + * + * To test enum parameters + * + * This tests the overload of the method that uses a Map for query parameters instead of + * listing them out individually. + */ + @Test + public void testEnumParametersTestQueryMap() { + List enumHeaderStringArray = null; + String enumHeaderString = null; + List enumFormStringArray = null; + String enumFormString = null; + FakeApi.TestEnumParametersQueryParams queryParams = new FakeApi.TestEnumParametersQueryParams() + .enumQueryStringArray(null) + .enumQueryString(null) + .enumQueryInteger(null) + .enumQueryDouble(null); + // api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumFormStringArray, enumFormString, queryParams); + + // TODO: test validations + } + + /** + * test inline additionalProperties + * + * + */ + @Test + public void testInlineAdditionalPropertiesTest() { + Map requestBody = null; + // api.testInlineAdditionalProperties(requestBody); + + // TODO: test validations + } + + + /** + * test json serialization of form data + * + * + */ + @Test + public void testJsonFormDataTest() { + String param = null; + String param2 = null; + // api.testJsonFormData(param, param2); + + // TODO: test validations + } + + +} diff --git a/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..192ca5e1e30 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,40 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.Client; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeClassnameTags123Api + */ +public class FakeClassnameTags123ApiTest { + + private FakeClassnameTags123Api api; + + @Before + public void setup() { + api = new ApiClient().buildClient(FakeClassnameTags123Api.class); + } + + + /** + * To test class name in snake case + * + * To test class name in snake case + */ + @Test + public void testClassnameTest() { + Client client = null; + // Client response = api.testClassname(client); + + // TODO: test validations + } + + +} diff --git a/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 00000000000..3914f4c01a5 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,193 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for PetApi + */ +public class PetApiTest { + + private PetApi api; + + @Before + public void setup() { + api = new ApiClient().buildClient(PetApi.class); + } + + + /** + * Add a new pet to the store + * + * + */ + @Test + public void addPetTest() { + Pet pet = null; + // api.addPet(pet); + + // TODO: test validations + } + + + /** + * Deletes a pet + * + * + */ + @Test + public void deletePetTest() { + Long petId = null; + String apiKey = null; + // api.deletePet(petId, apiKey); + + // TODO: test validations + } + + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + */ + @Test + public void findPetsByStatusTest() { + List status = null; + // List response = api.findPetsByStatus(status); + + // TODO: test validations + } + + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + * + * This tests the overload of the method that uses a Map for query parameters instead of + * listing them out individually. + */ + @Test + public void findPetsByStatusTestQueryMap() { + PetApi.FindPetsByStatusQueryParams queryParams = new PetApi.FindPetsByStatusQueryParams() + .status(null); + // List response = api.findPetsByStatus(queryParams); + + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + */ + @Test + public void findPetsByTagsTest() { + List tags = null; + // List response = api.findPetsByTags(tags); + + // TODO: test validations + } + + /** + * Finds Pets by tags + * + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * + * This tests the overload of the method that uses a Map for query parameters instead of + * listing them out individually. + */ + @Test + public void findPetsByTagsTestQueryMap() { + PetApi.FindPetsByTagsQueryParams queryParams = new PetApi.FindPetsByTagsQueryParams() + .tags(null); + // List response = api.findPetsByTags(queryParams); + + // TODO: test validations + } + + /** + * Find pet by ID + * + * Returns a single pet + */ + @Test + public void getPetByIdTest() { + Long petId = null; + // Pet response = api.getPetById(petId); + + // TODO: test validations + } + + + /** + * Update an existing pet + * + * + */ + @Test + public void updatePetTest() { + Pet pet = null; + // api.updatePet(pet); + + // TODO: test validations + } + + + /** + * Updates a pet in the store with form data + * + * + */ + @Test + public void updatePetWithFormTest() { + Long petId = null; + String name = null; + String status = null; + // api.updatePetWithForm(petId, name, status); + + // TODO: test validations + } + + + /** + * uploads an image + * + * + */ + @Test + public void uploadFileTest() { + Long petId = null; + String additionalMetadata = null; + File file = null; + // ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + + // TODO: test validations + } + + + /** + * uploads an image (required) + * + * + */ + @Test + public void uploadFileWithRequiredFileTest() { + Long petId = null; + File requiredFile = null; + String additionalMetadata = null; + // ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + + // TODO: test validations + } + + +} diff --git a/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 00000000000..bdb0b7a1e09 --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,81 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.Order; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for StoreApi + */ +public class StoreApiTest { + + private StoreApi api; + + @Before + public void setup() { + api = new ApiClient().buildClient(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 + */ + @Test + public void deleteOrderTest() { + String orderId = null; + // api.deleteOrder(orderId); + + // TODO: test validations + } + + + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + */ + @Test + public void getInventoryTest() { + // Map response = 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 + */ + @Test + public void getOrderByIdTest() { + Long orderId = null; + // Order response = api.getOrderById(orderId); + + // TODO: test validations + } + + + /** + * Place an order for a pet + * + * + */ + @Test + public void placeOrderTest() { + Order order = null; + // Order response = api.placeOrder(order); + + // TODO: test validations + } + + +} diff --git a/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 00000000000..c1d841f1e8a --- /dev/null +++ b/samples/client/petstore/java/feign10x/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,156 @@ +package org.openapitools.client.api; + +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.User; +import org.junit.Before; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * API tests for UserApi + */ +public class UserApiTest { + + private UserApi api; + + @Before + public void setup() { + api = new ApiClient().buildClient(UserApi.class); + } + + + /** + * Create user + * + * This can only be done by the logged in user. + */ + @Test + public void createUserTest() { + User user = null; + // api.createUser(user); + + // TODO: test validations + } + + + /** + * Creates list of users with given input array + * + * + */ + @Test + public void createUsersWithArrayInputTest() { + List user = null; + // api.createUsersWithArrayInput(user); + + // TODO: test validations + } + + + /** + * Creates list of users with given input array + * + * + */ + @Test + public void createUsersWithListInputTest() { + List user = null; + // api.createUsersWithListInput(user); + + // TODO: test validations + } + + + /** + * Delete user + * + * This can only be done by the logged in user. + */ + @Test + public void deleteUserTest() { + String username = null; + // api.deleteUser(username); + + // TODO: test validations + } + + + /** + * Get user by user name + * + * + */ + @Test + public void getUserByNameTest() { + String username = null; + // User response = api.getUserByName(username); + + // TODO: test validations + } + + + /** + * Logs user into the system + * + * + */ + @Test + public void loginUserTest() { + String username = null; + String password = null; + // String response = api.loginUser(username, password); + + // TODO: test validations + } + + /** + * Logs user into the system + * + * + * + * This tests the overload of the method that uses a Map for query parameters instead of + * listing them out individually. + */ + @Test + public void loginUserTestQueryMap() { + UserApi.LoginUserQueryParams queryParams = new UserApi.LoginUserQueryParams() + .username(null) + .password(null); + // String response = api.loginUser(queryParams); + + // TODO: test validations + } + + /** + * Logs out current logged in user session + * + * + */ + @Test + public void logoutUserTest() { + // api.logoutUser(); + + // TODO: test validations + } + + + /** + * Updated user + * + * This can only be done by the logged in user. + */ + @Test + public void updateUserTest() { + String username = null; + User user = null; + // api.updateUser(username, user); + + // TODO: test validations + } + + +} diff --git a/samples/client/petstore/java/google-api-client/build.gradle b/samples/client/petstore/java/google-api-client/build.gradle index d66603375ad..97de036a9ce 100644 --- a/samples/client/petstore/java/google-api-client/build.gradle +++ b/samples/client/petstore/java/google-api-client/build.gradle @@ -94,7 +94,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" jackson_version = "2.8.9" google_api_client_version = "1.23.0" jersey_common_version = "2.25.1" diff --git a/samples/client/petstore/java/google-api-client/build.sbt b/samples/client/petstore/java/google-api-client/build.sbt index 92a0aabedde..7052571b29f 100644 --- a/samples/client/petstore/java/google-api-client/build.sbt +++ b/samples/client/petstore/java/google-api-client/build.sbt @@ -9,7 +9,7 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.17", + "io.swagger" % "swagger-annotations" % "1.5.21", "com.google.api-client" % "google-api-client" % "1.23.0", "org.glassfish.jersey.core" % "jersey-common" % "2.25.1", "com.fasterxml.jackson.core" % "jackson-core" % "2.8.9" % "compile", diff --git a/samples/client/petstore/java/google-api-client/docs/FakeApi.md b/samples/client/petstore/java/google-api-client/docs/FakeApi.md index b550c716171..5ec1d20e445 100644 --- a/samples/client/petstore/java/google-api-client/docs/FakeApi.md +++ b/samples/client/petstore/java/google-api-client/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/google-api-client/docs/MapTest.md b/samples/client/petstore/java/google-api-client/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/google-api-client/docs/MapTest.md +++ b/samples/client/petstore/java/google-api-client/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/google-api-client/docs/PetApi.md b/samples/client/petstore/java/google-api-client/docs/PetApi.md index 41c08ccf9e3..8d621d1682a 100644 --- a/samples/client/petstore/java/google-api-client/docs/PetApi.md +++ b/samples/client/petstore/java/google-api-client/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/google-api-client/docs/UserApi.md b/samples/client/petstore/java/google-api-client/docs/UserApi.md index 102d04ac2c4..b7b880585f7 100644 --- a/samples/client/petstore/java/google-api-client/docs/UserApi.md +++ b/samples/client/petstore/java/google-api-client/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/google-api-client/pom.xml b/samples/client/petstore/java/google-api-client/pom.xml index 02d40660155..af558ebb155 100644 --- a/samples/client/petstore/java/google-api-client/pom.xml +++ b/samples/client/petstore/java/google-api-client/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -246,11 +244,11 @@ UTF-8 - 1.5.17 + 1.5.21 1.23.0 2.25.1 2.8.9 - 2.6.4 + 2.6.4 1.0.0 4.12 diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Animal.java index 6819bd7fe7d..5c049e200ff 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Animal.java @@ -35,7 +35,7 @@ import io.swagger.annotations.ApiModelProperty; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Capitalization.java index f0b2d5cd99f..061063eff71 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Capitalization.java @@ -27,22 +27,22 @@ import io.swagger.annotations.ApiModelProperty; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Cat.java index 76311c5de09..c5d652f6a3d 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Cat.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Category.java index 60f4d2b07b2..ffc9482ffc0 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Category.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ClassModel.java index d16a676db3d..4076399e9c5 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ClassModel.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Client.java index 290c475cb54..2fd30addec8 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Client.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Dog.java index b7beed2df53..a36ad9d7475 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Dog.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumArrays.java index 3b1b51c26a3..0596441db15 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -64,7 +64,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumTest.java index 122f370cef9..27e6dee1d11 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/EnumTest.java @@ -65,7 +65,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -105,7 +105,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -143,7 +143,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -181,7 +181,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FormatTest.java index de08419d1db..bdcfdca6dd8 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/FormatTest.java @@ -32,43 +32,43 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index ddd9bfbf678..c9307f90621 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MapTest.java index f67fb22c45c..92128acfc7a 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MapTest.java @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -75,7 +74,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -155,21 +154,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index a12b7048008..c8e0ae1545a 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -33,10 +33,10 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Model200Response.java index edef1b3e626..4d2da937512 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Model200Response.java @@ -28,10 +28,10 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 2f89b60db0b..04e167c98f6 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -27,13 +27,13 @@ import io.swagger.annotations.ApiModelProperty; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelReturn.java index 4adcfed3c3d..6c3bf33c6b1 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Name.java index 1f55823fcf4..da57f200d58 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Name.java @@ -28,16 +28,16 @@ import io.swagger.annotations.ApiModelProperty; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/NumberOnly.java index 7372bf2d2fd..e8952b8568d 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -28,7 +28,7 @@ import java.math.BigDecimal; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Order.java index 351e8ad268d..0e5fad25586 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Order.java @@ -28,16 +28,16 @@ import org.threeten.bp.OffsetDateTime; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -77,7 +77,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/OuterComposite.java index e1372035e86..864d298e107 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -28,13 +28,13 @@ import java.math.BigDecimal; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Pet.java index 183260074e2..18845f5a6ff 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Pet.java @@ -31,13 +31,13 @@ import org.openapitools.client.model.Tag; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList(); @@ -83,7 +83,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 17bd805fa5c..edade3b2a37 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/SpecialModelName.java index f0181742543..494c9cd98ad 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Tag.java index 2607dc2a1a5..10334b74be4 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/Tag.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/User.java index 42d73dd62dc..0d0cd0d2908 100644 --- a/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/google-api-client/src/main/java/org/openapitools/client/model/User.java @@ -27,28 +27,28 @@ import io.swagger.annotations.ApiModelProperty; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey1/docs/FakeApi.md b/samples/client/petstore/java/jersey1/docs/FakeApi.md index b550c716171..5ec1d20e445 100644 --- a/samples/client/petstore/java/jersey1/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey1/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/jersey1/docs/MapTest.md b/samples/client/petstore/java/jersey1/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/jersey1/docs/MapTest.md +++ b/samples/client/petstore/java/jersey1/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/jersey1/docs/PetApi.md b/samples/client/petstore/java/jersey1/docs/PetApi.md index 41c08ccf9e3..8d621d1682a 100644 --- a/samples/client/petstore/java/jersey1/docs/PetApi.md +++ b/samples/client/petstore/java/jersey1/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/jersey1/docs/UserApi.md b/samples/client/petstore/java/jersey1/docs/UserApi.md index 102d04ac2c4..b7b880585f7 100644 --- a/samples/client/petstore/java/jersey1/docs/UserApi.md +++ b/samples/client/petstore/java/jersey1/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/jersey1/pom.xml b/samples/client/petstore/java/jersey1/pom.xml index 397958485ba..c2ccfcede3a 100644 --- a/samples/client/petstore/java/jersey1/pom.xml +++ b/samples/client/petstore/java/jersey1/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -257,7 +255,7 @@ UTF-8 - 1.5.17 + 1.5.21 1.19.4 2.6.4 1.0.0 diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/Pair.java index 18a0e96bfc7..0619e8c408b 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/Pair.java @@ -24,13 +24,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -44,8 +48,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/api/FakeApi.java index 6a45c6ba2a8..ac9d1f4e362 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/api/FakeApi.java @@ -341,16 +341,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) * @throws ApiException if fails to make API call */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -434,13 +434,13 @@ if (paramCallback != null) /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @param enumHeaderStringArray Header parameter enum test (string array) (optional * @param enumHeaderString Header parameter enum test (string) (optional, default to -efg) - * @param enumQueryStringArray Query parameter enum test (string array) (optional) + * @param enumQueryStringArray Query parameter enum test (string array) (optional * @param enumQueryString Query parameter enum test (string) (optional, default to -efg) * @param enumQueryInteger Query parameter enum test (double) (optional) * @param enumQueryDouble Query parameter enum test (double) (optional) - * @param enumFormStringArray Form parameter enum test (string array) (optional, default to $) + * @param enumFormStringArray Form parameter enum test (string array) (optional * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @throws ApiException if fails to make API call */ diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/api/PetApi.java index 95440adf042..a2516b11270 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/api/PetApi.java @@ -312,8 +312,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { @@ -360,8 +360,8 @@ if (status != null) * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call */ @@ -410,7 +410,7 @@ if (file != null) * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call */ diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Animal.java index 6819bd7fe7d..5c049e200ff 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Animal.java @@ -35,7 +35,7 @@ import io.swagger.annotations.ApiModelProperty; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Capitalization.java index f0b2d5cd99f..061063eff71 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Capitalization.java @@ -27,22 +27,22 @@ import io.swagger.annotations.ApiModelProperty; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Cat.java index 76311c5de09..c5d652f6a3d 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Cat.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Category.java index 60f4d2b07b2..ffc9482ffc0 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Category.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ClassModel.java index d16a676db3d..4076399e9c5 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ClassModel.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Client.java index 290c475cb54..2fd30addec8 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Client.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Dog.java index b7beed2df53..a36ad9d7475 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Dog.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumArrays.java index 6ffd4ef8cca..7a7cc2a1274 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -64,7 +64,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumTest.java index a690465dc55..bf1b02689e6 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/EnumTest.java @@ -65,7 +65,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -105,7 +105,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -143,7 +143,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -181,7 +181,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FormatTest.java index de08419d1db..bdcfdca6dd8 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/FormatTest.java @@ -32,43 +32,43 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index ddd9bfbf678..c9307f90621 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MapTest.java index 4dedd32ad76..9dcab0dc5b9 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MapTest.java @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -75,7 +74,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -155,21 +154,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index a12b7048008..c8e0ae1545a 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -33,10 +33,10 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Model200Response.java index edef1b3e626..4d2da937512 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Model200Response.java @@ -28,10 +28,10 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 2f89b60db0b..04e167c98f6 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -27,13 +27,13 @@ import io.swagger.annotations.ApiModelProperty; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelReturn.java index 4adcfed3c3d..6c3bf33c6b1 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Name.java index 1f55823fcf4..da57f200d58 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Name.java @@ -28,16 +28,16 @@ import io.swagger.annotations.ApiModelProperty; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/NumberOnly.java index 7372bf2d2fd..e8952b8568d 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -28,7 +28,7 @@ import java.math.BigDecimal; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Order.java index 1a0a9134007..18cc15e406e 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Order.java @@ -28,16 +28,16 @@ import org.threeten.bp.OffsetDateTime; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -77,7 +77,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/OuterComposite.java index e1372035e86..864d298e107 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -28,13 +28,13 @@ import java.math.BigDecimal; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Pet.java index e4fdef95353..d980e62f7cc 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Pet.java @@ -31,13 +31,13 @@ import org.openapitools.client.model.Tag; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList(); @@ -83,7 +83,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 17bd805fa5c..edade3b2a37 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/SpecialModelName.java index f0181742543..494c9cd98ad 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Tag.java index 2607dc2a1a5..10334b74be4 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/Tag.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/User.java index 42d73dd62dc..0d0cd0d2908 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/jersey1/src/main/java/org/openapitools/client/model/User.java @@ -27,28 +27,28 @@ import io.swagger.annotations.ApiModelProperty; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey2-java6/build.sbt b/samples/client/petstore/java/jersey2-java6/build.sbt index 3d85a70e1d7..ea742941dcd 100644 --- a/samples/client/petstore/java/jersey2-java6/build.sbt +++ b/samples/client/petstore/java/jersey2-java6/build.sbt @@ -9,7 +9,7 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.20", + "io.swagger" % "swagger-annotations" % "1.5.21", "org.glassfish.jersey.core" % "jersey-client" % "2.6", "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.6", "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.6", diff --git a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md index b550c716171..5ec1d20e445 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/jersey2-java6/docs/MapTest.md b/samples/client/petstore/java/jersey2-java6/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/MapTest.md +++ b/samples/client/petstore/java/jersey2-java6/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/jersey2-java6/docs/PetApi.md b/samples/client/petstore/java/jersey2-java6/docs/PetApi.md index 41c08ccf9e3..8d621d1682a 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/PetApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/jersey2-java6/docs/UserApi.md b/samples/client/petstore/java/jersey2-java6/docs/UserApi.md index 102d04ac2c4..b7b880585f7 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/UserApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/jersey2-java6/pom.xml b/samples/client/petstore/java/jersey2-java6/pom.xml index 46ee931b3d4..eea08b8d535 100644 --- a/samples/client/petstore/java/jersey2-java6/pom.xml +++ b/samples/client/petstore/java/jersey2-java6/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -200,7 +198,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} @@ -267,7 +265,7 @@ UTF-8 - 1.5.20 + 1.5.21 2.6 2.5 3.6 diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/Pair.java index 18a0e96bfc7..0619e8c408b 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/Pair.java @@ -24,13 +24,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -44,8 +48,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java index aea408f84de..217f4b30495 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/FakeApi.java @@ -399,16 +399,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) * @throws ApiException if fails to make API call */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -423,16 +423,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) * @throws ApiException if fails to make API call */ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -515,9 +515,9 @@ if (paramCallback != null) /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) @@ -533,9 +533,9 @@ if (paramCallback != null) /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java index 0af6b7ce7be..d09a2892a4d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/api/PetApi.java @@ -362,8 +362,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { @@ -375,8 +375,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { @@ -422,8 +422,8 @@ if (status != null) * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call */ @@ -435,8 +435,8 @@ if (status != null) * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call */ @@ -484,7 +484,7 @@ if (file != null) * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call */ @@ -497,7 +497,7 @@ if (file != null) * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call */ diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java index 090fe37550e..e3c7ad73959 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Animal.java @@ -34,7 +34,7 @@ import io.swagger.annotations.ApiModelProperty; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Capitalization.java index f0b3df1f99d..86a82841b90 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Capitalization.java @@ -26,22 +26,22 @@ import io.swagger.annotations.ApiModelProperty; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Cat.java index 32d52beedcb..10b979e23c0 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Cat.java @@ -27,7 +27,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Category.java index 02b03d8b5f5..a8efb73047b 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Category.java @@ -26,10 +26,10 @@ import io.swagger.annotations.ApiModelProperty; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ClassModel.java index 5f1b322efcf..240b91f240a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ClassModel.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Client.java index 08e93c12e68..62980bfcb4d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Client.java @@ -26,7 +26,7 @@ import io.swagger.annotations.ApiModelProperty; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Dog.java index 0241c4faf61..aa780322caa 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Dog.java @@ -27,7 +27,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java index 8e188928f3c..f2f0de22c37 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -63,7 +63,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java index 344bccccd28..2f12993434d 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/EnumTest.java @@ -64,7 +64,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -104,7 +104,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -142,7 +142,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -180,7 +180,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/FormatTest.java index 5c5fe28dc31..b01b7c15a80 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/FormatTest.java @@ -31,43 +31,43 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 19b3f4c1d82..b1aa60bb9b7 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -26,10 +26,10 @@ import io.swagger.annotations.ApiModelProperty; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java index a42b294efdf..2cc326e5a90 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MapTest.java @@ -22,7 +22,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -74,7 +73,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -154,21 +153,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 8d808e06528..0e49277cabc 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -32,10 +32,10 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Model200Response.java index 18521a1135b..437249f7ecc 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Model200Response.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelApiResponse.java index ec4d676211c..d56c2976715 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -26,13 +26,13 @@ import io.swagger.annotations.ApiModelProperty; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelReturn.java index b80347d3bee..5ea891a8990 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Name.java index 9e2743d148f..88113087d0b 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Name.java @@ -27,16 +27,16 @@ import io.swagger.annotations.ApiModelProperty; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/NumberOnly.java index c1d5d130286..e04739de873 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -27,7 +27,7 @@ import java.math.BigDecimal; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java index e254c63f093..b3e96020eeb 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Order.java @@ -27,16 +27,16 @@ import org.threeten.bp.OffsetDateTime; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -76,7 +76,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterComposite.java index 0307a6368dd..a068b61779e 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -27,13 +27,13 @@ import java.math.BigDecimal; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java index 529bdde6fe6..ae929fbd879 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Pet.java @@ -30,13 +30,13 @@ import org.openapitools.client.model.Tag; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList(); @@ -82,7 +82,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 63c07b89258..ad4e3f617df 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -26,10 +26,10 @@ import io.swagger.annotations.ApiModelProperty; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/SpecialModelName.java index caa3be809e6..7b514438e25 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -26,7 +26,7 @@ import io.swagger.annotations.ApiModelProperty; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Tag.java index 053894e6f81..169b017347a 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/Tag.java @@ -26,10 +26,10 @@ import io.swagger.annotations.ApiModelProperty; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/User.java index 5b399f765fb..6c18f27b1b4 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/org/openapitools/client/model/User.java @@ -26,28 +26,28 @@ import io.swagger.annotations.ApiModelProperty; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey2-java8/build.gradle b/samples/client/petstore/java/jersey2-java8/build.gradle index d271017ae90..d2daa9fa14a 100644 --- a/samples/client/petstore/java/jersey2-java8/build.gradle +++ b/samples/client/petstore/java/jersey2-java8/build.gradle @@ -93,7 +93,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.20" + swagger_annotations_version = "1.5.21" jackson_version = "2.9.6" jersey_version = "2.27" junit_version = "4.12" diff --git a/samples/client/petstore/java/jersey2-java8/build.sbt b/samples/client/petstore/java/jersey2-java8/build.sbt index 1bd1f63a7d5..8edfce668ab 100644 --- a/samples/client/petstore/java/jersey2-java8/build.sbt +++ b/samples/client/petstore/java/jersey2-java8/build.sbt @@ -9,7 +9,7 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.20", + "io.swagger" % "swagger-annotations" % "1.5.21", "org.glassfish.jersey.core" % "jersey-client" % "2.25.1", "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1", "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1", diff --git a/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md index b550c716171..5ec1d20e445 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/jersey2-java8/docs/MapTest.md b/samples/client/petstore/java/jersey2-java8/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/MapTest.md +++ b/samples/client/petstore/java/jersey2-java8/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/jersey2-java8/docs/PetApi.md b/samples/client/petstore/java/jersey2-java8/docs/PetApi.md index 41c08ccf9e3..8d621d1682a 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/PetApi.md +++ b/samples/client/petstore/java/jersey2-java8/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/jersey2-java8/docs/UserApi.md b/samples/client/petstore/java/jersey2-java8/docs/UserApi.md index 102d04ac2c4..b7b880585f7 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/UserApi.md +++ b/samples/client/petstore/java/jersey2-java8/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/jersey2-java8/pom.xml b/samples/client/petstore/java/jersey2-java8/pom.xml index c6317e79ee4..70130e62c2a 100644 --- a/samples/client/petstore/java/jersey2-java8/pom.xml +++ b/samples/client/petstore/java/jersey2-java8/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -200,7 +198,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} @@ -251,7 +249,7 @@ UTF-8 - 1.5.20 + 1.5.21 2.27 2.8.9 1.0.0 diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/Pair.java index 18a0e96bfc7..0619e8c408b 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/Pair.java @@ -24,13 +24,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -44,8 +48,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java index 0daf9d84fa8..167ef1fb4d8 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/FakeApi.java @@ -399,16 +399,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) * @throws ApiException if fails to make API call */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -423,16 +423,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) * @throws ApiException if fails to make API call */ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -515,9 +515,9 @@ if (paramCallback != null) /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) @@ -533,9 +533,9 @@ if (paramCallback != null) /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java index 0af6b7ce7be..d09a2892a4d 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/api/PetApi.java @@ -362,8 +362,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { @@ -375,8 +375,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { @@ -422,8 +422,8 @@ if (status != null) * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call */ @@ -435,8 +435,8 @@ if (status != null) * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call */ @@ -484,7 +484,7 @@ if (file != null) * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call */ @@ -497,7 +497,7 @@ if (file != null) * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call */ diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java index 6819bd7fe7d..5c049e200ff 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Animal.java @@ -35,7 +35,7 @@ import io.swagger.annotations.ApiModelProperty; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java index f0b2d5cd99f..061063eff71 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Capitalization.java @@ -27,22 +27,22 @@ import io.swagger.annotations.ApiModelProperty; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java index 76311c5de09..c5d652f6a3d 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Cat.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java index 60f4d2b07b2..ffc9482ffc0 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Category.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java index d16a676db3d..4076399e9c5 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ClassModel.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java index 290c475cb54..2fd30addec8 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Client.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java index b7beed2df53..a36ad9d7475 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Dog.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java index 1caf492f5a2..abe6860634d 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -64,7 +64,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java index 122f370cef9..27e6dee1d11 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/EnumTest.java @@ -65,7 +65,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -105,7 +105,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -143,7 +143,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -181,7 +181,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java index 3f8ceea5022..e2060dc5c58 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/FormatTest.java @@ -32,43 +32,43 @@ import java.util.UUID; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index ddd9bfbf678..c9307f90621 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java index 8e9c0d6cb1e..905b2258ede 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MapTest.java @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -75,7 +74,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -155,21 +154,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 1fc647e6bbd..5c9562605fc 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -33,10 +33,10 @@ import org.openapitools.client.model.Animal; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java index edef1b3e626..4d2da937512 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Model200Response.java @@ -28,10 +28,10 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 2f89b60db0b..04e167c98f6 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -27,13 +27,13 @@ import io.swagger.annotations.ApiModelProperty; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java index 4adcfed3c3d..6c3bf33c6b1 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java index 1f55823fcf4..da57f200d58 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Name.java @@ -28,16 +28,16 @@ import io.swagger.annotations.ApiModelProperty; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java index 7372bf2d2fd..e8952b8568d 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -28,7 +28,7 @@ import java.math.BigDecimal; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java index ced70217682..bc23e2ab4ee 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Order.java @@ -28,16 +28,16 @@ import java.time.OffsetDateTime; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -77,7 +77,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java index e1372035e86..864d298e107 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -28,13 +28,13 @@ import java.math.BigDecimal; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java index 0c495abb421..d84c2a6fc9d 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Pet.java @@ -31,13 +31,13 @@ import org.openapitools.client.model.Tag; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList<>(); @@ -83,7 +83,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 17bd805fa5c..edade3b2a37 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java index f0181742543..494c9cd98ad 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java index 2607dc2a1a5..10334b74be4 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/Tag.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java index 42d73dd62dc..0d0cd0d2908 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/org/openapitools/client/model/User.java @@ -27,28 +27,28 @@ import io.swagger.annotations.ApiModelProperty; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey2/build.gradle b/samples/client/petstore/java/jersey2/build.gradle index f1a401ef53e..84f8976c2ca 100644 --- a/samples/client/petstore/java/jersey2/build.gradle +++ b/samples/client/petstore/java/jersey2/build.gradle @@ -93,7 +93,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.20" + swagger_annotations_version = "1.5.21" jackson_version = "2.9.6" jersey_version = "2.27" junit_version = "4.12" diff --git a/samples/client/petstore/java/jersey2/build.sbt b/samples/client/petstore/java/jersey2/build.sbt index 578112888ec..e3f30385eff 100644 --- a/samples/client/petstore/java/jersey2/build.sbt +++ b/samples/client/petstore/java/jersey2/build.sbt @@ -9,7 +9,7 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.20", + "io.swagger" % "swagger-annotations" % "1.5.21", "org.glassfish.jersey.core" % "jersey-client" % "2.25.1", "org.glassfish.jersey.media" % "jersey-media-multipart" % "2.25.1", "org.glassfish.jersey.media" % "jersey-media-json-jackson" % "2.25.1", diff --git a/samples/client/petstore/java/jersey2/docs/FakeApi.md b/samples/client/petstore/java/jersey2/docs/FakeApi.md index b550c716171..5ec1d20e445 100644 --- a/samples/client/petstore/java/jersey2/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/jersey2/docs/MapTest.md b/samples/client/petstore/java/jersey2/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/jersey2/docs/MapTest.md +++ b/samples/client/petstore/java/jersey2/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/jersey2/docs/PetApi.md b/samples/client/petstore/java/jersey2/docs/PetApi.md index 41c08ccf9e3..8d621d1682a 100644 --- a/samples/client/petstore/java/jersey2/docs/PetApi.md +++ b/samples/client/petstore/java/jersey2/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/jersey2/docs/UserApi.md b/samples/client/petstore/java/jersey2/docs/UserApi.md index 102d04ac2c4..b7b880585f7 100644 --- a/samples/client/petstore/java/jersey2/docs/UserApi.md +++ b/samples/client/petstore/java/jersey2/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/jersey2/pom.xml b/samples/client/petstore/java/jersey2/pom.xml index ffc94e97dec..94391c45448 100644 --- a/samples/client/petstore/java/jersey2/pom.xml +++ b/samples/client/petstore/java/jersey2/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -200,7 +198,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} @@ -257,7 +255,7 @@ UTF-8 - 1.5.20 + 1.5.21 2.27 2.8.9 2.6.4 diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/Pair.java index 18a0e96bfc7..0619e8c408b 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/Pair.java @@ -24,13 +24,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -44,8 +48,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java index aea408f84de..217f4b30495 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/FakeApi.java @@ -399,16 +399,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) * @throws ApiException if fails to make API call */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -423,16 +423,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) * @throws ApiException if fails to make API call */ public ApiResponse testEndpointParametersWithHttpInfo(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -515,9 +515,9 @@ if (paramCallback != null) /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) @@ -533,9 +533,9 @@ if (paramCallback != null) /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java index 0af6b7ce7be..d09a2892a4d 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/api/PetApi.java @@ -362,8 +362,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { @@ -375,8 +375,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ public ApiResponse updatePetWithFormWithHttpInfo(Long petId, String name, String status) throws ApiException { @@ -422,8 +422,8 @@ if (status != null) * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call */ @@ -435,8 +435,8 @@ if (status != null) * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call */ @@ -484,7 +484,7 @@ if (file != null) * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse * @throws ApiException if fails to make API call */ @@ -497,7 +497,7 @@ if (file != null) * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException if fails to make API call */ diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java index 6819bd7fe7d..5c049e200ff 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Animal.java @@ -35,7 +35,7 @@ import io.swagger.annotations.ApiModelProperty; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Capitalization.java index f0b2d5cd99f..061063eff71 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Capitalization.java @@ -27,22 +27,22 @@ import io.swagger.annotations.ApiModelProperty; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Cat.java index 76311c5de09..c5d652f6a3d 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Cat.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Category.java index 60f4d2b07b2..ffc9482ffc0 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Category.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ClassModel.java index d16a676db3d..4076399e9c5 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ClassModel.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Client.java index 290c475cb54..2fd30addec8 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Client.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Dog.java index b7beed2df53..a36ad9d7475 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Dog.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java index 6ffd4ef8cca..7a7cc2a1274 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -64,7 +64,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java index a690465dc55..bf1b02689e6 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/EnumTest.java @@ -65,7 +65,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -105,7 +105,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -143,7 +143,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -181,7 +181,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/FormatTest.java index de08419d1db..bdcfdca6dd8 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/FormatTest.java @@ -32,43 +32,43 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index ddd9bfbf678..c9307f90621 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java index 4dedd32ad76..9dcab0dc5b9 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MapTest.java @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -75,7 +74,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -155,21 +154,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index a12b7048008..c8e0ae1545a 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -33,10 +33,10 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Model200Response.java index edef1b3e626..4d2da937512 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Model200Response.java @@ -28,10 +28,10 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 2f89b60db0b..04e167c98f6 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -27,13 +27,13 @@ import io.swagger.annotations.ApiModelProperty; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ModelReturn.java index 4adcfed3c3d..6c3bf33c6b1 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Name.java index 1f55823fcf4..da57f200d58 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Name.java @@ -28,16 +28,16 @@ import io.swagger.annotations.ApiModelProperty; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/NumberOnly.java index 7372bf2d2fd..e8952b8568d 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -28,7 +28,7 @@ import java.math.BigDecimal; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java index 1a0a9134007..18cc15e406e 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Order.java @@ -28,16 +28,16 @@ import org.threeten.bp.OffsetDateTime; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -77,7 +77,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterComposite.java index e1372035e86..864d298e107 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -28,13 +28,13 @@ import java.math.BigDecimal; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java index e4fdef95353..d980e62f7cc 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Pet.java @@ -31,13 +31,13 @@ import org.openapitools.client.model.Tag; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList(); @@ -83,7 +83,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 17bd805fa5c..edade3b2a37 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/SpecialModelName.java index f0181742543..494c9cd98ad 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Tag.java index 2607dc2a1a5..10334b74be4 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/Tag.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/User.java index 42d73dd62dc..0d0cd0d2908 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/jersey2/src/main/java/org/openapitools/client/model/User.java @@ -27,28 +27,28 @@ import io.swagger.annotations.ApiModelProperty; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle index 7825e6dbbd7..4a683652134 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/build.gradle @@ -99,6 +99,7 @@ dependencies { compile 'com.squareup.okhttp:logging-interceptor:2.7.5' compile 'com.google.code.gson:gson:2.8.1' compile 'io.gsonfire:gson-fire:1.8.0' + compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1' compile 'org.threeten:threetenbp:1.3.5' testCompile 'junit:junit:4.12' } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md index b550c716171..5ec1d20e445 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MapTest.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MapTest.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/PetApi.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/PetApi.md index 41c08ccf9e3..8d621d1682a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/PetApi.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md index 102d04ac2c4..b7b880585f7 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml index fab158949e6..d9fa038a36d 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/pom.xml @@ -212,6 +212,11 @@ io.gsonfire gson-fire ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.1 org.threeten diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java index 86ce63c9b93..f8ad6cf3902 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/ApiClient.java @@ -23,6 +23,9 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import org.threeten.bp.format.DateTimeFormatter; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + import javax.net.ssl.*; import java.io.File; import java.io.IOException; @@ -49,6 +52,8 @@ import org.openapitools.client.auth.Authentication; import org.openapitools.client.auth.HttpBasicAuth; import org.openapitools.client.auth.ApiKeyAuth; import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; public class ApiClient { @@ -77,6 +82,39 @@ public class ApiClient { * Constructor for ApiClient */ public ApiClient() { + init(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("petstore_auth", new OAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /* + * Constructor for ApiClient to support access token retry on 401/403 + */ + public ApiClient( + String clientId, + String clientSecret, + Map parameters + ) { + init(); + + RetryingOAuth retryingOAuth = new RetryingOAuth("", clientId, OAuthFlow.implicit, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + httpClient.interceptors().add(retryingOAuth); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + private void init() { httpClient = new OkHttpClient(); @@ -87,14 +125,7 @@ public class ApiClient { // Set default User-Agent. setUserAgent("OpenAPI-Generator/1.0.0/java"); - // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); - authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); - authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); } /** @@ -484,6 +515,20 @@ public class ApiClient { return this; } + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + /** * Format the given parameter object into string. * @@ -499,7 +544,7 @@ public class ApiClient { return jsonStr.substring(1, jsonStr.length() - 1); } else if (param instanceof Collection) { StringBuilder b = new StringBuilder(); - for (Object o : (Collection)param) { + for (Object o : (Collection) param) { if (b.length() > 0) { b.append(","); } @@ -524,7 +569,9 @@ public class ApiClient { List params = new ArrayList(); // preconditions - if (name == null || name.isEmpty() || value == null || value instanceof Collection) return params; + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } params.add(new Pair(name, parameterToString(value))); return params; @@ -569,7 +616,7 @@ public class ApiClient { delimiter = escapeString("|"); } - StringBuilder sb = new StringBuilder() ; + StringBuilder sb = new StringBuilder(); for (Object item : value) { sb.append(delimiter); sb.append(escapeString(parameterToString(item))); @@ -639,7 +686,7 @@ public class ApiClient { */ public String selectHeaderContentType(String[] contentTypes) { if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { - return "application/json"; + return "application/json"; } for (String contentType : contentTypes) { if (isJsonMime(contentType)) { @@ -963,7 +1010,7 @@ public class ApiClient { * @param formParams The form parameters * @param authNames The authentications to apply * @param progressRequestListener Progress request listener - * @return The HTTP request + * @return The HTTP request * @throws ApiException If fail to serialize the request body object */ public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { @@ -1080,13 +1127,15 @@ public class ApiClient { * Update query and header parameters based on authentication settings. * * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters + * @param queryParams List of query parameters + * @param headerParams Map of header parameters */ public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { for (String authName : authNames) { Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } auth.applyToParams(queryParams, headerParams); } } @@ -1098,7 +1147,7 @@ public class ApiClient { * @return RequestBody */ public RequestBody buildRequestBodyFormEncoding(Map formParams) { - FormEncodingBuilder formBuilder = new FormEncodingBuilder(); + FormEncodingBuilder formBuilder = new FormEncodingBuilder(); for (Entry param : formParams.entrySet()) { formBuilder.add(param.getKey(), parameterToString(param.getValue())); } @@ -1161,10 +1210,12 @@ public class ApiClient { public X509Certificate[] getAcceptedIssuers() { return null; } }; SSLContext sslContext = SSLContext.getInstance("TLS"); - trustManagers = new TrustManager[]{ trustAll }; + trustManagers = new TrustManager[] {trustAll}; hostnameVerifier = new HostnameVerifier() { @Override - public boolean verify(String hostname, SSLSession session) { return true; } + public boolean verify(String hostname, SSLSession session) { + return true; + } }; } else if (sslCaCert != null) { char[] password = null; // Any password will work. diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/GzipRequestInterceptor.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/GzipRequestInterceptor.java index 64d88915295..f7ecf09b39e 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/GzipRequestInterceptor.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/GzipRequestInterceptor.java @@ -27,7 +27,8 @@ import java.io.IOException; * Taken from https://github.com/square/okhttp/issues/350 */ class GzipRequestInterceptor implements Interceptor { - @Override public Response intercept(Chain chain) throws IOException { + @Override + public Response intercept(Chain chain) throws IOException { Request originalRequest = chain.request(); if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { return chain.proceed(originalRequest); @@ -63,19 +64,22 @@ class GzipRequestInterceptor implements Interceptor { private RequestBody gzip(final RequestBody body) { return new RequestBody() { - @Override public MediaType contentType() { + @Override + public MediaType contentType() { return body.contentType(); } - @Override public long contentLength() { + @Override + public long contentLength() { return -1; // We don't know the compressed length in advance! } - @Override public void writeTo(BufferedSink sink) throws IOException { + @Override + public void writeTo(BufferedSink sink) throws IOException { BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); body.writeTo(gzipSink); gzipSink.close(); } }; } -} \ No newline at end of file +} diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java index 64ff528f11c..8f1c98264dc 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/JSON.java @@ -52,19 +52,17 @@ public class JSON { public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() - .registerTypeSelector(Animal.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap(); - classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class); - classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class); - classByDiscriminatorValue.put("Animal".toUpperCase(Locale.ROOT), Animal.class); - return getClassByDiscriminator( - classByDiscriminatorValue, - getDiscriminatorValue(readElement, "className")); - } + .registerTypeSelector(Animal.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class); + classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class); + classByDiscriminatorValue.put("Animal".toUpperCase(Locale.ROOT), Animal.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } }) - ; GsonBuilder builder = fireBuilder.createGsonBuilder(); return builder; @@ -72,7 +70,7 @@ public class JSON { private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { JsonElement element = readElement.getAsJsonObject().get(discriminatorField); - if(null == element) { + if (null == element) { throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); } return element.getAsString(); @@ -80,7 +78,7 @@ public class JSON { private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase(Locale.ROOT)); - if(null == clazz) { + if (null == clazz) { throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); } return clazz; @@ -153,9 +151,11 @@ public class JSON { } catch (JsonParseException e) { // Fallback processing when failed to parse JSON form response body: // return the response body string directly for the String return type; - if (returnType.equals(String.class)) + if (returnType.equals(String.class)) { return (T) body; - else throw (e); + } else { + throw (e); + } } } @@ -291,8 +291,7 @@ public class JSON { private DateFormat dateFormat; - public SqlDateTypeAdapter() { - } + public SqlDateTypeAdapter() {} public SqlDateTypeAdapter(DateFormat dateFormat) { this.dateFormat = dateFormat; @@ -345,8 +344,7 @@ public class JSON { private DateFormat dateFormat; - public DateTypeAdapter() { - } + public DateTypeAdapter() {} public DateTypeAdapter(DateFormat dateFormat) { this.dateFormat = dateFormat; diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/Pair.java index 18a0e96bfc7..0619e8c408b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/Pair.java @@ -24,13 +24,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -44,8 +48,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index cb429b37da6..ef2a1c94f92 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -70,16 +70,15 @@ public class AnotherFakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json" @@ -87,7 +86,7 @@ public class AnotherFakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java index 9179f116ec3..6db391fbe62 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeApi.java @@ -77,16 +77,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -94,7 +93,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -194,16 +193,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -211,7 +209,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -311,16 +309,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -328,7 +325,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -428,16 +425,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -445,7 +441,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -545,16 +541,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json" @@ -562,7 +557,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -664,18 +659,19 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - if (query != null) - localVarQueryParams.addAll(apiClient.parameterToPair("query", query)); + if (query != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("query", query)); + } Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json" @@ -683,7 +679,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -792,16 +788,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json" @@ -809,7 +804,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -904,16 +899,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute @@ -927,44 +922,71 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (integer != null) - localVarFormParams.put("integer", integer); - if (int32 != null) - localVarFormParams.put("int32", int32); - if (int64 != null) - localVarFormParams.put("int64", int64); - if (number != null) - localVarFormParams.put("number", number); - if (_float != null) - localVarFormParams.put("float", _float); - if (_double != null) - localVarFormParams.put("double", _double); - if (string != null) - localVarFormParams.put("string", string); - if (patternWithoutDelimiter != null) - localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); - if (_byte != null) - localVarFormParams.put("byte", _byte); - if (binary != null) - localVarFormParams.put("binary", binary); - if (date != null) - localVarFormParams.put("date", date); - if (dateTime != null) - localVarFormParams.put("dateTime", dateTime); - if (password != null) - localVarFormParams.put("password", password); - if (paramCallback != null) - localVarFormParams.put("callback", paramCallback); + if (integer != null) { + localVarFormParams.put("integer", integer); + } + + if (int32 != null) { + localVarFormParams.put("int32", int32); + } + + if (int64 != null) { + localVarFormParams.put("int64", int64); + } + + if (number != null) { + localVarFormParams.put("number", number); + } + + if (_float != null) { + localVarFormParams.put("float", _float); + } + + if (_double != null) { + localVarFormParams.put("double", _double); + } + + if (string != null) { + localVarFormParams.put("string", string); + } + + if (patternWithoutDelimiter != null) { + localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); + } + + if (_byte != null) { + localVarFormParams.put("byte", _byte); + } + + if (binary != null) { + localVarFormParams.put("binary", binary); + } + + if (date != null) { + localVarFormParams.put("date", date); + } + + if (dateTime != null) { + localVarFormParams.put("dateTime", dateTime); + } + + if (password != null) { + localVarFormParams.put("password", password); + } + + if (paramCallback != null) { + localVarFormParams.put("callback", paramCallback); + } final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/x-www-form-urlencoded" @@ -972,7 +994,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -1024,16 +1046,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -1047,16 +1069,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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 ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1072,16 +1094,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -1119,7 +1141,7 @@ public class FakeApi { * @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 enumFormStringArray Form parameter enum test (string array) (optional) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @param progressListener Progress listener * @param progressRequestListener Progress request listener @@ -1134,32 +1156,47 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - if (enumQueryStringArray != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray)); - if (enumQueryString != null) - localVarQueryParams.addAll(apiClient.parameterToPair("enum_query_string", enumQueryString)); - if (enumQueryInteger != null) - localVarQueryParams.addAll(apiClient.parameterToPair("enum_query_integer", enumQueryInteger)); - if (enumQueryDouble != null) - localVarQueryParams.addAll(apiClient.parameterToPair("enum_query_double", enumQueryDouble)); + if (enumQueryStringArray != null) { + localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray)); + } + + if (enumQueryString != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("enum_query_string", enumQueryString)); + } + + if (enumQueryInteger != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("enum_query_integer", enumQueryInteger)); + } + + if (enumQueryDouble != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("enum_query_double", enumQueryDouble)); + } Map localVarHeaderParams = new HashMap(); - if (enumHeaderStringArray != null) - localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); - if (enumHeaderString != null) - localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString)); + if (enumHeaderStringArray != null) { + localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); + } + + if (enumHeaderString != null) { + localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString)); + } Map localVarFormParams = new HashMap(); - if (enumFormStringArray != null) - localVarFormParams.put("enum_form_string_array", enumFormStringArray); - if (enumFormString != null) - localVarFormParams.put("enum_form_string", enumFormString); + if (enumFormStringArray != null) { + localVarFormParams.put("enum_form_string_array", enumFormStringArray); + } + + if (enumFormString != null) { + localVarFormParams.put("enum_form_string", enumFormString); + } final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/x-www-form-urlencoded" @@ -1167,7 +1204,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -1201,7 +1238,7 @@ public class FakeApi { * @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 enumFormStringArray Form parameter enum test (string array) (optional) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1218,7 +1255,7 @@ public class FakeApi { * @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 enumFormStringArray Form parameter enum test (string array) (optional) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -1237,7 +1274,7 @@ public class FakeApi { * @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 enumFormStringArray Form parameter enum test (string array) (optional) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @param callback The callback to be executed when the API call finishes * @return The request call @@ -1284,16 +1321,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json" @@ -1301,7 +1337,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -1403,20 +1439,23 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (param != null) - localVarFormParams.put("param", param); - if (param2 != null) - localVarFormParams.put("param2", param2); + if (param != null) { + localVarFormParams.put("param", param); + } + + if (param2 != null) { + localVarFormParams.put("param2", param2); + } final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/x-www-form-urlencoded" @@ -1424,7 +1463,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 749598b3099..fee24a345ed 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -70,16 +70,15 @@ public class FakeClassnameTags123Api { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json" @@ -87,7 +86,7 @@ public class FakeClassnameTags123Api { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java index d1b477e0d44..7f5e5a3b4d2 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/PetApi.java @@ -72,16 +72,15 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json", "application/xml" @@ -89,7 +88,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -192,18 +191,19 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - if (apiKey != null) - localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + if (apiKey != null) { + localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + } Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -211,7 +211,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -315,18 +315,19 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - if (status != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); + if (status != null) { + localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); + } Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -334,7 +335,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -441,18 +442,19 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - if (tags != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); + if (tags != null) { + localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); + } Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -460,7 +462,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -573,16 +575,15 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -590,7 +591,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -695,16 +696,15 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json", "application/xml" @@ -712,7 +712,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -800,8 +800,8 @@ public class PetApi { /** * Build call for updatePetWithForm * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute @@ -816,20 +816,23 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (name != null) - localVarFormParams.put("name", name); - if (status != null) - localVarFormParams.put("status", status); + if (name != null) { + localVarFormParams.put("name", name); + } + + if (status != null) { + localVarFormParams.put("status", status); + } final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/x-www-form-urlencoded" @@ -837,7 +840,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -871,8 +874,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { @@ -883,8 +886,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -897,8 +900,8 @@ public class PetApi { * Updates a pet in the store with form data (asynchronously) * * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -931,8 +934,8 @@ public class PetApi { /** * Build call for uploadFile * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute @@ -947,20 +950,23 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (additionalMetadata != null) - localVarFormParams.put("additionalMetadata", additionalMetadata); - if (file != null) - localVarFormParams.put("file", file); + if (additionalMetadata != null) { + localVarFormParams.put("additionalMetadata", additionalMetadata); + } + + if (file != null) { + localVarFormParams.put("file", file); + } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "multipart/form-data" @@ -968,7 +974,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -1002,8 +1008,8 @@ public class PetApi { * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ModelApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1016,8 +1022,8 @@ public class PetApi { * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1031,8 +1037,8 @@ public class PetApi { * uploads an image (asynchronously) * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -1067,7 +1073,7 @@ public class PetApi { * Build call for uploadFileWithRequiredFile * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute @@ -1082,20 +1088,23 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (additionalMetadata != null) - localVarFormParams.put("additionalMetadata", additionalMetadata); - if (requiredFile != null) - localVarFormParams.put("requiredFile", requiredFile); + if (additionalMetadata != null) { + localVarFormParams.put("additionalMetadata", additionalMetadata); + } + + if (requiredFile != null) { + localVarFormParams.put("requiredFile", requiredFile); + } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "multipart/form-data" @@ -1103,7 +1112,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -1143,7 +1152,7 @@ public class PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1157,7 +1166,7 @@ public class PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1172,7 +1181,7 @@ public class PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java index c4669755c16..c9924191862 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/StoreApi.java @@ -71,16 +71,15 @@ public class StoreApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -88,7 +87,7 @@ public class StoreApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -188,16 +187,15 @@ public class StoreApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -205,7 +203,7 @@ public class StoreApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -303,16 +301,15 @@ public class StoreApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -320,7 +317,7 @@ public class StoreApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -425,16 +422,15 @@ public class StoreApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -442,7 +438,7 @@ public class StoreApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java index bf4c1fb77aa..ffb2e6bd52c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/api/UserApi.java @@ -70,16 +70,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -87,7 +86,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -188,16 +187,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -205,7 +203,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -306,16 +304,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -323,7 +320,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -425,16 +422,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -442,7 +438,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -544,16 +540,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -561,7 +556,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -667,20 +662,23 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - if (username != null) - localVarQueryParams.addAll(apiClient.parameterToPair("username", username)); - if (password != null) - localVarQueryParams.addAll(apiClient.parameterToPair("password", password)); + if (username != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("password", password)); + } Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -688,7 +686,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -800,16 +798,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -817,7 +814,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -912,16 +909,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -929,7 +925,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 00000000000..76b4f76af76 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,68 @@ +package org.openapitools.client.auth; + +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.MediaType; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.RequestBody; +import com.squareup.okhttp.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(mediaType, request.getBody()) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 00000000000..78fcb52d5a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,165 @@ +package org.openapitools.client.auth; + +import com.squareup.okhttp.Interceptor; +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.Map; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (String paramName : parameters.keySet()) { + tokenRequestBuilder.setParameter(paramName, parameters.get(paramName)); + } + } + } + + public void setFlow(OAuthFlow flow) { + switch(flow) { + case accessCode: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case implicit: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case password: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case application: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.urlString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (String headerName : headers.keySet()) { + requestBuilder.addHeader(headerName, headers.get(headerName)); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /* + * Returns true if the access token has been updated + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + return !getAccessToken().equals(requestAccessToken); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + + return false; + } + + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } +} diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java index 650963fbe3e..88dcbcf467c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Animal.java @@ -34,7 +34,7 @@ import android.os.Parcel; public class Animal implements Parcelable { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className = null; + private String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java index 3ead5f54a91..56b21459ba8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Capitalization.java @@ -33,27 +33,27 @@ import android.os.Parcel; public class Capitalization implements Parcelable { public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) - private String smallCamel = null; + private String smallCamel; public static final String SERIALIZED_NAME_CAPITAL_CAMEL = "CapitalCamel"; @SerializedName(SERIALIZED_NAME_CAPITAL_CAMEL) - private String capitalCamel = null; + private String capitalCamel; public static final String SERIALIZED_NAME_SMALL_SNAKE = "small_Snake"; @SerializedName(SERIALIZED_NAME_SMALL_SNAKE) - private String smallSnake = null; + private String smallSnake; public static final String SERIALIZED_NAME_CAPITAL_SNAKE = "Capital_Snake"; @SerializedName(SERIALIZED_NAME_CAPITAL_SNAKE) - private String capitalSnake = null; + private String capitalSnake; public static final String SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; @SerializedName(SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS) - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; public static final String SERIALIZED_NAME_A_T_T_N_A_M_E = "ATT_NAME"; @SerializedName(SERIALIZED_NAME_A_T_T_N_A_M_E) - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java index 48a49dbd952..e480941c064 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Cat.java @@ -34,7 +34,7 @@ import android.os.Parcel; public class Cat extends Animal implements Parcelable { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) - private Boolean declawed = null; + private Boolean declawed; public Cat() { super(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java index 2c7ac3802a5..b8127d81106 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Category.java @@ -33,11 +33,11 @@ import android.os.Parcel; public class Category implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Category() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java index 0a9ed5857c5..132836f4838 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ClassModel.java @@ -34,7 +34,7 @@ import android.os.Parcel; public class ClassModel implements Parcelable { public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public ClassModel() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java index 4f685e64bf0..73c0fc25d45 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Client.java @@ -33,7 +33,7 @@ import android.os.Parcel; public class Client implements Parcelable { public static final String SERIALIZED_NAME_CLIENT = "client"; @SerializedName(SERIALIZED_NAME_CLIENT) - private String client = null; + private String client; public Client() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java index 417e979efc0..2f235d324e7 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Dog.java @@ -34,7 +34,7 @@ import android.os.Parcel; public class Dog extends Animal implements Parcelable { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) - private String breed = null; + private String breed; public Dog() { super(); diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java index 7bef802a4c9..18d508efe51 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -82,7 +82,7 @@ public class EnumArrays implements Parcelable { public static final String SERIALIZED_NAME_JUST_SYMBOL = "just_symbol"; @SerializedName(SERIALIZED_NAME_JUST_SYMBOL) - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java index b5fe8a5bb24..64b27a47ea8 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/EnumTest.java @@ -83,7 +83,7 @@ public class EnumTest implements Parcelable { public static final String SERIALIZED_NAME_ENUM_STRING = "enum_string"; @SerializedName(SERIALIZED_NAME_ENUM_STRING) - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -136,7 +136,7 @@ public class EnumTest implements Parcelable { public static final String SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required"; @SerializedName(SERIALIZED_NAME_ENUM_STRING_REQUIRED) - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -187,7 +187,7 @@ public class EnumTest implements Parcelable { public static final String SERIALIZED_NAME_ENUM_INTEGER = "enum_integer"; @SerializedName(SERIALIZED_NAME_ENUM_INTEGER) - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -238,7 +238,7 @@ public class EnumTest implements Parcelable { public static final String SERIALIZED_NAME_ENUM_NUMBER = "enum_number"; @SerializedName(SERIALIZED_NAME_ENUM_NUMBER) - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; public static final String SERIALIZED_NAME_OUTER_ENUM = "outerEnum"; @SerializedName(SERIALIZED_NAME_OUTER_ENUM) diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java index cb4f6d6675c..ca46cedca71 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/FormatTest.java @@ -38,55 +38,55 @@ import android.os.Parcel; public class FormatTest implements Parcelable { public static final String SERIALIZED_NAME_INTEGER = "integer"; @SerializedName(SERIALIZED_NAME_INTEGER) - private Integer integer = null; + private Integer integer; public static final String SERIALIZED_NAME_INT32 = "int32"; @SerializedName(SERIALIZED_NAME_INT32) - private Integer int32 = null; + private Integer int32; public static final String SERIALIZED_NAME_INT64 = "int64"; @SerializedName(SERIALIZED_NAME_INT64) - private Long int64 = null; + private Long int64; public static final String SERIALIZED_NAME_NUMBER = "number"; @SerializedName(SERIALIZED_NAME_NUMBER) - private BigDecimal number = null; + private BigDecimal number; public static final String SERIALIZED_NAME_FLOAT = "float"; @SerializedName(SERIALIZED_NAME_FLOAT) - private Float _float = null; + private Float _float; public static final String SERIALIZED_NAME_DOUBLE = "double"; @SerializedName(SERIALIZED_NAME_DOUBLE) - private Double _double = null; + private Double _double; public static final String SERIALIZED_NAME_STRING = "string"; @SerializedName(SERIALIZED_NAME_STRING) - private String string = null; + private String string; public static final String SERIALIZED_NAME_BYTE = "byte"; @SerializedName(SERIALIZED_NAME_BYTE) - private byte[] _byte = null; + private byte[] _byte; public static final String SERIALIZED_NAME_BINARY = "binary"; @SerializedName(SERIALIZED_NAME_BINARY) - private File binary = null; + private File binary; public static final String SERIALIZED_NAME_DATE = "date"; @SerializedName(SERIALIZED_NAME_DATE) - private LocalDate date = null; + private LocalDate date; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public FormatTest() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index e135a3074e6..589a69fb889 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -33,11 +33,11 @@ import android.os.Parcel; public class HasOnlyReadOnly implements Parcelable { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_FOO = "foo"; @SerializedName(SERIALIZED_NAME_FOO) - private String foo = null; + private String foo; public HasOnlyReadOnly() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java index 102741c9c4c..54cb45709b2 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MapTest.java @@ -26,7 +26,6 @@ import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; import android.os.Parcelable; import android.os.Parcel; @@ -96,7 +95,7 @@ public class MapTest implements Parcelable { public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map"; @SerializedName(SERIALIZED_NAME_INDIRECT_MAP) - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest() { } @@ -178,21 +177,29 @@ public class MapTest implements Parcelable { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } @@ -254,7 +261,7 @@ public class MapTest implements Parcelable { mapMapOfString = (Map>)in.readValue(Map.class.getClassLoader()); mapOfEnumString = (Map)in.readValue(null); directMap = (Map)in.readValue(null); - indirectMap = (StringBooleanMap)in.readValue(StringBooleanMap.class.getClassLoader()); + indirectMap = (Map)in.readValue(null); } public int describeContents() { diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 42b7097ee10..61723e40582 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -39,11 +39,11 @@ import android.os.Parcel; public class MixedPropertiesAndAdditionalPropertiesClass implements Parcelable { public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; public static final String SERIALIZED_NAME_MAP = "map"; @SerializedName(SERIALIZED_NAME_MAP) diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java index 5d1a97443b5..064a9e1ac1f 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Model200Response.java @@ -34,11 +34,11 @@ import android.os.Parcel; public class Model200Response implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_PROPERTY_CLASS = "class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public Model200Response() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 314dd8319ba..fe7770d8a34 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -33,15 +33,15 @@ import android.os.Parcel; public class ModelApiResponse implements Parcelable { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) - private Integer code = null; + private Integer code; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) - private String type = null; + private String type; public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) - private String message = null; + private String message; public ModelApiResponse() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java index 3b0fd84eaef..146f8b33450 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -34,7 +34,7 @@ import android.os.Parcel; public class ModelReturn implements Parcelable { public static final String SERIALIZED_NAME_RETURN = "return"; @SerializedName(SERIALIZED_NAME_RETURN) - private Integer _return = null; + private Integer _return; public ModelReturn() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java index 827e1cb62a9..5d9d74ccc9a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Name.java @@ -34,19 +34,19 @@ import android.os.Parcel; public class Name implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_SNAKE_CASE = "snake_case"; @SerializedName(SERIALIZED_NAME_SNAKE_CASE) - private Integer snakeCase = null; + private Integer snakeCase; public static final String SERIALIZED_NAME_PROPERTY = "property"; @SerializedName(SERIALIZED_NAME_PROPERTY) - private String property = null; + private String property; public static final String SERIALIZED_NAME_123NUMBER = "123Number"; @SerializedName(SERIALIZED_NAME_123NUMBER) - private Integer _123number = null; + private Integer _123number; public Name() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java index e5c563ba0bc..1b742431c14 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -34,7 +34,7 @@ import android.os.Parcel; public class NumberOnly implements Parcelable { public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; @SerializedName(SERIALIZED_NAME_JUST_NUMBER) - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java index 17a157d035c..4e91b0da18c 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Order.java @@ -34,19 +34,19 @@ import android.os.Parcel; public class Order implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_PET_ID = "petId"; @SerializedName(SERIALIZED_NAME_PET_ID) - private Long petId = null; + private Long petId; public static final String SERIALIZED_NAME_QUANTITY = "quantity"; @SerializedName(SERIALIZED_NAME_QUANTITY) - private Integer quantity = null; + private Integer quantity; public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; @SerializedName(SERIALIZED_NAME_SHIP_DATE) - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -99,7 +99,7 @@ public class Order implements Parcelable { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public static final String SERIALIZED_NAME_COMPLETE = "complete"; @SerializedName(SERIALIZED_NAME_COMPLETE) diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java index eca5cc50214..e553c5b9257 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -34,15 +34,15 @@ import android.os.Parcel; public class OuterComposite implements Parcelable { public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; @SerializedName(SERIALIZED_NAME_MY_NUMBER) - private BigDecimal myNumber = null; + private BigDecimal myNumber; public static final String SERIALIZED_NAME_MY_STRING = "my_string"; @SerializedName(SERIALIZED_NAME_MY_STRING) - private String myString = null; + private String myString; public static final String SERIALIZED_NAME_MY_BOOLEAN = "my_boolean"; @SerializedName(SERIALIZED_NAME_MY_BOOLEAN) - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java index e3b325b4bcc..e39a63d2148 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Pet.java @@ -37,7 +37,7 @@ import android.os.Parcel; public class Pet implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_CATEGORY = "category"; @SerializedName(SERIALIZED_NAME_CATEGORY) @@ -45,7 +45,7 @@ public class Pet implements Parcelable { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) @@ -106,7 +106,7 @@ public class Pet implements Parcelable { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public Pet() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 84284f74413..a1a439a05c4 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -33,11 +33,11 @@ import android.os.Parcel; public class ReadOnlyFirst implements Parcelable { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_BAZ = "baz"; @SerializedName(SERIALIZED_NAME_BAZ) - private String baz = null; + private String baz; public ReadOnlyFirst() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java index e04c5f7d15b..1f00271b295 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -33,7 +33,7 @@ import android.os.Parcel; public class SpecialModelName implements Parcelable { public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java index 83a028db28e..5999efd4696 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/Tag.java @@ -33,11 +33,11 @@ import android.os.Parcel; public class Tag implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Tag() { } diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java index bb4edb60e84..c8280caee9b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/org/openapitools/client/model/User.java @@ -33,35 +33,35 @@ import android.os.Parcel; public class User implements Parcelable { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_USERNAME = "username"; @SerializedName(SERIALIZED_NAME_USERNAME) - private String username = null; + private String username; public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; @SerializedName(SERIALIZED_NAME_FIRST_NAME) - private String firstName = null; + private String firstName; public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; @SerializedName(SERIALIZED_NAME_LAST_NAME) - private String lastName = null; + private String lastName; public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) - private String email = null; + private String email; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public static final String SERIALIZED_NAME_PHONE = "phone"; @SerializedName(SERIALIZED_NAME_PHONE) - private String phone = null; + private String phone; public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; @SerializedName(SERIALIZED_NAME_USER_STATUS) - private Integer userStatus = null; + private Integer userStatus; public User() { } diff --git a/samples/client/petstore/java/okhttp-gson/build.gradle b/samples/client/petstore/java/okhttp-gson/build.gradle index df65ade70d1..9d4f85b4459 100644 --- a/samples/client/petstore/java/okhttp-gson/build.gradle +++ b/samples/client/petstore/java/okhttp-gson/build.gradle @@ -99,6 +99,7 @@ dependencies { compile 'com.squareup.okhttp:logging-interceptor:2.7.5' compile 'com.google.code.gson:gson:2.8.1' compile 'io.gsonfire:gson-fire:1.8.0' + compile group: 'org.apache.oltu.oauth2', name: 'org.apache.oltu.oauth2.client', version: '1.0.1' compile 'org.threeten:threetenbp:1.3.5' testCompile 'junit:junit:4.12' } diff --git a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md index b550c716171..5ec1d20e445 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/okhttp-gson/docs/MapTest.md b/samples/client/petstore/java/okhttp-gson/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/MapTest.md +++ b/samples/client/petstore/java/okhttp-gson/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/okhttp-gson/docs/PetApi.md b/samples/client/petstore/java/okhttp-gson/docs/PetApi.md index 41c08ccf9e3..8d621d1682a 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/PetApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/okhttp-gson/docs/UserApi.md b/samples/client/petstore/java/okhttp-gson/docs/UserApi.md index 102d04ac2c4..b7b880585f7 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/UserApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/okhttp-gson/pom.xml b/samples/client/petstore/java/okhttp-gson/pom.xml index 6dccf4ac0e7..2b31061f301 100644 --- a/samples/client/petstore/java/okhttp-gson/pom.xml +++ b/samples/client/petstore/java/okhttp-gson/pom.xml @@ -212,6 +212,11 @@ io.gsonfire gson-fire ${gson-fire-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + 1.0.1 org.threeten diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java index 86ce63c9b93..f8ad6cf3902 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/ApiClient.java @@ -23,6 +23,9 @@ import org.threeten.bp.LocalDate; import org.threeten.bp.OffsetDateTime; import org.threeten.bp.format.DateTimeFormatter; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.common.message.types.GrantType; + import javax.net.ssl.*; import java.io.File; import java.io.IOException; @@ -49,6 +52,8 @@ import org.openapitools.client.auth.Authentication; import org.openapitools.client.auth.HttpBasicAuth; import org.openapitools.client.auth.ApiKeyAuth; import org.openapitools.client.auth.OAuth; +import org.openapitools.client.auth.RetryingOAuth; +import org.openapitools.client.auth.OAuthFlow; public class ApiClient { @@ -77,6 +82,39 @@ public class ApiClient { * Constructor for ApiClient */ public ApiClient() { + init(); + + // Setup authentications (key: authentication name, value: authentication). + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + authentications.put("http_basic_test", new HttpBasicAuth()); + authentications.put("petstore_auth", new OAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /* + * Constructor for ApiClient to support access token retry on 401/403 + */ + public ApiClient( + String clientId, + String clientSecret, + Map parameters + ) { + init(); + + RetryingOAuth retryingOAuth = new RetryingOAuth("", clientId, OAuthFlow.implicit, clientSecret, parameters); + authentications.put( + "petstore_auth", + retryingOAuth + ); + httpClient.interceptors().add(retryingOAuth); + + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + private void init() { httpClient = new OkHttpClient(); @@ -87,14 +125,7 @@ public class ApiClient { // Set default User-Agent. setUserAgent("OpenAPI-Generator/1.0.0/java"); - // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); - authentications.put("api_key", new ApiKeyAuth("header", "api_key")); - authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); - authentications.put("http_basic_test", new HttpBasicAuth()); - authentications.put("petstore_auth", new OAuth()); - // Prevent the authentications from being modified. - authentications = Collections.unmodifiableMap(authentications); } /** @@ -484,6 +515,20 @@ public class ApiClient { return this; } + /** + * Helper method to configure the token endpoint of the first oauth found in the apiAuthorizations (there should be only one) + * @return Token request builder + */ + public TokenRequestBuilder getTokenEndPoint() { + for (Authentication apiAuth : authentications.values()) { + if (apiAuth instanceof RetryingOAuth) { + RetryingOAuth retryingOAuth = (RetryingOAuth) apiAuth; + return retryingOAuth.getTokenRequestBuilder(); + } + } + return null; + } + /** * Format the given parameter object into string. * @@ -499,7 +544,7 @@ public class ApiClient { return jsonStr.substring(1, jsonStr.length() - 1); } else if (param instanceof Collection) { StringBuilder b = new StringBuilder(); - for (Object o : (Collection)param) { + for (Object o : (Collection) param) { if (b.length() > 0) { b.append(","); } @@ -524,7 +569,9 @@ public class ApiClient { List params = new ArrayList(); // preconditions - if (name == null || name.isEmpty() || value == null || value instanceof Collection) return params; + if (name == null || name.isEmpty() || value == null || value instanceof Collection) { + return params; + } params.add(new Pair(name, parameterToString(value))); return params; @@ -569,7 +616,7 @@ public class ApiClient { delimiter = escapeString("|"); } - StringBuilder sb = new StringBuilder() ; + StringBuilder sb = new StringBuilder(); for (Object item : value) { sb.append(delimiter); sb.append(escapeString(parameterToString(item))); @@ -639,7 +686,7 @@ public class ApiClient { */ public String selectHeaderContentType(String[] contentTypes) { if (contentTypes.length == 0 || contentTypes[0].equals("*/*")) { - return "application/json"; + return "application/json"; } for (String contentType : contentTypes) { if (isJsonMime(contentType)) { @@ -963,7 +1010,7 @@ public class ApiClient { * @param formParams The form parameters * @param authNames The authentications to apply * @param progressRequestListener Progress request listener - * @return The HTTP request + * @return The HTTP request * @throws ApiException If fail to serialize the request body object */ public Request buildRequest(String path, String method, List queryParams, List collectionQueryParams, Object body, Map headerParams, Map formParams, String[] authNames, ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { @@ -1080,13 +1127,15 @@ public class ApiClient { * Update query and header parameters based on authentication settings. * * @param authNames The authentications to apply - * @param queryParams List of query parameters - * @param headerParams Map of header parameters + * @param queryParams List of query parameters + * @param headerParams Map of header parameters */ public void updateParamsForAuth(String[] authNames, List queryParams, Map headerParams) { for (String authName : authNames) { Authentication auth = authentications.get(authName); - if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + if (auth == null) { + throw new RuntimeException("Authentication undefined: " + authName); + } auth.applyToParams(queryParams, headerParams); } } @@ -1098,7 +1147,7 @@ public class ApiClient { * @return RequestBody */ public RequestBody buildRequestBodyFormEncoding(Map formParams) { - FormEncodingBuilder formBuilder = new FormEncodingBuilder(); + FormEncodingBuilder formBuilder = new FormEncodingBuilder(); for (Entry param : formParams.entrySet()) { formBuilder.add(param.getKey(), parameterToString(param.getValue())); } @@ -1161,10 +1210,12 @@ public class ApiClient { public X509Certificate[] getAcceptedIssuers() { return null; } }; SSLContext sslContext = SSLContext.getInstance("TLS"); - trustManagers = new TrustManager[]{ trustAll }; + trustManagers = new TrustManager[] {trustAll}; hostnameVerifier = new HostnameVerifier() { @Override - public boolean verify(String hostname, SSLSession session) { return true; } + public boolean verify(String hostname, SSLSession session) { + return true; + } }; } else if (sslCaCert != null) { char[] password = null; // Any password will work. diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/GzipRequestInterceptor.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/GzipRequestInterceptor.java index 64d88915295..f7ecf09b39e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/GzipRequestInterceptor.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/GzipRequestInterceptor.java @@ -27,7 +27,8 @@ import java.io.IOException; * Taken from https://github.com/square/okhttp/issues/350 */ class GzipRequestInterceptor implements Interceptor { - @Override public Response intercept(Chain chain) throws IOException { + @Override + public Response intercept(Chain chain) throws IOException { Request originalRequest = chain.request(); if (originalRequest.body() == null || originalRequest.header("Content-Encoding") != null) { return chain.proceed(originalRequest); @@ -63,19 +64,22 @@ class GzipRequestInterceptor implements Interceptor { private RequestBody gzip(final RequestBody body) { return new RequestBody() { - @Override public MediaType contentType() { + @Override + public MediaType contentType() { return body.contentType(); } - @Override public long contentLength() { + @Override + public long contentLength() { return -1; // We don't know the compressed length in advance! } - @Override public void writeTo(BufferedSink sink) throws IOException { + @Override + public void writeTo(BufferedSink sink) throws IOException { BufferedSink gzipSink = Okio.buffer(new GzipSink(sink)); body.writeTo(gzipSink); gzipSink.close(); } }; } -} \ No newline at end of file +} diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java index 64ff528f11c..8f1c98264dc 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/JSON.java @@ -52,19 +52,17 @@ public class JSON { public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() - .registerTypeSelector(Animal.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap(); - classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class); - classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class); - classByDiscriminatorValue.put("Animal".toUpperCase(Locale.ROOT), Animal.class); - return getClassByDiscriminator( - classByDiscriminatorValue, - getDiscriminatorValue(readElement, "className")); - } + .registerTypeSelector(Animal.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class); + classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class); + classByDiscriminatorValue.put("Animal".toUpperCase(Locale.ROOT), Animal.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } }) - ; GsonBuilder builder = fireBuilder.createGsonBuilder(); return builder; @@ -72,7 +70,7 @@ public class JSON { private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { JsonElement element = readElement.getAsJsonObject().get(discriminatorField); - if(null == element) { + if (null == element) { throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); } return element.getAsString(); @@ -80,7 +78,7 @@ public class JSON { private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase(Locale.ROOT)); - if(null == clazz) { + if (null == clazz) { throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); } return clazz; @@ -153,9 +151,11 @@ public class JSON { } catch (JsonParseException e) { // Fallback processing when failed to parse JSON form response body: // return the response body string directly for the String return type; - if (returnType.equals(String.class)) + if (returnType.equals(String.class)) { return (T) body; - else throw (e); + } else { + throw (e); + } } } @@ -291,8 +291,7 @@ public class JSON { private DateFormat dateFormat; - public SqlDateTypeAdapter() { - } + public SqlDateTypeAdapter() {} public SqlDateTypeAdapter(DateFormat dateFormat) { this.dateFormat = dateFormat; @@ -345,8 +344,7 @@ public class JSON { private DateFormat dateFormat; - public DateTypeAdapter() { - } + public DateTypeAdapter() {} public DateTypeAdapter(DateFormat dateFormat) { this.dateFormat = dateFormat; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/Pair.java index 18a0e96bfc7..0619e8c408b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/Pair.java @@ -24,13 +24,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -44,8 +48,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java index cb429b37da6..ef2a1c94f92 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -70,16 +70,15 @@ public class AnotherFakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json" @@ -87,7 +86,7 @@ public class AnotherFakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java index 9179f116ec3..6db391fbe62 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeApi.java @@ -77,16 +77,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -94,7 +93,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -194,16 +193,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -211,7 +209,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -311,16 +309,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -328,7 +325,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -428,16 +425,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "*/*" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -445,7 +441,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -545,16 +541,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json" @@ -562,7 +557,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -664,18 +659,19 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - if (query != null) - localVarQueryParams.addAll(apiClient.parameterToPair("query", query)); + if (query != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("query", query)); + } Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json" @@ -683,7 +679,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -792,16 +788,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json" @@ -809,7 +804,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -904,16 +899,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute @@ -927,44 +922,71 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (integer != null) - localVarFormParams.put("integer", integer); - if (int32 != null) - localVarFormParams.put("int32", int32); - if (int64 != null) - localVarFormParams.put("int64", int64); - if (number != null) - localVarFormParams.put("number", number); - if (_float != null) - localVarFormParams.put("float", _float); - if (_double != null) - localVarFormParams.put("double", _double); - if (string != null) - localVarFormParams.put("string", string); - if (patternWithoutDelimiter != null) - localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); - if (_byte != null) - localVarFormParams.put("byte", _byte); - if (binary != null) - localVarFormParams.put("binary", binary); - if (date != null) - localVarFormParams.put("date", date); - if (dateTime != null) - localVarFormParams.put("dateTime", dateTime); - if (password != null) - localVarFormParams.put("password", password); - if (paramCallback != null) - localVarFormParams.put("callback", paramCallback); + if (integer != null) { + localVarFormParams.put("integer", integer); + } + + if (int32 != null) { + localVarFormParams.put("int32", int32); + } + + if (int64 != null) { + localVarFormParams.put("int64", int64); + } + + if (number != null) { + localVarFormParams.put("number", number); + } + + if (_float != null) { + localVarFormParams.put("float", _float); + } + + if (_double != null) { + localVarFormParams.put("double", _double); + } + + if (string != null) { + localVarFormParams.put("string", string); + } + + if (patternWithoutDelimiter != null) { + localVarFormParams.put("pattern_without_delimiter", patternWithoutDelimiter); + } + + if (_byte != null) { + localVarFormParams.put("byte", _byte); + } + + if (binary != null) { + localVarFormParams.put("binary", binary); + } + + if (date != null) { + localVarFormParams.put("date", date); + } + + if (dateTime != null) { + localVarFormParams.put("dateTime", dateTime); + } + + if (password != null) { + localVarFormParams.put("password", password); + } + + if (paramCallback != null) { + localVarFormParams.put("callback", paramCallback); + } final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/x-www-form-urlencoded" @@ -972,7 +994,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -1024,16 +1046,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -1047,16 +1069,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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 ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1072,16 +1094,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -1119,7 +1141,7 @@ public class FakeApi { * @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 enumFormStringArray Form parameter enum test (string array) (optional) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @param progressListener Progress listener * @param progressRequestListener Progress request listener @@ -1134,32 +1156,47 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - if (enumQueryStringArray != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray)); - if (enumQueryString != null) - localVarQueryParams.addAll(apiClient.parameterToPair("enum_query_string", enumQueryString)); - if (enumQueryInteger != null) - localVarQueryParams.addAll(apiClient.parameterToPair("enum_query_integer", enumQueryInteger)); - if (enumQueryDouble != null) - localVarQueryParams.addAll(apiClient.parameterToPair("enum_query_double", enumQueryDouble)); + if (enumQueryStringArray != null) { + localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "enum_query_string_array", enumQueryStringArray)); + } + + if (enumQueryString != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("enum_query_string", enumQueryString)); + } + + if (enumQueryInteger != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("enum_query_integer", enumQueryInteger)); + } + + if (enumQueryDouble != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("enum_query_double", enumQueryDouble)); + } Map localVarHeaderParams = new HashMap(); - if (enumHeaderStringArray != null) - localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); - if (enumHeaderString != null) - localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString)); + if (enumHeaderStringArray != null) { + localVarHeaderParams.put("enum_header_string_array", apiClient.parameterToString(enumHeaderStringArray)); + } + + if (enumHeaderString != null) { + localVarHeaderParams.put("enum_header_string", apiClient.parameterToString(enumHeaderString)); + } Map localVarFormParams = new HashMap(); - if (enumFormStringArray != null) - localVarFormParams.put("enum_form_string_array", enumFormStringArray); - if (enumFormString != null) - localVarFormParams.put("enum_form_string", enumFormString); + if (enumFormStringArray != null) { + localVarFormParams.put("enum_form_string_array", enumFormStringArray); + } + + if (enumFormString != null) { + localVarFormParams.put("enum_form_string", enumFormString); + } final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/x-www-form-urlencoded" @@ -1167,7 +1204,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -1201,7 +1238,7 @@ public class FakeApi { * @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 enumFormStringArray Form parameter enum test (string array) (optional) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1218,7 +1255,7 @@ public class FakeApi { * @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 enumFormStringArray Form parameter enum test (string array) (optional) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body @@ -1237,7 +1274,7 @@ public class FakeApi { * @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 enumFormStringArray Form parameter enum test (string array) (optional) * @param enumFormString Form parameter enum test (string) (optional, default to -efg) * @param callback The callback to be executed when the API call finishes * @return The request call @@ -1284,16 +1321,15 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json" @@ -1301,7 +1337,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -1403,20 +1439,23 @@ public class FakeApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (param != null) - localVarFormParams.put("param", param); - if (param2 != null) - localVarFormParams.put("param2", param2); + if (param != null) { + localVarFormParams.put("param", param); + } + + if (param2 != null) { + localVarFormParams.put("param2", param2); + } final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/x-www-form-urlencoded" @@ -1424,7 +1463,7 @@ public class FakeApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java index 749598b3099..fee24a345ed 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -70,16 +70,15 @@ public class FakeClassnameTags123Api { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json" @@ -87,7 +86,7 @@ public class FakeClassnameTags123Api { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java index d1b477e0d44..7f5e5a3b4d2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/PetApi.java @@ -72,16 +72,15 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json", "application/xml" @@ -89,7 +88,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -192,18 +191,19 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - if (apiKey != null) - localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + if (apiKey != null) { + localVarHeaderParams.put("api_key", apiClient.parameterToString(apiKey)); + } Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -211,7 +211,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -315,18 +315,19 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - if (status != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); + if (status != null) { + localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "status", status)); + } Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -334,7 +335,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -441,18 +442,19 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - if (tags != null) - localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); + if (tags != null) { + localVarCollectionQueryParams.addAll(apiClient.parameterToPairs("csv", "tags", tags)); + } Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -460,7 +462,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -573,16 +575,15 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -590,7 +591,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -695,16 +696,15 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/json", "application/xml" @@ -712,7 +712,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -800,8 +800,8 @@ public class PetApi { /** * Build call for updatePetWithForm * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute @@ -816,20 +816,23 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (name != null) - localVarFormParams.put("name", name); - if (status != null) - localVarFormParams.put("status", status); + if (name != null) { + localVarFormParams.put("name", name); + } + + if (status != null) { + localVarFormParams.put("status", status); + } final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "application/x-www-form-urlencoded" @@ -837,7 +840,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -871,8 +874,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { @@ -883,8 +886,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @return ApiResponse<Void> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -897,8 +900,8 @@ public class PetApi { * Updates a pet in the store with form data (asynchronously) * * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -931,8 +934,8 @@ public class PetApi { /** * Build call for uploadFile * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute @@ -947,20 +950,23 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (additionalMetadata != null) - localVarFormParams.put("additionalMetadata", additionalMetadata); - if (file != null) - localVarFormParams.put("file", file); + if (additionalMetadata != null) { + localVarFormParams.put("additionalMetadata", additionalMetadata); + } + + if (file != null) { + localVarFormParams.put("file", file); + } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "multipart/form-data" @@ -968,7 +974,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -1002,8 +1008,8 @@ public class PetApi { * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ModelApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1016,8 +1022,8 @@ public class PetApi { * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1031,8 +1037,8 @@ public class PetApi { * uploads an image (asynchronously) * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object @@ -1067,7 +1073,7 @@ public class PetApi { * Build call for uploadFileWithRequiredFile * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @param progressListener Progress listener * @param progressRequestListener Progress request listener * @return Call to execute @@ -1082,20 +1088,23 @@ public class PetApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - if (additionalMetadata != null) - localVarFormParams.put("additionalMetadata", additionalMetadata); - if (requiredFile != null) - localVarFormParams.put("requiredFile", requiredFile); + if (additionalMetadata != null) { + localVarFormParams.put("additionalMetadata", additionalMetadata); + } + + if (requiredFile != null) { + localVarFormParams.put("requiredFile", requiredFile); + } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { "multipart/form-data" @@ -1103,7 +1112,7 @@ public class PetApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -1143,7 +1152,7 @@ public class PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1157,7 +1166,7 @@ public class PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return ApiResponse<ModelApiResponse> * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body */ @@ -1172,7 +1181,7 @@ public class PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @param callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/StoreApi.java index c4669755c16..c9924191862 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/StoreApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/StoreApi.java @@ -71,16 +71,15 @@ public class StoreApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -88,7 +87,7 @@ public class StoreApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -188,16 +187,15 @@ public class StoreApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -205,7 +203,7 @@ public class StoreApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -303,16 +301,15 @@ public class StoreApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -320,7 +317,7 @@ public class StoreApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -425,16 +422,15 @@ public class StoreApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -442,7 +438,7 @@ public class StoreApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java index bf4c1fb77aa..ffb2e6bd52c 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/api/UserApi.java @@ -70,16 +70,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -87,7 +86,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -188,16 +187,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -205,7 +203,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -306,16 +304,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -323,7 +320,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -425,16 +422,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -442,7 +438,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -544,16 +540,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -561,7 +556,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -667,20 +662,23 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - if (username != null) - localVarQueryParams.addAll(apiClient.parameterToPair("username", username)); - if (password != null) - localVarQueryParams.addAll(apiClient.parameterToPair("password", password)); + if (username != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("username", username)); + } + + if (password != null) { + localVarQueryParams.addAll(apiClient.parameterToPair("password", password)); + } Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { "application/xml", "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -688,7 +686,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -800,16 +798,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -817,7 +814,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { @@ -912,16 +909,15 @@ public class UserApi { List localVarQueryParams = new ArrayList(); List localVarCollectionQueryParams = new ArrayList(); - Map localVarHeaderParams = new HashMap(); - Map localVarFormParams = new HashMap(); - final String[] localVarAccepts = { }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); - if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + if (localVarAccept != null) { + localVarHeaderParams.put("Accept", localVarAccept); + } final String[] localVarContentTypes = { @@ -929,7 +925,7 @@ public class UserApi { final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); - if(progressListener != null) { + if (progressListener != null) { apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { @Override public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java new file mode 100644 index 00000000000..76b4f76af76 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/OAuthOkHttpClient.java @@ -0,0 +1,68 @@ +package org.openapitools.client.auth; + +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.MediaType; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.RequestBody; +import com.squareup.okhttp.Response; + +import org.apache.oltu.oauth2.client.HttpClient; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.response.OAuthClientResponse; +import org.apache.oltu.oauth2.client.response.OAuthClientResponseFactory; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; + +import java.io.IOException; +import java.util.Map; +import java.util.Map.Entry; + +public class OAuthOkHttpClient implements HttpClient { + private OkHttpClient client; + + public OAuthOkHttpClient() { + this.client = new OkHttpClient(); + } + + public OAuthOkHttpClient(OkHttpClient client) { + this.client = client; + } + + @Override + public T execute(OAuthClientRequest request, Map headers, + String requestMethod, Class responseClass) + throws OAuthSystemException, OAuthProblemException { + + MediaType mediaType = MediaType.parse("application/json"); + Request.Builder requestBuilder = new Request.Builder().url(request.getLocationUri()); + + if(headers != null) { + for (Entry entry : headers.entrySet()) { + if (entry.getKey().equalsIgnoreCase("Content-Type")) { + mediaType = MediaType.parse(entry.getValue()); + } else { + requestBuilder.addHeader(entry.getKey(), entry.getValue()); + } + } + } + + RequestBody body = request.getBody() != null ? RequestBody.create(mediaType, request.getBody()) : null; + requestBuilder.method(requestMethod, body); + + try { + Response response = client.newCall(requestBuilder.build()).execute(); + return OAuthClientResponseFactory.createCustomResponse( + response.body().string(), + response.body().contentType().toString(), + response.code(), + responseClass); + } catch (IOException e) { + throw new OAuthSystemException(e); + } + } + + @Override + public void shutdown() { + // Nothing to do here + } +} diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java new file mode 100644 index 00000000000..78fcb52d5a3 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/auth/RetryingOAuth.java @@ -0,0 +1,165 @@ +package org.openapitools.client.auth; + +import com.squareup.okhttp.Interceptor; +import com.squareup.okhttp.OkHttpClient; +import com.squareup.okhttp.Request; +import com.squareup.okhttp.Response; + +import org.apache.oltu.oauth2.client.OAuthClient; +import org.apache.oltu.oauth2.client.request.OAuthBearerClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest; +import org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder; +import org.apache.oltu.oauth2.client.response.OAuthJSONAccessTokenResponse; +import org.apache.oltu.oauth2.common.exception.OAuthProblemException; +import org.apache.oltu.oauth2.common.exception.OAuthSystemException; +import org.apache.oltu.oauth2.common.message.types.GrantType; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.Map; + +public class RetryingOAuth extends OAuth implements Interceptor { + private OAuthClient oAuthClient; + + private TokenRequestBuilder tokenRequestBuilder; + + public RetryingOAuth(OkHttpClient client, TokenRequestBuilder tokenRequestBuilder) { + this.oAuthClient = new OAuthClient(new OAuthOkHttpClient(client)); + this.tokenRequestBuilder = tokenRequestBuilder; + } + + public RetryingOAuth(TokenRequestBuilder tokenRequestBuilder) { + this(new OkHttpClient(), tokenRequestBuilder); + } + + public RetryingOAuth( + String tokenUrl, + String clientId, + OAuthFlow flow, + String clientSecret, + Map parameters + ) { + this(OAuthClientRequest.tokenLocation(tokenUrl) + .setClientId(clientId) + .setClientSecret(clientSecret)); + setFlow(flow); + if (parameters != null) { + for (String paramName : parameters.keySet()) { + tokenRequestBuilder.setParameter(paramName, parameters.get(paramName)); + } + } + } + + public void setFlow(OAuthFlow flow) { + switch(flow) { + case accessCode: + tokenRequestBuilder.setGrantType(GrantType.AUTHORIZATION_CODE); + break; + case implicit: + tokenRequestBuilder.setGrantType(GrantType.IMPLICIT); + break; + case password: + tokenRequestBuilder.setGrantType(GrantType.PASSWORD); + break; + case application: + tokenRequestBuilder.setGrantType(GrantType.CLIENT_CREDENTIALS); + break; + default: + break; + } + } + + @Override + public Response intercept(Chain chain) throws IOException { + return retryingIntercept(chain, true); + } + + private Response retryingIntercept(Chain chain, boolean updateTokenAndRetryOnAuthorizationFailure) throws IOException { + Request request = chain.request(); + + // If the request already has an authorization (e.g. Basic auth), proceed with the request as is + if (request.header("Authorization") != null) { + return chain.proceed(request); + } + + // Get the token if it has not yet been acquired + if (getAccessToken() == null) { + updateAccessToken(null); + } + + OAuthClientRequest oAuthRequest; + if (getAccessToken() != null) { + // Build the request + Request.Builder requestBuilder = request.newBuilder(); + + String requestAccessToken = getAccessToken(); + try { + oAuthRequest = + new OAuthBearerClientRequest(request.urlString()). + setAccessToken(requestAccessToken). + buildHeaderMessage(); + } catch (OAuthSystemException e) { + throw new IOException(e); + } + + Map headers = oAuthRequest.getHeaders(); + for (String headerName : headers.keySet()) { + requestBuilder.addHeader(headerName, headers.get(headerName)); + } + requestBuilder.url(oAuthRequest.getLocationUri()); + + // Execute the request + Response response = chain.proceed(requestBuilder.build()); + + // 401/403 response codes most likely indicate an expired access token, unless it happens two times in a row + if ( + response != null && + ( response.code() == HttpURLConnection.HTTP_UNAUTHORIZED || + response.code() == HttpURLConnection.HTTP_FORBIDDEN ) && + updateTokenAndRetryOnAuthorizationFailure + ) { + try { + if (updateAccessToken(requestAccessToken)) { + response.body().close(); + return retryingIntercept(chain, false); + } + } catch (Exception e) { + response.body().close(); + throw e; + } + } + return response; + } + else { + return chain.proceed(chain.request()); + } + } + + /* + * Returns true if the access token has been updated + */ + public synchronized boolean updateAccessToken(String requestAccessToken) throws IOException { + if (getAccessToken() == null || getAccessToken().equals(requestAccessToken)) { + try { + OAuthJSONAccessTokenResponse accessTokenResponse = + oAuthClient.accessToken(tokenRequestBuilder.buildBodyMessage()); + if (accessTokenResponse != null && accessTokenResponse.getAccessToken() != null) { + setAccessToken(accessTokenResponse.getAccessToken()); + return !getAccessToken().equals(requestAccessToken); + } + } catch (OAuthSystemException | OAuthProblemException e) { + throw new IOException(e); + } + } + + return false; + } + + public TokenRequestBuilder getTokenRequestBuilder() { + return tokenRequestBuilder; + } + + public void setTokenRequestBuilder(TokenRequestBuilder tokenRequestBuilder) { + this.tokenRequestBuilder = tokenRequestBuilder; + } +} diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Animal.java index 02469e22e51..4cc9f9fc81b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Animal.java @@ -32,7 +32,7 @@ import java.io.IOException; public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className = null; + private String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java index bd3be0876f6..364dc3f2e4b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Capitalization.java @@ -31,27 +31,27 @@ import java.io.IOException; public class Capitalization { public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) - private String smallCamel = null; + private String smallCamel; public static final String SERIALIZED_NAME_CAPITAL_CAMEL = "CapitalCamel"; @SerializedName(SERIALIZED_NAME_CAPITAL_CAMEL) - private String capitalCamel = null; + private String capitalCamel; public static final String SERIALIZED_NAME_SMALL_SNAKE = "small_Snake"; @SerializedName(SERIALIZED_NAME_SMALL_SNAKE) - private String smallSnake = null; + private String smallSnake; public static final String SERIALIZED_NAME_CAPITAL_SNAKE = "Capital_Snake"; @SerializedName(SERIALIZED_NAME_CAPITAL_SNAKE) - private String capitalSnake = null; + private String capitalSnake; public static final String SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; @SerializedName(SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS) - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; public static final String SERIALIZED_NAME_A_T_T_N_A_M_E = "ATT_NAME"; @SerializedName(SERIALIZED_NAME_A_T_T_N_A_M_E) - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Cat.java index cede1ca4c75..67827ff3973 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Cat.java @@ -32,7 +32,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java index 7223fd28279..68177b01908 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Category.java @@ -31,11 +31,11 @@ import java.io.IOException; public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java index 3150b5919b0..225a08b9344 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ClassModel.java @@ -32,7 +32,7 @@ import java.io.IOException; public class ClassModel { public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java index 219520a7ab1..a724368de1b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Client.java @@ -31,7 +31,7 @@ import java.io.IOException; public class Client { public static final String SERIALIZED_NAME_CLIENT = "client"; @SerializedName(SERIALIZED_NAME_CLIENT) - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Dog.java index 3c86defe3c8..929dae95e51 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Dog.java @@ -32,7 +32,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java index c2f60d79983..4db242f3a11 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -80,7 +80,7 @@ public class EnumArrays { public static final String SERIALIZED_NAME_JUST_SYMBOL = "just_symbol"; @SerializedName(SERIALIZED_NAME_JUST_SYMBOL) - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java index a2319a67a7d..1dc613b8501 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/EnumTest.java @@ -81,7 +81,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_STRING = "enum_string"; @SerializedName(SERIALIZED_NAME_ENUM_STRING) - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -134,7 +134,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required"; @SerializedName(SERIALIZED_NAME_ENUM_STRING_REQUIRED) - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -185,7 +185,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_INTEGER = "enum_integer"; @SerializedName(SERIALIZED_NAME_ENUM_INTEGER) - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -236,7 +236,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_NUMBER = "enum_number"; @SerializedName(SERIALIZED_NAME_ENUM_NUMBER) - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; public static final String SERIALIZED_NAME_OUTER_ENUM = "outerEnum"; @SerializedName(SERIALIZED_NAME_OUTER_ENUM) diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java index 528a49bac3f..e2cc8f57fab 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/FormatTest.java @@ -36,55 +36,55 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { public static final String SERIALIZED_NAME_INTEGER = "integer"; @SerializedName(SERIALIZED_NAME_INTEGER) - private Integer integer = null; + private Integer integer; public static final String SERIALIZED_NAME_INT32 = "int32"; @SerializedName(SERIALIZED_NAME_INT32) - private Integer int32 = null; + private Integer int32; public static final String SERIALIZED_NAME_INT64 = "int64"; @SerializedName(SERIALIZED_NAME_INT64) - private Long int64 = null; + private Long int64; public static final String SERIALIZED_NAME_NUMBER = "number"; @SerializedName(SERIALIZED_NAME_NUMBER) - private BigDecimal number = null; + private BigDecimal number; public static final String SERIALIZED_NAME_FLOAT = "float"; @SerializedName(SERIALIZED_NAME_FLOAT) - private Float _float = null; + private Float _float; public static final String SERIALIZED_NAME_DOUBLE = "double"; @SerializedName(SERIALIZED_NAME_DOUBLE) - private Double _double = null; + private Double _double; public static final String SERIALIZED_NAME_STRING = "string"; @SerializedName(SERIALIZED_NAME_STRING) - private String string = null; + private String string; public static final String SERIALIZED_NAME_BYTE = "byte"; @SerializedName(SERIALIZED_NAME_BYTE) - private byte[] _byte = null; + private byte[] _byte; public static final String SERIALIZED_NAME_BINARY = "binary"; @SerializedName(SERIALIZED_NAME_BINARY) - private File binary = null; + private File binary; public static final String SERIALIZED_NAME_DATE = "date"; @SerializedName(SERIALIZED_NAME_DATE) - private LocalDate date = null; + private LocalDate date; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 602ff3afb43..597dcffd820 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -31,11 +31,11 @@ import java.io.IOException; public class HasOnlyReadOnly { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_FOO = "foo"; @SerializedName(SERIALIZED_NAME_FOO) - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java index 8f4186f986d..bf598190bd1 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MapTest.java @@ -26,7 +26,6 @@ import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -94,7 +93,7 @@ public class MapTest { public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map"; @SerializedName(SERIALIZED_NAME_INDIRECT_MAP) - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -174,21 +173,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 96a6bc24503..6e69e3fe8be 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -37,11 +37,11 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; public static final String SERIALIZED_NAME_MAP = "map"; @SerializedName(SERIALIZED_NAME_MAP) diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java index fdc7ed42acb..2251a56b578 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Model200Response.java @@ -32,11 +32,11 @@ import java.io.IOException; public class Model200Response { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_PROPERTY_CLASS = "class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 1a871eeb59f..f5d77a2901b 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -31,15 +31,15 @@ import java.io.IOException; public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) - private Integer code = null; + private Integer code; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) - private String type = null; + private String type; public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java index 83e7b1c601b..91bdd8d4b93 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -32,7 +32,7 @@ import java.io.IOException; public class ModelReturn { public static final String SERIALIZED_NAME_RETURN = "return"; @SerializedName(SERIALIZED_NAME_RETURN) - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java index e88b3009cd6..e59fad09270 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Name.java @@ -32,19 +32,19 @@ import java.io.IOException; public class Name { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_SNAKE_CASE = "snake_case"; @SerializedName(SERIALIZED_NAME_SNAKE_CASE) - private Integer snakeCase = null; + private Integer snakeCase; public static final String SERIALIZED_NAME_PROPERTY = "property"; @SerializedName(SERIALIZED_NAME_PROPERTY) - private String property = null; + private String property; public static final String SERIALIZED_NAME_123NUMBER = "123Number"; @SerializedName(SERIALIZED_NAME_123NUMBER) - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberOnly.java index 81cb0ece54d..0c0620ae66d 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -32,7 +32,7 @@ import java.math.BigDecimal; public class NumberOnly { public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; @SerializedName(SERIALIZED_NAME_JUST_NUMBER) - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java index 3a679d5d79e..107a0c7bacc 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Order.java @@ -32,19 +32,19 @@ import org.threeten.bp.OffsetDateTime; public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_PET_ID = "petId"; @SerializedName(SERIALIZED_NAME_PET_ID) - private Long petId = null; + private Long petId; public static final String SERIALIZED_NAME_QUANTITY = "quantity"; @SerializedName(SERIALIZED_NAME_QUANTITY) - private Integer quantity = null; + private Integer quantity; public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; @SerializedName(SERIALIZED_NAME_SHIP_DATE) - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -97,7 +97,7 @@ public class Order { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public static final String SERIALIZED_NAME_COMPLETE = "complete"; @SerializedName(SERIALIZED_NAME_COMPLETE) diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java index 63b15607287..05fa264021e 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -32,15 +32,15 @@ import java.math.BigDecimal; public class OuterComposite { public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; @SerializedName(SERIALIZED_NAME_MY_NUMBER) - private BigDecimal myNumber = null; + private BigDecimal myNumber; public static final String SERIALIZED_NAME_MY_STRING = "my_string"; @SerializedName(SERIALIZED_NAME_MY_STRING) - private String myString = null; + private String myString; public static final String SERIALIZED_NAME_MY_BOOLEAN = "my_boolean"; @SerializedName(SERIALIZED_NAME_MY_BOOLEAN) - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java index 82dd8b088a6..f191512b221 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Pet.java @@ -35,7 +35,7 @@ import org.openapitools.client.model.Tag; public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_CATEGORY = "category"; @SerializedName(SERIALIZED_NAME_CATEGORY) @@ -43,7 +43,7 @@ public class Pet { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) @@ -104,7 +104,7 @@ public class Pet { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index c25d42c2724..e1496b4bc9a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -31,11 +31,11 @@ import java.io.IOException; public class ReadOnlyFirst { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_BAZ = "baz"; @SerializedName(SERIALIZED_NAME_BAZ) - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java index db6241ec143..510b8a00318 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -31,7 +31,7 @@ import java.io.IOException; public class SpecialModelName { public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java index c80a102aef4..f889117e7f0 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/Tag.java @@ -31,11 +31,11 @@ import java.io.IOException; public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java index bcc3e9164db..b551c8d25d2 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/org/openapitools/client/model/User.java @@ -31,35 +31,35 @@ import java.io.IOException; public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_USERNAME = "username"; @SerializedName(SERIALIZED_NAME_USERNAME) - private String username = null; + private String username; public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; @SerializedName(SERIALIZED_NAME_FIRST_NAME) - private String firstName = null; + private String firstName; public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; @SerializedName(SERIALIZED_NAME_LAST_NAME) - private String lastName = null; + private String lastName; public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) - private String email = null; + private String email; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public static final String SERIALIZED_NAME_PHONE = "phone"; @SerializedName(SERIALIZED_NAME_PHONE) - private String phone = null; + private String phone; public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; @SerializedName(SERIALIZED_NAME_USER_STATUS) - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/rest-assured/build.gradle b/samples/client/petstore/java/rest-assured/build.gradle index 8afb2af1889..b9eb1e177e8 100644 --- a/samples/client/petstore/java/rest-assured/build.gradle +++ b/samples/client/petstore/java/rest-assured/build.gradle @@ -94,7 +94,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.15" + swagger_annotations_version = "1.5.21" rest_assured_version = "3.1.0" junit_version = "4.12" gson_version = "2.6.1" diff --git a/samples/client/petstore/java/rest-assured/build.sbt b/samples/client/petstore/java/rest-assured/build.sbt index a57bc62b677..eb61e74a894 100644 --- a/samples/client/petstore/java/rest-assured/build.sbt +++ b/samples/client/petstore/java/rest-assured/build.sbt @@ -9,7 +9,7 @@ lazy val root = (project in file(".")). publishArtifact in (Compile, packageDoc) := false, resolvers += Resolver.mavenLocal, libraryDependencies ++= Seq( - "io.swagger" % "swagger-annotations" % "1.5.15", + "io.swagger" % "swagger-annotations" % "1.5.21", "io.rest-assured" % "scala-support" % "3.1.0", "com.google.code.gson" % "gson" % "2.6.1", "io.gsonfire" % "gson-fire" % "1.8.2" % "compile", diff --git a/samples/client/petstore/java/rest-assured/docs/FakeApi.md b/samples/client/petstore/java/rest-assured/docs/FakeApi.md index add42dae256..884e7580651 100644 --- a/samples/client/petstore/java/rest-assured/docs/FakeApi.md +++ b/samples/client/petstore/java/rest-assured/docs/FakeApi.md @@ -337,20 +337,20 @@ api.testEndpointParameters() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -391,9 +391,9 @@ api.testEnumParameters().execute(r -> r.prettyPeek()); Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] + **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [default to new ArrayList<String>()] [enum: >, $] **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] - **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] + **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [default to new ArrayList<String>()] [enum: >, $] **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] @@ -479,8 +479,8 @@ api.testJsonFormData() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/rest-assured/docs/MapTest.md b/samples/client/petstore/java/rest-assured/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/rest-assured/docs/MapTest.md +++ b/samples/client/petstore/java/rest-assured/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/rest-assured/docs/PetApi.md b/samples/client/petstore/java/rest-assured/docs/PetApi.md index 46c4d12008b..66e26eceb35 100644 --- a/samples/client/petstore/java/rest-assured/docs/PetApi.md +++ b/samples/client/petstore/java/rest-assured/docs/PetApi.md @@ -123,7 +123,7 @@ api.findPetsByStatus() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] + **status** | [**List<String>**](String.md)| Status values that need to be considered for filter | [default to new ArrayList<String>()] [enum: available, pending, sold] ### Return type @@ -165,7 +165,7 @@ api.findPetsByTags() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**List<String>**](String.md)| Tags to filter by | + **tags** | [**List<String>**](String.md)| Tags to filter by | [default to new ArrayList<String>()] ### Return type @@ -288,8 +288,8 @@ api.updatePetWithForm() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -330,8 +330,8 @@ api.uploadFile() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -373,8 +373,8 @@ api.uploadFileWithRequiredFile() Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/rest-assured/pom.xml b/samples/client/petstore/java/rest-assured/pom.xml index 4ed742e4659..ed7f35ac028 100644 --- a/samples/client/petstore/java/rest-assured/pom.xml +++ b/samples/client/petstore/java/rest-assured/pom.xml @@ -113,8 +113,7 @@ - - src/main/java + src/main/java @@ -126,8 +125,7 @@ - - src/test/java + src/test/java @@ -199,7 +197,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} io.rest-assured @@ -236,7 +234,7 @@ UTF-8 - 1.5.15 + 1.5.21 3.1.0 2.6.1 1.8.2 diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/JSON.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/JSON.java index 64ff528f11c..8f1c98264dc 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/JSON.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/JSON.java @@ -52,19 +52,17 @@ public class JSON { public static GsonBuilder createGson() { GsonFireBuilder fireBuilder = new GsonFireBuilder() - .registerTypeSelector(Animal.class, new TypeSelector() { - @Override - public Class getClassForElement(JsonElement readElement) { - Map classByDiscriminatorValue = new HashMap(); - classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class); - classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class); - classByDiscriminatorValue.put("Animal".toUpperCase(Locale.ROOT), Animal.class); - return getClassByDiscriminator( - classByDiscriminatorValue, - getDiscriminatorValue(readElement, "className")); - } + .registerTypeSelector(Animal.class, new TypeSelector() { + @Override + public Class getClassForElement(JsonElement readElement) { + Map classByDiscriminatorValue = new HashMap(); + classByDiscriminatorValue.put("Dog".toUpperCase(Locale.ROOT), Dog.class); + classByDiscriminatorValue.put("Cat".toUpperCase(Locale.ROOT), Cat.class); + classByDiscriminatorValue.put("Animal".toUpperCase(Locale.ROOT), Animal.class); + return getClassByDiscriminator(classByDiscriminatorValue, + getDiscriminatorValue(readElement, "className")); + } }) - ; GsonBuilder builder = fireBuilder.createGsonBuilder(); return builder; @@ -72,7 +70,7 @@ public class JSON { private static String getDiscriminatorValue(JsonElement readElement, String discriminatorField) { JsonElement element = readElement.getAsJsonObject().get(discriminatorField); - if(null == element) { + if (null == element) { throw new IllegalArgumentException("missing discriminator field: <" + discriminatorField + ">"); } return element.getAsString(); @@ -80,7 +78,7 @@ public class JSON { private static Class getClassByDiscriminator(Map classByDiscriminatorValue, String discriminatorValue) { Class clazz = (Class) classByDiscriminatorValue.get(discriminatorValue.toUpperCase(Locale.ROOT)); - if(null == clazz) { + if (null == clazz) { throw new IllegalArgumentException("cannot determine model class of name: <" + discriminatorValue + ">"); } return clazz; @@ -153,9 +151,11 @@ public class JSON { } catch (JsonParseException e) { // Fallback processing when failed to parse JSON form response body: // return the response body string directly for the String return type; - if (returnType.equals(String.class)) + if (returnType.equals(String.class)) { return (T) body; - else throw (e); + } else { + throw (e); + } } } @@ -291,8 +291,7 @@ public class JSON { private DateFormat dateFormat; - public SqlDateTypeAdapter() { - } + public SqlDateTypeAdapter() {} public SqlDateTypeAdapter(DateFormat dateFormat) { this.dateFormat = dateFormat; @@ -345,8 +344,7 @@ public class JSON { private DateFormat dateFormat; - public DateTypeAdapter() { - } + public DateTypeAdapter() {} public DateTypeAdapter(DateFormat dateFormat) { this.dateFormat = dateFormat; 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 250ef18113a..832cdba0da6 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 @@ -674,16 +674,16 @@ public class FakeApi { * @see #_doubleForm None (required) * @see #patternWithoutDelimiterForm None (required) * @see #_byteForm None (required) - * @see #integerForm None (optional, default to null) - * @see #int32Form None (optional, default to null) - * @see #int64Form None (optional, default to null) - * @see #_floatForm None (optional, default to null) - * @see #stringForm None (optional, default to null) - * @see #binaryMultiPart None (optional, default to null) - * @see #dateForm None (optional, default to null) - * @see #dateTimeForm None (optional, default to null) - * @see #passwordForm None (optional, default to null) - * @see #paramCallbackForm None (optional, default to null) + * @see #integerForm None (optional) + * @see #int32Form None (optional) + * @see #int64Form None (optional) + * @see #_floatForm None (optional) + * @see #stringForm None (optional) + * @see #binaryMultiPart None (optional) + * @see #dateForm None (optional) + * @see #dateTimeForm None (optional) + * @see #passwordForm None (optional) + * @see #paramCallbackForm None (optional) */ public static class TestEndpointParametersOper { @@ -713,7 +713,7 @@ public class FakeApi { public static final String INTEGER_FORM = "integer"; /** - * @param integer (Integer) None (optional, default to null) + * @param integer (Integer) None (optional) * @return operation */ public TestEndpointParametersOper integerForm(Object... integer) { @@ -724,7 +724,7 @@ public class FakeApi { public static final String INT32_FORM = "int32"; /** - * @param int32 (Integer) None (optional, default to null) + * @param int32 (Integer) None (optional) * @return operation */ public TestEndpointParametersOper int32Form(Object... int32) { @@ -735,7 +735,7 @@ public class FakeApi { public static final String INT64_FORM = "int64"; /** - * @param int64 (Long) None (optional, default to null) + * @param int64 (Long) None (optional) * @return operation */ public TestEndpointParametersOper int64Form(Object... int64) { @@ -757,7 +757,7 @@ public class FakeApi { public static final String _FLOAT_FORM = "float"; /** - * @param _float (Float) None (optional, default to null) + * @param _float (Float) None (optional) * @return operation */ public TestEndpointParametersOper _floatForm(Object... _float) { @@ -779,7 +779,7 @@ public class FakeApi { public static final String STRING_FORM = "string"; /** - * @param string (String) None (optional, default to null) + * @param string (String) None (optional) * @return operation */ public TestEndpointParametersOper stringForm(Object... string) { @@ -812,7 +812,7 @@ public class FakeApi { public static final String DATE_FORM = "date"; /** - * @param date (LocalDate) None (optional, default to null) + * @param date (LocalDate) None (optional) * @return operation */ public TestEndpointParametersOper dateForm(Object... date) { @@ -823,7 +823,7 @@ public class FakeApi { public static final String DATE_TIME_FORM = "dateTime"; /** - * @param dateTime (OffsetDateTime) None (optional, default to null) + * @param dateTime (OffsetDateTime) None (optional) * @return operation */ public TestEndpointParametersOper dateTimeForm(Object... dateTime) { @@ -834,7 +834,7 @@ public class FakeApi { public static final String PASSWORD_FORM = "password"; /** - * @param password (String) None (optional, default to null) + * @param password (String) None (optional) * @return operation */ public TestEndpointParametersOper passwordForm(Object... password) { @@ -845,7 +845,7 @@ public class FakeApi { public static final String PARAM_CALLBACK_FORM = "callback"; /** - * @param paramCallback (String) None (optional, default to null) + * @param paramCallback (String) None (optional) * @return operation */ public TestEndpointParametersOper paramCallbackForm(Object... paramCallback) { @@ -856,7 +856,7 @@ public class FakeApi { /** * It will assume that the control name is file and the <content-type> is <application/octet-stream> * @see #reqSpec for customise - * @param binary (File) None (optional, default to null) + * @param binary (File) None (optional) * @return operation */ public TestEndpointParametersOper binaryMultiPart(File binary) { @@ -888,9 +888,9 @@ public class FakeApi { * To test enum parameters * To test enum parameters * - * @see #enumHeaderStringArrayHeader Header parameter enum test (string array) (optional) + * @see #enumHeaderStringArrayHeader Header parameter enum test (string array) (optional, default to new ArrayList<String>()) * @see #enumHeaderStringHeader Header parameter enum test (string) (optional, default to -efg) - * @see #enumQueryStringArrayQuery Query parameter enum test (string array) (optional) + * @see #enumQueryStringArrayQuery Query parameter enum test (string array) (optional, default to new ArrayList<String>()) * @see #enumQueryStringQuery Query parameter enum test (string) (optional, default to -efg) * @see #enumQueryIntegerQuery Query parameter enum test (double) (optional) * @see #enumQueryDoubleQuery Query parameter enum test (double) (optional) @@ -925,7 +925,7 @@ public class FakeApi { public static final String ENUM_HEADER_STRING_ARRAY_HEADER = "enum_header_string_array"; /** - * @param enumHeaderStringArray (List<String>) Header parameter enum test (string array) (optional) + * @param enumHeaderStringArray (List<String>) Header parameter enum test (string array) (optional, default to new ArrayList<String>()) * @return operation */ public TestEnumParametersOper enumHeaderStringArrayHeader(String enumHeaderStringArray) { @@ -947,7 +947,7 @@ public class FakeApi { public static final String ENUM_QUERY_STRING_ARRAY_QUERY = "enum_query_string_array"; /** - * @param enumQueryStringArray (List<String>) Query parameter enum test (string array) (optional) + * @param enumQueryStringArray (List<String>) Query parameter enum test (string array) (optional, default to new ArrayList<String>()) * @return operation */ public TestEnumParametersOper enumQueryStringArrayQuery(Object... enumQueryStringArray) { 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 43e9f070484..2818336f7b6 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 @@ -575,8 +575,8 @@ public class PetApi { * * * @see #petIdPath ID of pet that needs to be updated (required) - * @see #nameForm Updated name of the pet (optional, default to null) - * @see #statusForm Updated status of the pet (optional, default to null) + * @see #nameForm Updated name of the pet (optional) + * @see #statusForm Updated status of the pet (optional) */ public static class UpdatePetWithFormOper { @@ -617,7 +617,7 @@ public class PetApi { public static final String NAME_FORM = "name"; /** - * @param name (String) Updated name of the pet (optional, default to null) + * @param name (String) Updated name of the pet (optional) * @return operation */ public UpdatePetWithFormOper nameForm(Object... name) { @@ -628,7 +628,7 @@ public class PetApi { public static final String STATUS_FORM = "status"; /** - * @param status (String) Updated status of the pet (optional, default to null) + * @param status (String) Updated status of the pet (optional) * @return operation */ public UpdatePetWithFormOper statusForm(Object... status) { @@ -661,8 +661,8 @@ public class PetApi { * * * @see #petIdPath ID of pet to update (required) - * @see #additionalMetadataForm Additional data to pass to server (optional, default to null) - * @see #fileMultiPart file to upload (optional, default to null) + * @see #additionalMetadataForm Additional data to pass to server (optional) + * @see #fileMultiPart file to upload (optional) * return ModelApiResponse */ public static class UploadFileOper { @@ -714,7 +714,7 @@ public class PetApi { public static final String ADDITIONAL_METADATA_FORM = "additionalMetadata"; /** - * @param additionalMetadata (String) Additional data to pass to server (optional, default to null) + * @param additionalMetadata (String) Additional data to pass to server (optional) * @return operation */ public UploadFileOper additionalMetadataForm(Object... additionalMetadata) { @@ -725,7 +725,7 @@ public class PetApi { /** * It will assume that the control name is file and the <content-type> is <application/octet-stream> * @see #reqSpec for customise - * @param file (File) file to upload (optional, default to null) + * @param file (File) file to upload (optional) * @return operation */ public UploadFileOper fileMultiPart(File file) { @@ -759,7 +759,7 @@ public class PetApi { * * @see #petIdPath ID of pet to update (required) * @see #requiredFileMultiPart file to upload (required) - * @see #additionalMetadataForm Additional data to pass to server (optional, default to null) + * @see #additionalMetadataForm Additional data to pass to server (optional) * return ModelApiResponse */ public static class UploadFileWithRequiredFileOper { @@ -811,7 +811,7 @@ public class PetApi { public static final String ADDITIONAL_METADATA_FORM = "additionalMetadata"; /** - * @param additionalMetadata (String) Additional data to pass to server (optional, default to null) + * @param additionalMetadata (String) Additional data to pass to server (optional) * @return operation */ public UploadFileWithRequiredFileOper additionalMetadataForm(Object... additionalMetadata) { diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Animal.java index 02469e22e51..4cc9f9fc81b 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Animal.java @@ -32,7 +32,7 @@ import java.io.IOException; public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className = null; + private String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Capitalization.java index bd3be0876f6..364dc3f2e4b 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Capitalization.java @@ -31,27 +31,27 @@ import java.io.IOException; public class Capitalization { public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) - private String smallCamel = null; + private String smallCamel; public static final String SERIALIZED_NAME_CAPITAL_CAMEL = "CapitalCamel"; @SerializedName(SERIALIZED_NAME_CAPITAL_CAMEL) - private String capitalCamel = null; + private String capitalCamel; public static final String SERIALIZED_NAME_SMALL_SNAKE = "small_Snake"; @SerializedName(SERIALIZED_NAME_SMALL_SNAKE) - private String smallSnake = null; + private String smallSnake; public static final String SERIALIZED_NAME_CAPITAL_SNAKE = "Capital_Snake"; @SerializedName(SERIALIZED_NAME_CAPITAL_SNAKE) - private String capitalSnake = null; + private String capitalSnake; public static final String SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; @SerializedName(SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS) - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; public static final String SERIALIZED_NAME_A_T_T_N_A_M_E = "ATT_NAME"; @SerializedName(SERIALIZED_NAME_A_T_T_N_A_M_E) - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Cat.java index 834be67f34f..ffa261b355f 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Cat.java @@ -32,7 +32,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Category.java index 7223fd28279..68177b01908 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Category.java @@ -31,11 +31,11 @@ import java.io.IOException; public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ClassModel.java index 3150b5919b0..225a08b9344 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ClassModel.java @@ -32,7 +32,7 @@ import java.io.IOException; public class ClassModel { public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Client.java index 219520a7ab1..a724368de1b 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Client.java @@ -31,7 +31,7 @@ import java.io.IOException; public class Client { public static final String SERIALIZED_NAME_CLIENT = "client"; @SerializedName(SERIALIZED_NAME_CLIENT) - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Dog.java index 3c86defe3c8..929dae95e51 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Dog.java @@ -32,7 +32,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumArrays.java index c2f60d79983..4db242f3a11 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -80,7 +80,7 @@ public class EnumArrays { public static final String SERIALIZED_NAME_JUST_SYMBOL = "just_symbol"; @SerializedName(SERIALIZED_NAME_JUST_SYMBOL) - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumTest.java index a2319a67a7d..1dc613b8501 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/EnumTest.java @@ -81,7 +81,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_STRING = "enum_string"; @SerializedName(SERIALIZED_NAME_ENUM_STRING) - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -134,7 +134,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required"; @SerializedName(SERIALIZED_NAME_ENUM_STRING_REQUIRED) - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -185,7 +185,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_INTEGER = "enum_integer"; @SerializedName(SERIALIZED_NAME_ENUM_INTEGER) - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -236,7 +236,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_NUMBER = "enum_number"; @SerializedName(SERIALIZED_NAME_ENUM_NUMBER) - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; public static final String SERIALIZED_NAME_OUTER_ENUM = "outerEnum"; @SerializedName(SERIALIZED_NAME_OUTER_ENUM) diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FormatTest.java index 528a49bac3f..e2cc8f57fab 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/FormatTest.java @@ -36,55 +36,55 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { public static final String SERIALIZED_NAME_INTEGER = "integer"; @SerializedName(SERIALIZED_NAME_INTEGER) - private Integer integer = null; + private Integer integer; public static final String SERIALIZED_NAME_INT32 = "int32"; @SerializedName(SERIALIZED_NAME_INT32) - private Integer int32 = null; + private Integer int32; public static final String SERIALIZED_NAME_INT64 = "int64"; @SerializedName(SERIALIZED_NAME_INT64) - private Long int64 = null; + private Long int64; public static final String SERIALIZED_NAME_NUMBER = "number"; @SerializedName(SERIALIZED_NAME_NUMBER) - private BigDecimal number = null; + private BigDecimal number; public static final String SERIALIZED_NAME_FLOAT = "float"; @SerializedName(SERIALIZED_NAME_FLOAT) - private Float _float = null; + private Float _float; public static final String SERIALIZED_NAME_DOUBLE = "double"; @SerializedName(SERIALIZED_NAME_DOUBLE) - private Double _double = null; + private Double _double; public static final String SERIALIZED_NAME_STRING = "string"; @SerializedName(SERIALIZED_NAME_STRING) - private String string = null; + private String string; public static final String SERIALIZED_NAME_BYTE = "byte"; @SerializedName(SERIALIZED_NAME_BYTE) - private byte[] _byte = null; + private byte[] _byte; public static final String SERIALIZED_NAME_BINARY = "binary"; @SerializedName(SERIALIZED_NAME_BINARY) - private File binary = null; + private File binary; public static final String SERIALIZED_NAME_DATE = "date"; @SerializedName(SERIALIZED_NAME_DATE) - private LocalDate date = null; + private LocalDate date; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 602ff3afb43..597dcffd820 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -31,11 +31,11 @@ import java.io.IOException; public class HasOnlyReadOnly { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_FOO = "foo"; @SerializedName(SERIALIZED_NAME_FOO) - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MapTest.java index 8f4186f986d..bf598190bd1 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MapTest.java @@ -26,7 +26,6 @@ import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -94,7 +93,7 @@ public class MapTest { public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map"; @SerializedName(SERIALIZED_NAME_INDIRECT_MAP) - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -174,21 +173,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 96a6bc24503..6e69e3fe8be 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -37,11 +37,11 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; public static final String SERIALIZED_NAME_MAP = "map"; @SerializedName(SERIALIZED_NAME_MAP) diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Model200Response.java index fdc7ed42acb..2251a56b578 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Model200Response.java @@ -32,11 +32,11 @@ import java.io.IOException; public class Model200Response { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_PROPERTY_CLASS = "class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 1a871eeb59f..f5d77a2901b 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -31,15 +31,15 @@ import java.io.IOException; public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) - private Integer code = null; + private Integer code; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) - private String type = null; + private String type; public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelReturn.java index 83e7b1c601b..91bdd8d4b93 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -32,7 +32,7 @@ import java.io.IOException; public class ModelReturn { public static final String SERIALIZED_NAME_RETURN = "return"; @SerializedName(SERIALIZED_NAME_RETURN) - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Name.java index e88b3009cd6..e59fad09270 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Name.java @@ -32,19 +32,19 @@ import java.io.IOException; public class Name { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_SNAKE_CASE = "snake_case"; @SerializedName(SERIALIZED_NAME_SNAKE_CASE) - private Integer snakeCase = null; + private Integer snakeCase; public static final String SERIALIZED_NAME_PROPERTY = "property"; @SerializedName(SERIALIZED_NAME_PROPERTY) - private String property = null; + private String property; public static final String SERIALIZED_NAME_123NUMBER = "123Number"; @SerializedName(SERIALIZED_NAME_123NUMBER) - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/NumberOnly.java index 81cb0ece54d..0c0620ae66d 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -32,7 +32,7 @@ import java.math.BigDecimal; public class NumberOnly { public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; @SerializedName(SERIALIZED_NAME_JUST_NUMBER) - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Order.java index c1ccf03f8f3..dbc4de9a5c1 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Order.java @@ -32,19 +32,19 @@ import org.threeten.bp.OffsetDateTime; public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_PET_ID = "petId"; @SerializedName(SERIALIZED_NAME_PET_ID) - private Long petId = null; + private Long petId; public static final String SERIALIZED_NAME_QUANTITY = "quantity"; @SerializedName(SERIALIZED_NAME_QUANTITY) - private Integer quantity = null; + private Integer quantity; public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; @SerializedName(SERIALIZED_NAME_SHIP_DATE) - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -97,7 +97,7 @@ public class Order { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public static final String SERIALIZED_NAME_COMPLETE = "complete"; @SerializedName(SERIALIZED_NAME_COMPLETE) diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/OuterComposite.java index 57c78759653..363fd5523db 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -32,15 +32,15 @@ import java.math.BigDecimal; public class OuterComposite { public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; @SerializedName(SERIALIZED_NAME_MY_NUMBER) - private BigDecimal myNumber = null; + private BigDecimal myNumber; public static final String SERIALIZED_NAME_MY_STRING = "my_string"; @SerializedName(SERIALIZED_NAME_MY_STRING) - private String myString = null; + private String myString; public static final String SERIALIZED_NAME_MY_BOOLEAN = "my_boolean"; @SerializedName(SERIALIZED_NAME_MY_BOOLEAN) - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Pet.java index 82dd8b088a6..f191512b221 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Pet.java @@ -35,7 +35,7 @@ import org.openapitools.client.model.Tag; public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_CATEGORY = "category"; @SerializedName(SERIALIZED_NAME_CATEGORY) @@ -43,7 +43,7 @@ public class Pet { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) @@ -104,7 +104,7 @@ public class Pet { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index c25d42c2724..e1496b4bc9a 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -31,11 +31,11 @@ import java.io.IOException; public class ReadOnlyFirst { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_BAZ = "baz"; @SerializedName(SERIALIZED_NAME_BAZ) - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/SpecialModelName.java index db6241ec143..510b8a00318 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -31,7 +31,7 @@ import java.io.IOException; public class SpecialModelName { public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Tag.java index c80a102aef4..f889117e7f0 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/Tag.java @@ -31,11 +31,11 @@ import java.io.IOException; public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/User.java index bcc3e9164db..b551c8d25d2 100644 --- a/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/rest-assured/src/main/java/org/openapitools/client/model/User.java @@ -31,35 +31,35 @@ import java.io.IOException; public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_USERNAME = "username"; @SerializedName(SERIALIZED_NAME_USERNAME) - private String username = null; + private String username; public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; @SerializedName(SERIALIZED_NAME_FIRST_NAME) - private String firstName = null; + private String firstName; public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; @SerializedName(SERIALIZED_NAME_LAST_NAME) - private String lastName = null; + private String lastName; public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) - private String email = null; + private String email; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public static final String SERIALIZED_NAME_PHONE = "phone"; @SerializedName(SERIALIZED_NAME_PHONE) - private String phone = null; + private String phone; public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; @SerializedName(SERIALIZED_NAME_USER_STATUS) - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/resteasy/docs/FakeApi.md b/samples/client/petstore/java/resteasy/docs/FakeApi.md index b550c716171..5ec1d20e445 100644 --- a/samples/client/petstore/java/resteasy/docs/FakeApi.md +++ b/samples/client/petstore/java/resteasy/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/resteasy/docs/MapTest.md b/samples/client/petstore/java/resteasy/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/resteasy/docs/MapTest.md +++ b/samples/client/petstore/java/resteasy/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/resteasy/docs/PetApi.md b/samples/client/petstore/java/resteasy/docs/PetApi.md index 41c08ccf9e3..8d621d1682a 100644 --- a/samples/client/petstore/java/resteasy/docs/PetApi.md +++ b/samples/client/petstore/java/resteasy/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/resteasy/docs/UserApi.md b/samples/client/petstore/java/resteasy/docs/UserApi.md index 102d04ac2c4..b7b880585f7 100644 --- a/samples/client/petstore/java/resteasy/docs/UserApi.md +++ b/samples/client/petstore/java/resteasy/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/resteasy/pom.xml b/samples/client/petstore/java/resteasy/pom.xml index ffe295db737..de50c2bb944 100644 --- a/samples/client/petstore/java/resteasy/pom.xml +++ b/samples/client/petstore/java/resteasy/pom.xml @@ -95,8 +95,7 @@ - - src/main/java + src/main/java @@ -108,8 +107,7 @@ - - src/test/java + src/test/java @@ -143,7 +141,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} @@ -215,7 +213,7 @@ UTF-8 - 1.5.18 + 1.5.21 3.1.3.Final 2.8.6 2.6.4 diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/Pair.java index 18a0e96bfc7..0619e8c408b 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/Pair.java @@ -24,13 +24,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -44,8 +48,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java index bb0e8d80750..5b68d20e83b 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/FakeApi.java @@ -320,16 +320,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @param integer None (optional) + * @param int32 None (optional) + * @param int64 None (optional) + * @param _float None (optional) + * @param string None (optional) + * @param binary None (optional) + * @param date None (optional) + * @param dateTime None (optional) + * @param password None (optional) + * @param paramCallback None (optional) * @throws ApiException if fails to make API call */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, File binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) throws ApiException { @@ -412,9 +412,9 @@ if (paramCallback != null) /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java index 98ef7b101c7..8182ba71658 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/api/PetApi.java @@ -292,8 +292,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @throws ApiException if fails to make API call */ public void updatePetWithForm(Long petId, String name, String status) throws ApiException { @@ -339,8 +339,8 @@ if (status != null) * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return a {@code ModelApiResponse} * @throws ApiException if fails to make API call */ @@ -388,7 +388,7 @@ if (file != null) * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return a {@code ModelApiResponse} * @throws ApiException if fails to make API call */ diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Animal.java index 6819bd7fe7d..5c049e200ff 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Animal.java @@ -35,7 +35,7 @@ import io.swagger.annotations.ApiModelProperty; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Capitalization.java index f0b2d5cd99f..061063eff71 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Capitalization.java @@ -27,22 +27,22 @@ import io.swagger.annotations.ApiModelProperty; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Cat.java index 76311c5de09..c5d652f6a3d 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Cat.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Category.java index 60f4d2b07b2..ffc9482ffc0 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Category.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ClassModel.java index d16a676db3d..4076399e9c5 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ClassModel.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Client.java index 290c475cb54..2fd30addec8 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Client.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Dog.java index b7beed2df53..a36ad9d7475 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Dog.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumArrays.java index 3b1b51c26a3..0596441db15 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -64,7 +64,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumTest.java index 122f370cef9..27e6dee1d11 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/EnumTest.java @@ -65,7 +65,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -105,7 +105,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -143,7 +143,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -181,7 +181,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FormatTest.java index de08419d1db..bdcfdca6dd8 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/FormatTest.java @@ -32,43 +32,43 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index ddd9bfbf678..c9307f90621 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MapTest.java index f67fb22c45c..92128acfc7a 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MapTest.java @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -75,7 +74,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -155,21 +154,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index a12b7048008..c8e0ae1545a 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -33,10 +33,10 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Model200Response.java index edef1b3e626..4d2da937512 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Model200Response.java @@ -28,10 +28,10 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 2f89b60db0b..04e167c98f6 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -27,13 +27,13 @@ import io.swagger.annotations.ApiModelProperty; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelReturn.java index 4adcfed3c3d..6c3bf33c6b1 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Name.java index 1f55823fcf4..da57f200d58 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Name.java @@ -28,16 +28,16 @@ import io.swagger.annotations.ApiModelProperty; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/NumberOnly.java index 7372bf2d2fd..e8952b8568d 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -28,7 +28,7 @@ import java.math.BigDecimal; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Order.java index 351e8ad268d..0e5fad25586 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Order.java @@ -28,16 +28,16 @@ import org.threeten.bp.OffsetDateTime; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -77,7 +77,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/OuterComposite.java index e1372035e86..864d298e107 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -28,13 +28,13 @@ import java.math.BigDecimal; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Pet.java index 183260074e2..18845f5a6ff 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Pet.java @@ -31,13 +31,13 @@ import org.openapitools.client.model.Tag; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList(); @@ -83,7 +83,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 17bd805fa5c..edade3b2a37 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/SpecialModelName.java index f0181742543..494c9cd98ad 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Tag.java index 2607dc2a1a5..10334b74be4 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/Tag.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/User.java index 42d73dd62dc..0d0cd0d2908 100644 --- a/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/resteasy/src/main/java/org/openapitools/client/model/User.java @@ -27,28 +27,28 @@ import io.swagger.annotations.ApiModelProperty; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/resttemplate-withXml/build.gradle b/samples/client/petstore/java/resttemplate-withXml/build.gradle index 1d6787e3dbe..6448e545d59 100644 --- a/samples/client/petstore/java/resttemplate-withXml/build.gradle +++ b/samples/client/petstore/java/resttemplate-withXml/build.gradle @@ -94,7 +94,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" jackson_version = "2.8.9" spring_web_version = "4.3.9.RELEASE" jodatime_version = "2.9.9" diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md index b550c716171..5ec1d20e445 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/MapTest.md b/samples/client/petstore/java/resttemplate-withXml/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/MapTest.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md index 41c08ccf9e3..8d621d1682a 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/resttemplate-withXml/docs/UserApi.md b/samples/client/petstore/java/resttemplate-withXml/docs/UserApi.md index 102d04ac2c4..b7b880585f7 100644 --- a/samples/client/petstore/java/resttemplate-withXml/docs/UserApi.md +++ b/samples/client/petstore/java/resttemplate-withXml/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/resttemplate-withXml/pom.xml b/samples/client/petstore/java/resttemplate-withXml/pom.xml index e8c5b512c7a..74cc0d02f02 100644 --- a/samples/client/petstore/java/resttemplate-withXml/pom.xml +++ b/samples/client/petstore/java/resttemplate-withXml/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -255,7 +253,7 @@ UTF-8 - 1.5.17 + 1.5.21 4.3.9.RELEASE 2.8.9 2.6.4 diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Animal.java index 4171261093e..9c50238d0ce 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Animal.java @@ -42,7 +42,7 @@ public class Animal { @JsonProperty("className") @JacksonXmlProperty(localName = "className") @XmlElement(name = "className") - private String className = null; + private String className; @JsonProperty("color") @JacksonXmlProperty(localName = "color") diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Capitalization.java index 094df9667d7..f5ddf2c85fe 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Capitalization.java @@ -34,32 +34,32 @@ public class Capitalization { @JsonProperty("smallCamel") @JacksonXmlProperty(localName = "smallCamel") @XmlElement(name = "smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") @JacksonXmlProperty(localName = "CapitalCamel") @XmlElement(name = "CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") @JacksonXmlProperty(localName = "small_Snake") @XmlElement(name = "small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") @JacksonXmlProperty(localName = "Capital_Snake") @XmlElement(name = "Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") @JacksonXmlProperty(localName = "SCA_ETH_Flow_Points") @XmlElement(name = "SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") @JacksonXmlProperty(localName = "ATT_NAME") @XmlElement(name = "ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Cat.java index c48fc9e005e..eee5a6425fe 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Cat.java @@ -35,7 +35,7 @@ public class Cat extends Animal { @JsonProperty("declawed") @JacksonXmlProperty(localName = "declawed") @XmlElement(name = "declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Category.java index 6f15b68bae2..e1941529f4b 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Category.java @@ -34,12 +34,12 @@ public class Category { @JsonProperty("id") @JacksonXmlProperty(localName = "id") @XmlElement(name = "id") - private Long id = null; + private Long id; @JsonProperty("name") @JacksonXmlProperty(localName = "name") @XmlElement(name = "name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ClassModel.java index 8f112041110..20bc8388d29 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ClassModel.java @@ -35,7 +35,7 @@ public class ClassModel { @JsonProperty("_class") @JacksonXmlProperty(localName = "_class") @XmlElement(name = "_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Client.java index c0c683f84d8..df99f39805c 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Client.java @@ -34,7 +34,7 @@ public class Client { @JsonProperty("client") @JacksonXmlProperty(localName = "client") @XmlElement(name = "client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Dog.java index c1ed2c3d9e7..acf227f7d95 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Dog.java @@ -35,7 +35,7 @@ public class Dog extends Animal { @JsonProperty("breed") @JacksonXmlProperty(localName = "breed") @XmlElement(name = "breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java index 93a48f86bbd..c339c536ac6 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -71,7 +71,7 @@ public class EnumArrays { @JsonProperty("just_symbol") @JacksonXmlProperty(localName = "just_symbol") @XmlElement(name = "just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumTest.java index 2bd71e85a04..dd04c3a70e8 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumTest.java @@ -72,7 +72,7 @@ public class EnumTest { @JsonProperty("enum_string") @JacksonXmlProperty(localName = "enum_string") @XmlElement(name = "enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -114,7 +114,7 @@ public class EnumTest { @JsonProperty("enum_string_required") @JacksonXmlProperty(localName = "enum_string_required") @XmlElement(name = "enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -154,7 +154,7 @@ public class EnumTest { @JsonProperty("enum_integer") @JacksonXmlProperty(localName = "enum_integer") @XmlElement(name = "enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -194,7 +194,7 @@ public class EnumTest { @JsonProperty("enum_number") @JacksonXmlProperty(localName = "enum_number") @XmlElement(name = "enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") @JacksonXmlProperty(localName = "outerEnum") diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FormatTest.java index 534fbf4220b..240045dfd66 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FormatTest.java @@ -39,67 +39,67 @@ public class FormatTest { @JsonProperty("integer") @JacksonXmlProperty(localName = "integer") @XmlElement(name = "integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") @JacksonXmlProperty(localName = "int32") @XmlElement(name = "int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") @JacksonXmlProperty(localName = "int64") @XmlElement(name = "int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") @JacksonXmlProperty(localName = "number") @XmlElement(name = "number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") @JacksonXmlProperty(localName = "float") @XmlElement(name = "float") - private Float _float = null; + private Float _float; @JsonProperty("double") @JacksonXmlProperty(localName = "double") @XmlElement(name = "double") - private Double _double = null; + private Double _double; @JsonProperty("string") @JacksonXmlProperty(localName = "string") @XmlElement(name = "string") - private String string = null; + private String string; @JsonProperty("byte") @JacksonXmlProperty(localName = "byte") @XmlElement(name = "byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") @JacksonXmlProperty(localName = "binary") @XmlElement(name = "binary") - private File binary = null; + private File binary; @JsonProperty("date") @JacksonXmlProperty(localName = "date") @XmlElement(name = "date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") @JacksonXmlProperty(localName = "dateTime") @XmlElement(name = "dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") @JacksonXmlProperty(localName = "uuid") @XmlElement(name = "uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") @JacksonXmlProperty(localName = "password") @XmlElement(name = "password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index fb784225864..03c3220d0e0 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -34,12 +34,12 @@ public class HasOnlyReadOnly { @JsonProperty("bar") @JacksonXmlProperty(localName = "bar") @XmlElement(name = "bar") - private String bar = null; + private String bar; @JsonProperty("foo") @JacksonXmlProperty(localName = "foo") @XmlElement(name = "foo") - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java index 4bb1ec28f8c..959adc2a0ab 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; import com.fasterxml.jackson.dataformat.xml.annotation.*; import javax.xml.bind.annotation.*; @@ -92,9 +91,11 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - @JacksonXmlProperty(localName = "indirect_map") - @XmlElement(name = "indirect_map") - private StringBooleanMap indirectMap = null; + // Is a container wrapped=false + // items.name=inner items.baseName=inner items.xmlName= items.xmlNamespace= + // items.example= items.type=Boolean + @XmlElement(name = "inner") + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -174,21 +175,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 0a0b38123d6..08991bf8c51 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -40,12 +40,12 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") @JacksonXmlProperty(localName = "uuid") @XmlElement(name = "uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") @JacksonXmlProperty(localName = "dateTime") @XmlElement(name = "dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") // Is a container wrapped=false diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Model200Response.java index c5cef65a42e..f611047ffbd 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Model200Response.java @@ -35,12 +35,12 @@ public class Model200Response { @JsonProperty("name") @JacksonXmlProperty(localName = "name") @XmlElement(name = "name") - private Integer name = null; + private Integer name; @JsonProperty("class") @JacksonXmlProperty(localName = "class") @XmlElement(name = "class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 0114b1fbafe..fe61683ec8f 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -34,17 +34,17 @@ public class ModelApiResponse { @JsonProperty("code") @JacksonXmlProperty(localName = "code") @XmlElement(name = "code") - private Integer code = null; + private Integer code; @JsonProperty("type") @JacksonXmlProperty(localName = "type") @XmlElement(name = "type") - private String type = null; + private String type; @JsonProperty("message") @JacksonXmlProperty(localName = "message") @XmlElement(name = "message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelReturn.java index baaa32acd34..7c2268522dd 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -35,7 +35,7 @@ public class ModelReturn { @JsonProperty("return") @JacksonXmlProperty(localName = "return") @XmlElement(name = "return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Name.java index 93f65451070..48dad7421c1 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Name.java @@ -35,22 +35,22 @@ public class Name { @JsonProperty("name") @JacksonXmlProperty(localName = "name") @XmlElement(name = "name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") @JacksonXmlProperty(localName = "snake_case") @XmlElement(name = "snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") @JacksonXmlProperty(localName = "property") @XmlElement(name = "property") - private String property = null; + private String property; @JsonProperty("123Number") @JacksonXmlProperty(localName = "123Number") @XmlElement(name = "123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/NumberOnly.java index 51ad9f694cc..7959562a48b 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -35,7 +35,7 @@ public class NumberOnly { @JsonProperty("JustNumber") @JacksonXmlProperty(localName = "JustNumber") @XmlElement(name = "JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Order.java index a71b7b09bca..b0854bf91c1 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Order.java @@ -35,22 +35,22 @@ public class Order { @JsonProperty("id") @JacksonXmlProperty(localName = "id") @XmlElement(name = "id") - private Long id = null; + private Long id; @JsonProperty("petId") @JacksonXmlProperty(localName = "petId") @XmlElement(name = "petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") @JacksonXmlProperty(localName = "quantity") @XmlElement(name = "quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") @JacksonXmlProperty(localName = "shipDate") @XmlElement(name = "shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -92,7 +92,7 @@ public class Order { @JsonProperty("status") @JacksonXmlProperty(localName = "status") @XmlElement(name = "status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") @JacksonXmlProperty(localName = "complete") diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/OuterComposite.java index a595be8f33a..aa81e5c23f5 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -35,17 +35,17 @@ public class OuterComposite { @JsonProperty("my_number") @JacksonXmlProperty(localName = "my_number") @XmlElement(name = "my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") @JacksonXmlProperty(localName = "my_string") @XmlElement(name = "my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") @JacksonXmlProperty(localName = "my_boolean") @XmlElement(name = "my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java index b6b70a02a22..4cb97c0f310 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java @@ -38,7 +38,7 @@ public class Pet { @JsonProperty("id") @JacksonXmlProperty(localName = "id") @XmlElement(name = "id") - private Long id = null; + private Long id; @JsonProperty("category") @JacksonXmlProperty(localName = "category") @@ -48,7 +48,7 @@ public class Pet { @JsonProperty("name") @JacksonXmlProperty(localName = "name") @XmlElement(name = "name") - private String name = null; + private String name; @JsonProperty("photoUrls") // items.xmlName= @@ -110,7 +110,7 @@ public class Pet { @JsonProperty("status") @JacksonXmlProperty(localName = "status") @XmlElement(name = "status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 95375e1ee1e..d24e1b0b13b 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -34,12 +34,12 @@ public class ReadOnlyFirst { @JsonProperty("bar") @JacksonXmlProperty(localName = "bar") @XmlElement(name = "bar") - private String bar = null; + private String bar; @JsonProperty("baz") @JacksonXmlProperty(localName = "baz") @XmlElement(name = "baz") - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/SpecialModelName.java index 77fb83982af..7993be2fde8 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -34,7 +34,7 @@ public class SpecialModelName { @JsonProperty("$special[property.name]") @JacksonXmlProperty(localName = "$special[property.name]") @XmlElement(name = "$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Tag.java index 006cc9abb12..25d253df5c7 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Tag.java @@ -34,12 +34,12 @@ public class Tag { @JsonProperty("id") @JacksonXmlProperty(localName = "id") @XmlElement(name = "id") - private Long id = null; + private Long id; @JsonProperty("name") @JacksonXmlProperty(localName = "name") @XmlElement(name = "name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/User.java index 5bed598cfb3..dfb57b3db2a 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/User.java @@ -34,42 +34,42 @@ public class User { @JsonProperty("id") @JacksonXmlProperty(localName = "id") @XmlElement(name = "id") - private Long id = null; + private Long id; @JsonProperty("username") @JacksonXmlProperty(localName = "username") @XmlElement(name = "username") - private String username = null; + private String username; @JsonProperty("firstName") @JacksonXmlProperty(localName = "firstName") @XmlElement(name = "firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") @JacksonXmlProperty(localName = "lastName") @XmlElement(name = "lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") @JacksonXmlProperty(localName = "email") @XmlElement(name = "email") - private String email = null; + private String email; @JsonProperty("password") @JacksonXmlProperty(localName = "password") @XmlElement(name = "password") - private String password = null; + private String password; @JsonProperty("phone") @JacksonXmlProperty(localName = "phone") @XmlElement(name = "phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") @JacksonXmlProperty(localName = "userStatus") @XmlElement(name = "userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/resttemplate/build.gradle b/samples/client/petstore/java/resttemplate/build.gradle index a6de57bd8cb..17325018007 100644 --- a/samples/client/petstore/java/resttemplate/build.gradle +++ b/samples/client/petstore/java/resttemplate/build.gradle @@ -94,7 +94,7 @@ if(hasProperty('target') && target == 'android') { } ext { - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" jackson_version = "2.8.9" spring_web_version = "4.3.9.RELEASE" jodatime_version = "2.9.9" diff --git a/samples/client/petstore/java/resttemplate/docs/FakeApi.md b/samples/client/petstore/java/resttemplate/docs/FakeApi.md index b550c716171..5ec1d20e445 100644 --- a/samples/client/petstore/java/resttemplate/docs/FakeApi.md +++ b/samples/client/petstore/java/resttemplate/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/resttemplate/docs/MapTest.md b/samples/client/petstore/java/resttemplate/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/resttemplate/docs/MapTest.md +++ b/samples/client/petstore/java/resttemplate/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/resttemplate/docs/PetApi.md b/samples/client/petstore/java/resttemplate/docs/PetApi.md index 41c08ccf9e3..8d621d1682a 100644 --- a/samples/client/petstore/java/resttemplate/docs/PetApi.md +++ b/samples/client/petstore/java/resttemplate/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/resttemplate/docs/UserApi.md b/samples/client/petstore/java/resttemplate/docs/UserApi.md index 102d04ac2c4..b7b880585f7 100644 --- a/samples/client/petstore/java/resttemplate/docs/UserApi.md +++ b/samples/client/petstore/java/resttemplate/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/resttemplate/pom.xml b/samples/client/petstore/java/resttemplate/pom.xml index 9869bad196e..d3a526022dd 100644 --- a/samples/client/petstore/java/resttemplate/pom.xml +++ b/samples/client/petstore/java/resttemplate/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -247,7 +245,7 @@ UTF-8 - 1.5.17 + 1.5.21 4.3.9.RELEASE 2.8.9 2.6.4 diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java index 6819bd7fe7d..5c049e200ff 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Animal.java @@ -35,7 +35,7 @@ import io.swagger.annotations.ApiModelProperty; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java index f0b2d5cd99f..061063eff71 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Capitalization.java @@ -27,22 +27,22 @@ import io.swagger.annotations.ApiModelProperty; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java index 76311c5de09..c5d652f6a3d 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Cat.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java index 60f4d2b07b2..ffc9482ffc0 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Category.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java index d16a676db3d..4076399e9c5 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ClassModel.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java index 290c475cb54..2fd30addec8 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Client.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java index b7beed2df53..a36ad9d7475 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Dog.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java index 3b1b51c26a3..0596441db15 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -64,7 +64,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java index 122f370cef9..27e6dee1d11 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/EnumTest.java @@ -65,7 +65,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -105,7 +105,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -143,7 +143,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -181,7 +181,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java index de08419d1db..bdcfdca6dd8 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/FormatTest.java @@ -32,43 +32,43 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index ddd9bfbf678..c9307f90621 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java index f67fb22c45c..92128acfc7a 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MapTest.java @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -75,7 +74,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -155,21 +154,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index a12b7048008..c8e0ae1545a 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -33,10 +33,10 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java index edef1b3e626..4d2da937512 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Model200Response.java @@ -28,10 +28,10 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 2f89b60db0b..04e167c98f6 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -27,13 +27,13 @@ import io.swagger.annotations.ApiModelProperty; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java index 4adcfed3c3d..6c3bf33c6b1 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java index 1f55823fcf4..da57f200d58 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Name.java @@ -28,16 +28,16 @@ import io.swagger.annotations.ApiModelProperty; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java index 7372bf2d2fd..e8952b8568d 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -28,7 +28,7 @@ import java.math.BigDecimal; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java index 351e8ad268d..0e5fad25586 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Order.java @@ -28,16 +28,16 @@ import org.threeten.bp.OffsetDateTime; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -77,7 +77,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java index e1372035e86..864d298e107 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -28,13 +28,13 @@ import java.math.BigDecimal; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java index 183260074e2..18845f5a6ff 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Pet.java @@ -31,13 +31,13 @@ import org.openapitools.client.model.Tag; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList(); @@ -83,7 +83,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 17bd805fa5c..edade3b2a37 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java index f0181742543..494c9cd98ad 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java index 2607dc2a1a5..10334b74be4 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/Tag.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java index 42d73dd62dc..0d0cd0d2908 100644 --- a/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/resttemplate/src/main/java/org/openapitools/client/model/User.java @@ -27,28 +27,28 @@ import io.swagger.annotations.ApiModelProperty; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit/build.gradle b/samples/client/petstore/java/retrofit/build.gradle index fb1371f1f39..124982e8590 100644 --- a/samples/client/petstore/java/retrofit/build.gradle +++ b/samples/client/petstore/java/retrofit/build.gradle @@ -97,7 +97,7 @@ ext { okhttp_version = "2.7.5" oltu_version = "1.0.1" retrofit_version = "1.9.0" - swagger_annotations_version = "1.5.8" + swagger_annotations_version = "1.5.21" junit_version = "4.12" jodatime_version = "2.9.3" } diff --git a/samples/client/petstore/java/retrofit/build.sbt b/samples/client/petstore/java/retrofit/build.sbt index 44fb828418b..cedb083de93 100644 --- a/samples/client/petstore/java/retrofit/build.sbt +++ b/samples/client/petstore/java/retrofit/build.sbt @@ -11,7 +11,7 @@ lazy val root = (project in file(".")). libraryDependencies ++= Seq( "com.squareup.okhttp" % "okhttp" % "2.7.5" % "compile", "com.squareup.retrofit" % "retrofit" % "1.9.0" % "compile", - "io.swagger" % "swagger-annotations" % "1.5.8" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "joda-time" % "joda-time" % "2.9.3" % "compile", "junit" % "junit" % "4.12" % "test", diff --git a/samples/client/petstore/java/retrofit/pom.xml b/samples/client/petstore/java/retrofit/pom.xml index 1373ec62643..3f6dfee60fe 100644 --- a/samples/client/petstore/java/retrofit/pom.xml +++ b/samples/client/petstore/java/retrofit/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -200,7 +198,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} com.squareup.retrofit @@ -222,8 +220,6 @@ joda-time ${jodatime-version} - - junit @@ -234,7 +230,7 @@ UTF-8 - 1.5.18 + 1.5.21 1.9.0 2.7.5 2.9.9 diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/api/FakeApi.java index 49e23e5dc51..f5043c0f3b1 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/api/FakeApi.java @@ -199,16 +199,16 @@ public interface FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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 Void */ @@ -225,16 +225,16 @@ public interface FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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) * @param cb callback method */ @@ -247,9 +247,9 @@ public interface FakeApi { * To test enum parameters * Sync method * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) @@ -267,9 +267,9 @@ public interface FakeApi { /** * To test enum parameters * Async method - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/api/PetApi.java index bfe54c86bd3..7688e34406e 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/api/PetApi.java @@ -167,8 +167,8 @@ public interface PetApi { * Sync method * * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @return Void */ @@ -182,8 +182,8 @@ public interface PetApi { * Updates a pet in the store with form data * Async method * @param petId ID of pet that needs to be updated (required) - * @param name Updated name of the pet (optional, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @param cb callback method */ @@ -197,8 +197,8 @@ public interface PetApi { * Sync method * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return ModelApiResponse */ @@ -212,8 +212,8 @@ public interface PetApi { * uploads an image * Async method * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @param cb callback method */ @@ -228,7 +228,7 @@ public interface PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return ModelApiResponse */ @@ -243,7 +243,7 @@ public interface PetApi { * Async method * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @param cb callback method */ diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Animal.java index 02469e22e51..4cc9f9fc81b 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Animal.java @@ -32,7 +32,7 @@ import java.io.IOException; public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className = null; + private String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Capitalization.java index bd3be0876f6..364dc3f2e4b 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Capitalization.java @@ -31,27 +31,27 @@ import java.io.IOException; public class Capitalization { public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) - private String smallCamel = null; + private String smallCamel; public static final String SERIALIZED_NAME_CAPITAL_CAMEL = "CapitalCamel"; @SerializedName(SERIALIZED_NAME_CAPITAL_CAMEL) - private String capitalCamel = null; + private String capitalCamel; public static final String SERIALIZED_NAME_SMALL_SNAKE = "small_Snake"; @SerializedName(SERIALIZED_NAME_SMALL_SNAKE) - private String smallSnake = null; + private String smallSnake; public static final String SERIALIZED_NAME_CAPITAL_SNAKE = "Capital_Snake"; @SerializedName(SERIALIZED_NAME_CAPITAL_SNAKE) - private String capitalSnake = null; + private String capitalSnake; public static final String SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; @SerializedName(SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS) - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; public static final String SERIALIZED_NAME_A_T_T_N_A_M_E = "ATT_NAME"; @SerializedName(SERIALIZED_NAME_A_T_T_N_A_M_E) - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Cat.java index cede1ca4c75..67827ff3973 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Cat.java @@ -32,7 +32,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Category.java index 7223fd28279..68177b01908 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Category.java @@ -31,11 +31,11 @@ import java.io.IOException; public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ClassModel.java index 3150b5919b0..225a08b9344 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ClassModel.java @@ -32,7 +32,7 @@ import java.io.IOException; public class ClassModel { public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Client.java index 219520a7ab1..a724368de1b 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Client.java @@ -31,7 +31,7 @@ import java.io.IOException; public class Client { public static final String SERIALIZED_NAME_CLIENT = "client"; @SerializedName(SERIALIZED_NAME_CLIENT) - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Dog.java index 3c86defe3c8..929dae95e51 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Dog.java @@ -32,7 +32,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/EnumArrays.java index c2f60d79983..4db242f3a11 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -80,7 +80,7 @@ public class EnumArrays { public static final String SERIALIZED_NAME_JUST_SYMBOL = "just_symbol"; @SerializedName(SERIALIZED_NAME_JUST_SYMBOL) - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/EnumTest.java index a2319a67a7d..1dc613b8501 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/EnumTest.java @@ -81,7 +81,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_STRING = "enum_string"; @SerializedName(SERIALIZED_NAME_ENUM_STRING) - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -134,7 +134,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required"; @SerializedName(SERIALIZED_NAME_ENUM_STRING_REQUIRED) - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -185,7 +185,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_INTEGER = "enum_integer"; @SerializedName(SERIALIZED_NAME_ENUM_INTEGER) - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -236,7 +236,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_NUMBER = "enum_number"; @SerializedName(SERIALIZED_NAME_ENUM_NUMBER) - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; public static final String SERIALIZED_NAME_OUTER_ENUM = "outerEnum"; @SerializedName(SERIALIZED_NAME_OUTER_ENUM) diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/FormatTest.java index dd67c480397..8f5c3528595 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/FormatTest.java @@ -36,55 +36,55 @@ import org.joda.time.LocalDate; public class FormatTest { public static final String SERIALIZED_NAME_INTEGER = "integer"; @SerializedName(SERIALIZED_NAME_INTEGER) - private Integer integer = null; + private Integer integer; public static final String SERIALIZED_NAME_INT32 = "int32"; @SerializedName(SERIALIZED_NAME_INT32) - private Integer int32 = null; + private Integer int32; public static final String SERIALIZED_NAME_INT64 = "int64"; @SerializedName(SERIALIZED_NAME_INT64) - private Long int64 = null; + private Long int64; public static final String SERIALIZED_NAME_NUMBER = "number"; @SerializedName(SERIALIZED_NAME_NUMBER) - private BigDecimal number = null; + private BigDecimal number; public static final String SERIALIZED_NAME_FLOAT = "float"; @SerializedName(SERIALIZED_NAME_FLOAT) - private Float _float = null; + private Float _float; public static final String SERIALIZED_NAME_DOUBLE = "double"; @SerializedName(SERIALIZED_NAME_DOUBLE) - private Double _double = null; + private Double _double; public static final String SERIALIZED_NAME_STRING = "string"; @SerializedName(SERIALIZED_NAME_STRING) - private String string = null; + private String string; public static final String SERIALIZED_NAME_BYTE = "byte"; @SerializedName(SERIALIZED_NAME_BYTE) - private byte[] _byte = null; + private byte[] _byte; public static final String SERIALIZED_NAME_BINARY = "binary"; @SerializedName(SERIALIZED_NAME_BINARY) - private File binary = null; + private File binary; public static final String SERIALIZED_NAME_DATE = "date"; @SerializedName(SERIALIZED_NAME_DATE) - private LocalDate date = null; + private LocalDate date; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private DateTime dateTime = null; + private DateTime dateTime; public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 602ff3afb43..597dcffd820 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -31,11 +31,11 @@ import java.io.IOException; public class HasOnlyReadOnly { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_FOO = "foo"; @SerializedName(SERIALIZED_NAME_FOO) - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/MapTest.java index 8f4186f986d..bf598190bd1 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/MapTest.java @@ -26,7 +26,6 @@ import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -94,7 +93,7 @@ public class MapTest { public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map"; @SerializedName(SERIALIZED_NAME_INDIRECT_MAP) - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -174,21 +173,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 68012373c6a..c0eb9901084 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -37,11 +37,11 @@ import org.openapitools.client.model.Animal; public class MixedPropertiesAndAdditionalPropertiesClass { public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private DateTime dateTime = null; + private DateTime dateTime; public static final String SERIALIZED_NAME_MAP = "map"; @SerializedName(SERIALIZED_NAME_MAP) diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Model200Response.java index fdc7ed42acb..2251a56b578 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Model200Response.java @@ -32,11 +32,11 @@ import java.io.IOException; public class Model200Response { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_PROPERTY_CLASS = "class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 1a871eeb59f..f5d77a2901b 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -31,15 +31,15 @@ import java.io.IOException; public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) - private Integer code = null; + private Integer code; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) - private String type = null; + private String type; public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ModelReturn.java index 83e7b1c601b..91bdd8d4b93 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -32,7 +32,7 @@ import java.io.IOException; public class ModelReturn { public static final String SERIALIZED_NAME_RETURN = "return"; @SerializedName(SERIALIZED_NAME_RETURN) - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Name.java index e88b3009cd6..e59fad09270 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Name.java @@ -32,19 +32,19 @@ import java.io.IOException; public class Name { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_SNAKE_CASE = "snake_case"; @SerializedName(SERIALIZED_NAME_SNAKE_CASE) - private Integer snakeCase = null; + private Integer snakeCase; public static final String SERIALIZED_NAME_PROPERTY = "property"; @SerializedName(SERIALIZED_NAME_PROPERTY) - private String property = null; + private String property; public static final String SERIALIZED_NAME_123NUMBER = "123Number"; @SerializedName(SERIALIZED_NAME_123NUMBER) - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/NumberOnly.java index 81cb0ece54d..0c0620ae66d 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -32,7 +32,7 @@ import java.math.BigDecimal; public class NumberOnly { public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; @SerializedName(SERIALIZED_NAME_JUST_NUMBER) - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Order.java index f599921ddd2..283c49aff41 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Order.java @@ -32,19 +32,19 @@ import org.joda.time.DateTime; public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_PET_ID = "petId"; @SerializedName(SERIALIZED_NAME_PET_ID) - private Long petId = null; + private Long petId; public static final String SERIALIZED_NAME_QUANTITY = "quantity"; @SerializedName(SERIALIZED_NAME_QUANTITY) - private Integer quantity = null; + private Integer quantity; public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; @SerializedName(SERIALIZED_NAME_SHIP_DATE) - private DateTime shipDate = null; + private DateTime shipDate; /** * Order Status @@ -97,7 +97,7 @@ public class Order { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public static final String SERIALIZED_NAME_COMPLETE = "complete"; @SerializedName(SERIALIZED_NAME_COMPLETE) diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/OuterComposite.java index 63b15607287..05fa264021e 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -32,15 +32,15 @@ import java.math.BigDecimal; public class OuterComposite { public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; @SerializedName(SERIALIZED_NAME_MY_NUMBER) - private BigDecimal myNumber = null; + private BigDecimal myNumber; public static final String SERIALIZED_NAME_MY_STRING = "my_string"; @SerializedName(SERIALIZED_NAME_MY_STRING) - private String myString = null; + private String myString; public static final String SERIALIZED_NAME_MY_BOOLEAN = "my_boolean"; @SerializedName(SERIALIZED_NAME_MY_BOOLEAN) - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Pet.java index 82dd8b088a6..f191512b221 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Pet.java @@ -35,7 +35,7 @@ import org.openapitools.client.model.Tag; public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_CATEGORY = "category"; @SerializedName(SERIALIZED_NAME_CATEGORY) @@ -43,7 +43,7 @@ public class Pet { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) @@ -104,7 +104,7 @@ public class Pet { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index c25d42c2724..e1496b4bc9a 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -31,11 +31,11 @@ import java.io.IOException; public class ReadOnlyFirst { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_BAZ = "baz"; @SerializedName(SERIALIZED_NAME_BAZ) - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/SpecialModelName.java index db6241ec143..510b8a00318 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -31,7 +31,7 @@ import java.io.IOException; public class SpecialModelName { public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Tag.java index c80a102aef4..f889117e7f0 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/Tag.java @@ -31,11 +31,11 @@ import java.io.IOException; public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/User.java index bcc3e9164db..b551c8d25d2 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/retrofit/src/main/java/org/openapitools/client/model/User.java @@ -31,35 +31,35 @@ import java.io.IOException; public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_USERNAME = "username"; @SerializedName(SERIALIZED_NAME_USERNAME) - private String username = null; + private String username; public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; @SerializedName(SERIALIZED_NAME_FIRST_NAME) - private String firstName = null; + private String firstName; public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; @SerializedName(SERIALIZED_NAME_LAST_NAME) - private String lastName = null; + private String lastName; public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) - private String email = null; + private String email; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public static final String SERIALIZED_NAME_PHONE = "phone"; @SerializedName(SERIALIZED_NAME_PHONE) - private String phone = null; + private String phone; public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; @SerializedName(SERIALIZED_NAME_USER_STATUS) - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2-play24/build.gradle b/samples/client/petstore/java/retrofit2-play24/build.gradle index 714331ea310..667a9b283ec 100644 --- a/samples/client/petstore/java/retrofit2-play24/build.gradle +++ b/samples/client/petstore/java/retrofit2-play24/build.gradle @@ -98,7 +98,7 @@ ext { retrofit_version = "2.3.0" jackson_version = "2.6.6" play_version = "2.4.11" - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" junit_version = "4.12" json_fire_version = "1.8.0" } diff --git a/samples/client/petstore/java/retrofit2-play24/build.sbt b/samples/client/petstore/java/retrofit2-play24/build.sbt index d754ac539e1..ef9a3ad8103 100644 --- a/samples/client/petstore/java/retrofit2-play24/build.sbt +++ b/samples/client/petstore/java/retrofit2-play24/build.sbt @@ -16,7 +16,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-annotations" % "2.6.6" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.6.6" % "compile", "com.squareup.retrofit2" % "converter-jackson" % "2.3.0" % "compile", - "io.swagger" % "swagger-annotations" % "1.5.17" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "io.gsonfire" % "gson-fire" % "1.8.0" % "compile", "junit" % "junit" % "4.12" % "test", diff --git a/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md b/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md index 2d5d6ba1369..d529c54f05a 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/retrofit2-play24/docs/MapTest.md b/samples/client/petstore/java/retrofit2-play24/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/MapTest.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/retrofit2-play24/docs/PetApi.md b/samples/client/petstore/java/retrofit2-play24/docs/PetApi.md index 0005f283293..829565c5db1 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/PetApi.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/retrofit2-play24/docs/UserApi.md b/samples/client/petstore/java/retrofit2-play24/docs/UserApi.md index 795bb22a03f..170d5027e1a 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/retrofit2-play24/pom.xml b/samples/client/petstore/java/retrofit2-play24/pom.xml index 305b7e5e341..e73282392c4 100644 --- a/samples/client/petstore/java/retrofit2-play24/pom.xml +++ b/samples/client/petstore/java/retrofit2-play24/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -191,7 +189,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} com.squareup.retrofit2 @@ -224,7 +222,6 @@ gson-fire ${gson-fire-version} - com.squareup.retrofit2 @@ -256,8 +253,6 @@ play-java-ws_2.11 ${play-version} - - junit @@ -272,9 +267,9 @@ ${java.version} ${java.version} 1.8.0 - 1.5.18 - 2.6.6 - 2.4.11 + 1.5.21 + 2.6.6 + 2.4.11 2.3.0 1.0.1 4.12 diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/Pair.java index 18a0e96bfc7..0619e8c408b 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/Pair.java @@ -24,13 +24,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -44,8 +48,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/api/FakeApi.java index 5775f141eda..523420ec7f4 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/api/FakeApi.java @@ -123,16 +123,16 @@ public interface FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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 Call<Void> */ @retrofit2.http.FormUrlEncoded @@ -144,9 +144,9 @@ public interface FakeApi { /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/api/PetApi.java index 9e4ac61bd89..95720ad8fec 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/api/PetApi.java @@ -101,8 +101,8 @@ public interface PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @return Call<Void> */ @retrofit2.http.FormUrlEncoded @@ -115,14 +115,14 @@ public interface PetApi { * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return Call<ModelApiResponse> */ @retrofit2.http.Multipart @POST("pet/{petId}/uploadImage") F.Promise> uploadFile( - @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file") MultipartBody.Part file + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part MultipartBody.Part file ); /** @@ -130,13 +130,13 @@ public interface PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return Call<ModelApiResponse> */ @retrofit2.http.Multipart @POST("fake/{petId}/uploadImageWithRequiredFile") F.Promise> uploadFileWithRequiredFile( - @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("requiredFile") MultipartBody.Part requiredFile, @retrofit2.http.Part("additionalMetadata") String additionalMetadata + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part MultipartBody.Part requiredFile, @retrofit2.http.Part("additionalMetadata") String additionalMetadata ); } diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Animal.java index 96bdf028335..914a2588134 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Animal.java @@ -37,7 +37,7 @@ import javax.validation.Valid; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Capitalization.java index 93ab5bb6add..622bec62787 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Capitalization.java @@ -29,22 +29,22 @@ import javax.validation.Valid; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Cat.java index bed98769d85..a9cb91f0af7 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Cat.java @@ -30,7 +30,7 @@ import javax.validation.Valid; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Category.java index 7a342072469..07563857e8b 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Category.java @@ -29,10 +29,10 @@ import javax.validation.Valid; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ClassModel.java index 2f4d3aadd35..446a0c4b56f 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ClassModel.java @@ -30,7 +30,7 @@ import javax.validation.Valid; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Client.java index c6efc5a533e..82fecf7069a 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Client.java @@ -29,7 +29,7 @@ import javax.validation.Valid; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Dog.java index 29210dd068e..fee0559008f 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Dog.java @@ -30,7 +30,7 @@ import javax.validation.Valid; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/EnumArrays.java index 32a694a4de1..52bd8e7be93 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -66,7 +66,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/EnumTest.java index 2d835a86ed8..dce97a38c8f 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/EnumTest.java @@ -67,7 +67,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -107,7 +107,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -145,7 +145,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -183,7 +183,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/FormatTest.java index af6f12103e0..1f660809edb 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/FormatTest.java @@ -34,43 +34,43 @@ import javax.validation.Valid; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index dee87cf7fb4..e6c5e1b86a2 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -29,10 +29,10 @@ import javax.validation.Valid; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/MapTest.java index aca072ecc75..861dec2d06f 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/MapTest.java @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; import javax.validation.constraints.*; import javax.validation.Valid; @@ -77,7 +76,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -158,22 +157,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ - @Valid @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 264ea40e4c1..192e80d864a 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -35,10 +35,10 @@ import javax.validation.Valid; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Model200Response.java index bcdb67df9de..3a496beb0dc 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Model200Response.java @@ -30,10 +30,10 @@ import javax.validation.Valid; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 8eb69f7d469..66d8f67164f 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -29,13 +29,13 @@ import javax.validation.Valid; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ModelReturn.java index 7fd7e7c0cb4..861aa8cb445 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -30,7 +30,7 @@ import javax.validation.Valid; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Name.java index 16a25a54a29..fe8680f3963 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Name.java @@ -30,16 +30,16 @@ import javax.validation.Valid; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/NumberOnly.java index c3bada4d06f..0b8dbf2b0a2 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -30,7 +30,7 @@ import javax.validation.Valid; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Order.java index 969db460261..4c7a10e5684 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Order.java @@ -30,16 +30,16 @@ import javax.validation.Valid; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -79,7 +79,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/OuterComposite.java index f0bf1fbaab2..3fe27174b80 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -30,13 +30,13 @@ import javax.validation.Valid; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Pet.java index eda15f833c6..341de124475 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Pet.java @@ -33,13 +33,13 @@ import javax.validation.Valid; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList<>(); @@ -85,7 +85,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 882a50757ad..03502706b5b 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -29,10 +29,10 @@ import javax.validation.Valid; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/SpecialModelName.java index 0a73668a0ec..6c87458f501 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -29,7 +29,7 @@ import javax.validation.Valid; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Tag.java index ea23d8f46c2..0cee1356078 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/Tag.java @@ -29,10 +29,10 @@ import javax.validation.Valid; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/User.java index 5173076477d..5f62375eb77 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/org/openapitools/client/model/User.java @@ -29,28 +29,28 @@ import javax.validation.Valid; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2-play25/build.gradle b/samples/client/petstore/java/retrofit2-play25/build.gradle index 8197e915993..201ad458bbb 100644 --- a/samples/client/petstore/java/retrofit2-play25/build.gradle +++ b/samples/client/petstore/java/retrofit2-play25/build.gradle @@ -98,7 +98,7 @@ ext { retrofit_version = "2.3.0" jackson_version = "2.7.8" play_version = "2.5.14" - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" junit_version = "4.12" threetenbp_version = "1.3.5" json_fire_version = "1.8.0" diff --git a/samples/client/petstore/java/retrofit2-play25/build.sbt b/samples/client/petstore/java/retrofit2-play25/build.sbt index 49e5cc4d0e9..1f17d6bfc97 100644 --- a/samples/client/petstore/java/retrofit2-play25/build.sbt +++ b/samples/client/petstore/java/retrofit2-play25/build.sbt @@ -16,7 +16,7 @@ lazy val root = (project in file(".")). "com.fasterxml.jackson.core" % "jackson-annotations" % "2.7.8" % "compile", "com.fasterxml.jackson.core" % "jackson-databind" % "2.7.8" % "compile", "com.squareup.retrofit2" % "converter-jackson" % "2.3.0" % "compile", - "io.swagger" % "swagger-annotations" % "1.5.17" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "org.threeten" % "threetenbp" % "1.3.5" % "compile", "io.gsonfire" % "gson-fire" % "1.8.0" % "compile", diff --git a/samples/client/petstore/java/retrofit2-play25/docs/FakeApi.md b/samples/client/petstore/java/retrofit2-play25/docs/FakeApi.md index 2d5d6ba1369..d529c54f05a 100644 --- a/samples/client/petstore/java/retrofit2-play25/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2-play25/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/retrofit2-play25/docs/MapTest.md b/samples/client/petstore/java/retrofit2-play25/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/retrofit2-play25/docs/MapTest.md +++ b/samples/client/petstore/java/retrofit2-play25/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/retrofit2-play25/docs/PetApi.md b/samples/client/petstore/java/retrofit2-play25/docs/PetApi.md index 0005f283293..829565c5db1 100644 --- a/samples/client/petstore/java/retrofit2-play25/docs/PetApi.md +++ b/samples/client/petstore/java/retrofit2-play25/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/retrofit2-play25/docs/UserApi.md b/samples/client/petstore/java/retrofit2-play25/docs/UserApi.md index 795bb22a03f..170d5027e1a 100644 --- a/samples/client/petstore/java/retrofit2-play25/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2-play25/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/retrofit2-play25/pom.xml b/samples/client/petstore/java/retrofit2-play25/pom.xml index 9181b7d41b4..4051b0036d1 100644 --- a/samples/client/petstore/java/retrofit2-play25/pom.xml +++ b/samples/client/petstore/java/retrofit2-play25/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -191,7 +189,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} com.squareup.retrofit2 @@ -229,7 +227,6 @@ threetenbp ${threetenbp-version} - com.squareup.retrofit2 @@ -261,8 +258,6 @@ play-java-ws_2.11 ${play-version} - - junit @@ -277,11 +272,11 @@ ${java.version} ${java.version} 1.8.0 - 1.5.18 - 2.7.8 - 2.5.15 + 1.5.21 + 2.7.8 + 2.5.15 2.3.0 - 1.3.5 + 1.3.5 1.0.1 4.12 diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/Pair.java index 18a0e96bfc7..0619e8c408b 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/Pair.java @@ -24,13 +24,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -44,8 +48,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/api/FakeApi.java index 1a9ea5cbba4..0c4b1f21257 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/api/FakeApi.java @@ -123,16 +123,16 @@ public interface FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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 Call<Void> */ @retrofit2.http.FormUrlEncoded @@ -144,9 +144,9 @@ public interface FakeApi { /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/api/PetApi.java index 75fff9f67c4..98c3b6b42bd 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/api/PetApi.java @@ -101,8 +101,8 @@ public interface PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @return Call<Void> */ @retrofit2.http.FormUrlEncoded @@ -115,14 +115,14 @@ public interface PetApi { * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return Call<ModelApiResponse> */ @retrofit2.http.Multipart @POST("pet/{petId}/uploadImage") CompletionStage> uploadFile( - @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file") MultipartBody.Part file + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part MultipartBody.Part file ); /** @@ -130,13 +130,13 @@ public interface PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return Call<ModelApiResponse> */ @retrofit2.http.Multipart @POST("fake/{petId}/uploadImageWithRequiredFile") CompletionStage> uploadFileWithRequiredFile( - @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("requiredFile") MultipartBody.Part requiredFile, @retrofit2.http.Part("additionalMetadata") String additionalMetadata + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part MultipartBody.Part requiredFile, @retrofit2.http.Part("additionalMetadata") String additionalMetadata ); } diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Animal.java index 96bdf028335..914a2588134 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Animal.java @@ -37,7 +37,7 @@ import javax.validation.Valid; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Capitalization.java index 93ab5bb6add..622bec62787 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Capitalization.java @@ -29,22 +29,22 @@ import javax.validation.Valid; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Cat.java index bed98769d85..a9cb91f0af7 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Cat.java @@ -30,7 +30,7 @@ import javax.validation.Valid; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Category.java index 7a342072469..07563857e8b 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Category.java @@ -29,10 +29,10 @@ import javax.validation.Valid; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ClassModel.java index 2f4d3aadd35..446a0c4b56f 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ClassModel.java @@ -30,7 +30,7 @@ import javax.validation.Valid; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Client.java index c6efc5a533e..82fecf7069a 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Client.java @@ -29,7 +29,7 @@ import javax.validation.Valid; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Dog.java index 29210dd068e..fee0559008f 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Dog.java @@ -30,7 +30,7 @@ import javax.validation.Valid; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/EnumArrays.java index 32a694a4de1..52bd8e7be93 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -66,7 +66,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/EnumTest.java index 2d835a86ed8..dce97a38c8f 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/EnumTest.java @@ -67,7 +67,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -107,7 +107,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -145,7 +145,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -183,7 +183,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/FormatTest.java index 0b0d2915632..40086f0cf6d 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/FormatTest.java @@ -34,43 +34,43 @@ import javax.validation.Valid; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index dee87cf7fb4..e6c5e1b86a2 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -29,10 +29,10 @@ import javax.validation.Valid; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/MapTest.java index aca072ecc75..861dec2d06f 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/MapTest.java @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; import javax.validation.constraints.*; import javax.validation.Valid; @@ -77,7 +76,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -158,22 +157,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ - @Valid @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 212fd13d413..230369158c0 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -35,10 +35,10 @@ import javax.validation.Valid; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Model200Response.java index bcdb67df9de..3a496beb0dc 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Model200Response.java @@ -30,10 +30,10 @@ import javax.validation.Valid; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 8eb69f7d469..66d8f67164f 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -29,13 +29,13 @@ import javax.validation.Valid; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ModelReturn.java index 7fd7e7c0cb4..861aa8cb445 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -30,7 +30,7 @@ import javax.validation.Valid; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Name.java index 16a25a54a29..fe8680f3963 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Name.java @@ -30,16 +30,16 @@ import javax.validation.Valid; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/NumberOnly.java index c3bada4d06f..0b8dbf2b0a2 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -30,7 +30,7 @@ import javax.validation.Valid; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Order.java index e109aaa7cbb..d15cd79db0b 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Order.java @@ -30,16 +30,16 @@ import javax.validation.Valid; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -79,7 +79,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/OuterComposite.java index f0bf1fbaab2..3fe27174b80 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -30,13 +30,13 @@ import javax.validation.Valid; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Pet.java index eda15f833c6..341de124475 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Pet.java @@ -33,13 +33,13 @@ import javax.validation.Valid; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList<>(); @@ -85,7 +85,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 882a50757ad..03502706b5b 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -29,10 +29,10 @@ import javax.validation.Valid; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/SpecialModelName.java index 0a73668a0ec..6c87458f501 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -29,7 +29,7 @@ import javax.validation.Valid; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Tag.java index ea23d8f46c2..0cee1356078 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/Tag.java @@ -29,10 +29,10 @@ import javax.validation.Valid; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/User.java index 5173076477d..5f62375eb77 100644 --- a/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/retrofit2-play25/src/main/java/org/openapitools/client/model/User.java @@ -29,28 +29,28 @@ import javax.validation.Valid; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2-play26/.gitignore b/samples/client/petstore/java/retrofit2-play26/.gitignore new file mode 100644 index 00000000000..a530464afa1 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/.gitignore @@ -0,0 +1,21 @@ +*.class + +# Mobile Tools for Java (J2ME) +.mtj.tmp/ + +# Package Files # +*.jar +*.war +*.ear + +# exclude jar for gradle wrapper +!gradle/wrapper/*.jar + +# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml +hs_err_pid* + +# build files +**/target +target +.gradle +build diff --git a/samples/client/petstore/java/retrofit2-play26/.openapi-generator-ignore b/samples/client/petstore/java/retrofit2-play26/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/.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/retrofit2-play26/.openapi-generator/VERSION b/samples/client/petstore/java/retrofit2-play26/.openapi-generator/VERSION new file mode 100644 index 00000000000..afa63656064 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/java/retrofit2-play26/.travis.yml b/samples/client/petstore/java/retrofit2-play26/.travis.yml new file mode 100644 index 00000000000..80a7f2fc66c --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/.travis.yml @@ -0,0 +1,17 @@ +# +# Generated by: https://openapi-generator.tech +# +language: java +jdk: + - oraclejdk8 + - oraclejdk7 +before_install: + # ensure gradlew has proper permission + - chmod a+x ./gradlew +script: + # test using maven + - mvn test + # uncomment below to test using gradle + # - gradle test + # uncomment below to test using sbt + # - sbt test diff --git a/samples/client/petstore/java/retrofit2-play26/README.md b/samples/client/petstore/java/retrofit2-play26/README.md new file mode 100644 index 00000000000..b15898583f7 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/README.md @@ -0,0 +1,39 @@ +# petstore-java-client-retrofit2-play26 + +## Requirements + +Building the API client library requires [Maven](https://maven.apache.org/) to be installed. + +## Installation & Usage + +To install the API client library to your local Maven repository, simply execute: + +```shell +mvn install +``` + +To deploy it to a remote Maven repository instead, configure the settings of the repository and execute: + +```shell +mvn deploy +``` + +Refer to the [official documentation](https://maven.apache.org/plugins/maven-deploy-plugin/usage.html) for more information. + +After the client library is installed/deployed, you can use it in your Maven project by adding the following to your *pom.xml*: + +```xml + + org.openapitools + petstore-java-client-retrofit2-play26 + 1.0.0 + compile + + +``` + +## Author + + + + diff --git a/samples/client/petstore/java/retrofit2-play26/build.gradle b/samples/client/petstore/java/retrofit2-play26/build.gradle new file mode 100644 index 00000000000..dd9ded7db04 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/build.gradle @@ -0,0 +1,125 @@ +apply plugin: 'idea' +apply plugin: 'eclipse' + +group = 'org.openapitools' +version = '1.0.0' + +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.3.+' + classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' + } +} + +repositories { + jcenter() +} + + +if(hasProperty('target') && target == 'android') { + + apply plugin: 'com.android.library' + apply plugin: 'com.github.dcendents.android-maven' + + android { + compileSdkVersion 25 + buildToolsVersion '25.0.2' + defaultConfig { + minSdkVersion 14 + targetSdkVersion 25 + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + + // Rename the aar correctly + libraryVariants.all { variant -> + variant.outputs.each { output -> + def outputFile = output.outputFile + if (outputFile != null && outputFile.name.endsWith('.aar')) { + def fileName = "${project.name}-${variant.baseName}-${version}.aar" + output.outputFile = new File(outputFile.parent, fileName) + } + } + } + + dependencies { + provided 'javax.annotation:jsr250-api:1.0' + } + } + + afterEvaluate { + android.libraryVariants.all { variant -> + def task = project.tasks.create "jar${variant.name.capitalize()}", Jar + task.description = "Create jar artifact for ${variant.name}" + task.dependsOn variant.javaCompile + task.from variant.javaCompile.destinationDir + task.destinationDir = project.file("${project.buildDir}/outputs/jar") + task.archiveName = "${project.name}-${variant.baseName}-${version}.jar" + artifacts.add('archives', task); + } + } + + task sourcesJar(type: Jar) { + from android.sourceSets.main.java.srcDirs + classifier = 'sources' + } + + artifacts { + archives sourcesJar + } + +} else { + + apply plugin: 'java' + apply plugin: 'maven' + + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + + install { + repositories.mavenInstaller { + pom.artifactId = 'petstore-java-client-retrofit2-play26' + } + } + + task execute(type:JavaExec) { + main = System.getProperty('mainClass') + classpath = sourceSets.main.runtimeClasspath + } +} + +ext { + oltu_version = "1.0.1" + retrofit_version = "2.3.0" + jackson_version = "2.8.10" + play_version = "2.6.7" + swagger_annotations_version = "1.5.21" + junit_version = "4.12" + threetenbp_version = "1.3.5" + json_fire_version = "1.8.0" +} + +dependencies { + compile "com.squareup.retrofit2:retrofit:$retrofit_version" + compile "com.squareup.retrofit2:converter-scalars:$retrofit_version" + compile "com.squareup.retrofit2:converter-gson:$retrofit_version" + compile "io.swagger:swagger-annotations:$swagger_annotations_version" + compile ("org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:$oltu_version"){ + exclude group:'org.apache.oltu.oauth2' , module: 'org.apache.oltu.oauth2.common' + } + compile "io.gsonfire:gson-fire:$json_fire_version" + compile "org.threeten:threetenbp:$threetenbp_version" + compile "com.typesafe.play:play-ahc-ws_2.12:$play_version" + compile "javax.validation:validation-api:1.1.0.Final" + compile "com.squareup.retrofit2:converter-jackson:$retrofit_version" + compile "com.fasterxml.jackson.core:jackson-core:$jackson_version" + compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version" + compile "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version" + + testCompile "junit:junit:$junit_version" +} diff --git a/samples/client/petstore/java/retrofit2-play26/build.sbt b/samples/client/petstore/java/retrofit2-play26/build.sbt new file mode 100644 index 00000000000..6ef49aa26d9 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/build.sbt @@ -0,0 +1,27 @@ +lazy val root = (project in file(".")). + settings( + organization := "org.openapitools", + name := "petstore-java-client-retrofit2-play26", + version := "1.0.0", + scalaVersion := "2.11.4", + scalacOptions ++= Seq("-feature"), + javacOptions in compile ++= Seq("-Xlint:deprecation"), + publishArtifact in (Compile, packageDoc) := false, + resolvers += Resolver.mavenLocal, + libraryDependencies ++= Seq( + "com.squareup.retrofit2" % "retrofit" % "2.3.0" % "compile", + "com.squareup.retrofit2" % "converter-scalars" % "2.3.0" % "compile", + "com.typesafe.play" % "play-ahc-ws_2.12" % "2.6.7" % "compile", + "javax.validation" % "validation-api" % "1.1.0.Final" % "compile", + "com.fasterxml.jackson.core" % "jackson-core" % "2.8.10" % "compile", + "com.fasterxml.jackson.core" % "jackson-annotations" % "2.8.10" % "compile", + "com.fasterxml.jackson.core" % "jackson-databind" % "2.8.10" % "compile", + "com.squareup.retrofit2" % "converter-jackson" % "2.3.0" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", + "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", + "org.threeten" % "threetenbp" % "1.3.5" % "compile", + "io.gsonfire" % "gson-fire" % "1.8.0" % "compile", + "junit" % "junit" % "4.12" % "test", + "com.novocode" % "junit-interface" % "0.11" % "test" + ) + ) diff --git a/samples/client/petstore/java/retrofit2-play26/docs/AdditionalPropertiesClass.md b/samples/client/petstore/java/retrofit2-play26/docs/AdditionalPropertiesClass.md new file mode 100644 index 00000000000..0437c4dd8cc --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/AdditionalPropertiesClass.md @@ -0,0 +1,11 @@ + +# AdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapProperty** | **Map<String, String>** | | [optional] +**mapOfMapProperty** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/Animal.md b/samples/client/petstore/java/retrofit2-play26/docs/Animal.md new file mode 100644 index 00000000000..b3f325c3524 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/Animal.md @@ -0,0 +1,11 @@ + +# Animal + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**className** | **String** | | +**color** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/AnimalFarm.md b/samples/client/petstore/java/retrofit2-play26/docs/AnimalFarm.md new file mode 100644 index 00000000000..c7c7f1ddcce --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/AnimalFarm.md @@ -0,0 +1,9 @@ + +# AnimalFarm + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/AnotherFakeApi.md b/samples/client/petstore/java/retrofit2-play26/docs/AnotherFakeApi.md new file mode 100644 index 00000000000..c44a064755c --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/AnotherFakeApi.md @@ -0,0 +1,54 @@ +# 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** +> Client call123testSpecialTags(client) + +To test special tags + +To test special tags and operation ID starting with number + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.AnotherFakeApi; + + +AnotherFakeApi apiInstance = new AnotherFakeApi(); +Client client = new Client(); // Client | client model +try { + Client result = apiInstance.call123testSpecialTags(client); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling AnotherFakeApi#call123testSpecialTags"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/ArrayOfArrayOfNumberOnly.md b/samples/client/petstore/java/retrofit2-play26/docs/ArrayOfArrayOfNumberOnly.md new file mode 100644 index 00000000000..77292549927 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/ArrayOfArrayOfNumberOnly.md @@ -0,0 +1,10 @@ + +# ArrayOfArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayArrayNumber** | [**List<List<BigDecimal>>**](List.md) | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/ArrayOfNumberOnly.md b/samples/client/petstore/java/retrofit2-play26/docs/ArrayOfNumberOnly.md new file mode 100644 index 00000000000..e8cc4cd36dc --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/ArrayOfNumberOnly.md @@ -0,0 +1,10 @@ + +# ArrayOfNumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayNumber** | [**List<BigDecimal>**](BigDecimal.md) | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/ArrayTest.md b/samples/client/petstore/java/retrofit2-play26/docs/ArrayTest.md new file mode 100644 index 00000000000..9feee16427f --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/ArrayTest.md @@ -0,0 +1,12 @@ + +# ArrayTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**arrayOfString** | **List<String>** | | [optional] +**arrayArrayOfInteger** | [**List<List<Long>>**](List.md) | | [optional] +**arrayArrayOfModel** | [**List<List<ReadOnlyFirst>>**](List.md) | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/Capitalization.md b/samples/client/petstore/java/retrofit2-play26/docs/Capitalization.md new file mode 100644 index 00000000000..0f3064c1996 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/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] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/Cat.md b/samples/client/petstore/java/retrofit2-play26/docs/Cat.md new file mode 100644 index 00000000000..6e9f71ce7dd --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/Cat.md @@ -0,0 +1,10 @@ + +# Cat + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**declawed** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/Category.md b/samples/client/petstore/java/retrofit2-play26/docs/Category.md new file mode 100644 index 00000000000..e2df0803278 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/Category.md @@ -0,0 +1,11 @@ + +# Category + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/ClassModel.md b/samples/client/petstore/java/retrofit2-play26/docs/ClassModel.md new file mode 100644 index 00000000000..64f880c8786 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/ClassModel.md @@ -0,0 +1,10 @@ + +# ClassModel + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**propertyClass** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/Client.md b/samples/client/petstore/java/retrofit2-play26/docs/Client.md new file mode 100644 index 00000000000..5c490ea166c --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/Client.md @@ -0,0 +1,10 @@ + +# Client + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**client** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/Dog.md b/samples/client/petstore/java/retrofit2-play26/docs/Dog.md new file mode 100644 index 00000000000..ac7cea323ff --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/Dog.md @@ -0,0 +1,10 @@ + +# Dog + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**breed** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/EnumArrays.md b/samples/client/petstore/java/retrofit2-play26/docs/EnumArrays.md new file mode 100644 index 00000000000..4dddc0bfd27 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/EnumArrays.md @@ -0,0 +1,27 @@ + +# EnumArrays + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justSymbol** | [**JustSymbolEnum**](#JustSymbolEnum) | | [optional] +**arrayEnum** | [**List<ArrayEnumEnum>**](#List<ArrayEnumEnum>) | | [optional] + + + +## Enum: JustSymbolEnum +Name | Value +---- | ----- +GREATER_THAN_OR_EQUAL_TO | ">=" +DOLLAR | "$" + + + +## Enum: List<ArrayEnumEnum> +Name | Value +---- | ----- +FISH | "fish" +CRAB | "crab" + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/EnumClass.md b/samples/client/petstore/java/retrofit2-play26/docs/EnumClass.md new file mode 100644 index 00000000000..c746edc3cb1 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/EnumClass.md @@ -0,0 +1,14 @@ + +# EnumClass + +## Enum + + +* `_ABC` (value: `"_abc"`) + +* `_EFG` (value: `"-efg"`) + +* `_XYZ_` (value: `"(xyz)"`) + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/EnumTest.md b/samples/client/petstore/java/retrofit2-play26/docs/EnumTest.md new file mode 100644 index 00000000000..ca048bcc515 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/EnumTest.md @@ -0,0 +1,48 @@ + +# EnumTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**enumString** | [**EnumStringEnum**](#EnumStringEnum) | | [optional] +**enumStringRequired** | [**EnumStringRequiredEnum**](#EnumStringRequiredEnum) | | +**enumInteger** | [**EnumIntegerEnum**](#EnumIntegerEnum) | | [optional] +**enumNumber** | [**EnumNumberEnum**](#EnumNumberEnum) | | [optional] +**outerEnum** | [**OuterEnum**](OuterEnum.md) | | [optional] + + + +## Enum: EnumStringEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + + +## Enum: EnumStringRequiredEnum +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" +EMPTY | "" + + + +## Enum: EnumIntegerEnum +Name | Value +---- | ----- +NUMBER_1 | 1 +NUMBER_MINUS_1 | -1 + + + +## Enum: EnumNumberEnum +Name | Value +---- | ----- +NUMBER_1_DOT_1 | 1.1 +NUMBER_MINUS_1_DOT_2 | -1.2 + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/FakeApi.md b/samples/client/petstore/java/retrofit2-play26/docs/FakeApi.md new file mode 100644 index 00000000000..d529c54f05a --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/FakeApi.md @@ -0,0 +1,555 @@ +# 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 +[**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** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Boolean body = true; // Boolean | Input boolean as post body +try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **Boolean**| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(outerComposite) + + + +Test serialization of object with outer number type + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +OuterComposite outerComposite = new OuterComposite(); // OuterComposite | Input composite as post body +try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(outerComposite); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **outerComposite** | [**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**: */* + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body +try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | **BigDecimal**| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: */* + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String body = "body_example"; // String | Input string as post body +try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + e.printStackTrace(); +} +``` + +### 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**: */* + + +# **testBodyWithFileSchema** +> testBodyWithFileSchema(fileSchemaTestClass) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +FileSchemaTestClass fileSchemaTestClass = new FileSchemaTestClass(); // FileSchemaTestClass | +try { + apiInstance.testBodyWithFileSchema(fileSchemaTestClass); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithFileSchema"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **fileSchemaTestClass** | [**FileSchemaTestClass**](FileSchemaTestClass.md)| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +# **testBodyWithQueryParams** +> testBodyWithQueryParams(query, user) + + + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String query = "query_example"; // String | +User user = new User(); // User | +try { + apiInstance.testBodyWithQueryParams(query, user); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testBodyWithQueryParams"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **query** | **String**| | + **user** | [**User**](User.md)| | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +# **testClientModel** +> Client testClientModel(client) + +To test \"client\" model + +To test \"client\" model + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Client client = new Client(); // Client | client model +try { + Client result = apiInstance.testClientModel(client); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testClientModel"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**Client**](Client.md)| client model | + +### Return type + +[**Client**](Client.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: application/json + + +# **testEndpointParameters** +> testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback) + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + +### 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.api.FakeApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure HTTP basic authorization: http_basic_test +HttpBasicAuth http_basic_test = (HttpBasicAuth) defaultClient.getAuthentication("http_basic_test"); +http_basic_test.setUsername("YOUR USERNAME"); +http_basic_test.setPassword("YOUR PASSWORD"); + +FakeApi apiInstance = new FakeApi(); +BigDecimal number = new BigDecimal(); // BigDecimal | None +Double _double = 3.4D; // Double | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None +byte[] _byte = null; // byte[] | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None +LocalDate date = new LocalDate(); // LocalDate | None +OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None +try { + apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEndpointParameters"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] + +### Return type + +null (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 + + +# **testEnumParameters** +> testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString) + +To test enum parameters + +To test enum parameters + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) +String enumHeaderString = "-efg"; // String | Header parameter enum test (string) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) +String enumQueryString = "-efg"; // String | Query parameter enum test (string) +Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) +Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) +List enumFormStringArray = "$"; // List | Form parameter enum test (string array) +String enumFormString = "-efg"; // String | Form parameter enum test (string) +try { + apiInstance.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testEnumParameters"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **enumHeaderStringArray** | [**List<String>**](String.md)| Header parameter enum test (string array) | [optional] [enum: >, $] + **enumHeaderString** | **String**| Header parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] + **enumQueryStringArray** | [**List<String>**](String.md)| Query parameter enum test (string array) | [optional] [enum: >, $] + **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] + **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] + **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] + **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + + +# **testInlineAdditionalProperties** +> testInlineAdditionalProperties(requestBody) + +test inline additionalProperties + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Map requestBody = new HashMap(); // Map | request body +try { + apiInstance.testInlineAdditionalProperties(requestBody); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testInlineAdditionalProperties"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **requestBody** | [**Map<String, String>**](String.md)| request body | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + + +# **testJsonFormData** +> testJsonFormData(param, param2) + +test json serialization of form data + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 +try { + apiInstance.testJsonFormData(param, param2); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#testJsonFormData"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **param** | **String**| field1 | + **param2** | **String**| field2 | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/FakeClassnameTags123Api.md b/samples/client/petstore/java/retrofit2-play26/docs/FakeClassnameTags123Api.md new file mode 100644 index 00000000000..d805d10a830 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/FakeClassnameTags123Api.md @@ -0,0 +1,64 @@ +# 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** +> Client testClassname(client) + +To test class name in snake case + +To test class name in snake case + +### 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.api.FakeClassnameTags123Api; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure API key authorization: api_key_query +ApiKeyAuth api_key_query = (ApiKeyAuth) defaultClient.getAuthentication("api_key_query"); +api_key_query.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key_query.setApiKeyPrefix("Token"); + +FakeClassnameTags123Api apiInstance = new FakeClassnameTags123Api(); +Client client = new Client(); // Client | client model +try { + Client result = apiInstance.testClassname(client); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeClassnameTags123Api#testClassname"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **client** | [**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 + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/FileSchemaTestClass.md b/samples/client/petstore/java/retrofit2-play26/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..95ba647df6f --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/FileSchemaTestClass.md @@ -0,0 +1,11 @@ + +# FileSchemaTestClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**java.io.File**](java.io.File.md) | | [optional] +**files** | [**List<java.io.File>**](java.io.File.md) | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/FormatTest.md b/samples/client/petstore/java/retrofit2-play26/docs/FormatTest.md new file mode 100644 index 00000000000..986f70236e1 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/FormatTest.md @@ -0,0 +1,22 @@ + +# FormatTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**integer** | **Integer** | | [optional] +**int32** | **Integer** | | [optional] +**int64** | **Long** | | [optional] +**number** | [**BigDecimal**](BigDecimal.md) | | +**_float** | **Float** | | [optional] +**_double** | **Double** | | [optional] +**string** | **String** | | [optional] +**_byte** | **byte[]** | | +**binary** | [**File**](File.md) | | [optional] +**date** | [**LocalDate**](LocalDate.md) | | +**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**uuid** | [**UUID**](UUID.md) | | [optional] +**password** | **String** | | + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/HasOnlyReadOnly.md b/samples/client/petstore/java/retrofit2-play26/docs/HasOnlyReadOnly.md new file mode 100644 index 00000000000..c1d0aac5672 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/HasOnlyReadOnly.md @@ -0,0 +1,11 @@ + +# HasOnlyReadOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] +**foo** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/MapTest.md b/samples/client/petstore/java/retrofit2-play26/docs/MapTest.md new file mode 100644 index 00000000000..c8387ad9af2 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/MapTest.md @@ -0,0 +1,21 @@ + +# MapTest + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] +**mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] +**directMap** | **Map<String, Boolean>** | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] + + + +## Enum: Map<String, InnerEnum> +Name | Value +---- | ----- +UPPER | "UPPER" +LOWER | "lower" + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/MixedPropertiesAndAdditionalPropertiesClass.md b/samples/client/petstore/java/retrofit2-play26/docs/MixedPropertiesAndAdditionalPropertiesClass.md new file mode 100644 index 00000000000..b12e2cd70e6 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/MixedPropertiesAndAdditionalPropertiesClass.md @@ -0,0 +1,12 @@ + +# MixedPropertiesAndAdditionalPropertiesClass + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**uuid** | [**UUID**](UUID.md) | | [optional] +**dateTime** | [**OffsetDateTime**](OffsetDateTime.md) | | [optional] +**map** | [**Map<String, Animal>**](Animal.md) | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/Model200Response.md b/samples/client/petstore/java/retrofit2-play26/docs/Model200Response.md new file mode 100644 index 00000000000..5b3a9a0e46d --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/Model200Response.md @@ -0,0 +1,11 @@ + +# Model200Response + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | [optional] +**propertyClass** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/ModelApiResponse.md b/samples/client/petstore/java/retrofit2-play26/docs/ModelApiResponse.md new file mode 100644 index 00000000000..3eec8686cc9 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/ModelApiResponse.md @@ -0,0 +1,12 @@ + +# ModelApiResponse + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **Integer** | | [optional] +**type** | **String** | | [optional] +**message** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/ModelReturn.md b/samples/client/petstore/java/retrofit2-play26/docs/ModelReturn.md new file mode 100644 index 00000000000..a679b04953e --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/ModelReturn.md @@ -0,0 +1,10 @@ + +# ModelReturn + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**_return** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/Name.md b/samples/client/petstore/java/retrofit2-play26/docs/Name.md new file mode 100644 index 00000000000..64060f82de4 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/Name.md @@ -0,0 +1,13 @@ + +# Name + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **Integer** | | +**snakeCase** | **Integer** | | [optional] +**property** | **String** | | [optional] +**_123number** | **Integer** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/NumberOnly.md b/samples/client/petstore/java/retrofit2-play26/docs/NumberOnly.md new file mode 100644 index 00000000000..a3feac7fadc --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/NumberOnly.md @@ -0,0 +1,10 @@ + +# NumberOnly + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**justNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/Order.md b/samples/client/petstore/java/retrofit2-play26/docs/Order.md new file mode 100644 index 00000000000..268c617d1ff --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/Order.md @@ -0,0 +1,24 @@ + +# Order + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**petId** | **Long** | | [optional] +**quantity** | **Integer** | | [optional] +**shipDate** | [**OffsetDateTime**](OffsetDateTime.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/retrofit2-play26/docs/OuterComposite.md b/samples/client/petstore/java/retrofit2-play26/docs/OuterComposite.md new file mode 100644 index 00000000000..3f5a633c998 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/OuterComposite.md @@ -0,0 +1,12 @@ + +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/OuterEnum.md b/samples/client/petstore/java/retrofit2-play26/docs/OuterEnum.md new file mode 100644 index 00000000000..ed2cb206789 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/OuterEnum.md @@ -0,0 +1,14 @@ + +# OuterEnum + +## Enum + + +* `PLACED` (value: `"placed"`) + +* `APPROVED` (value: `"approved"`) + +* `DELIVERED` (value: `"delivered"`) + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/Pet.md b/samples/client/petstore/java/retrofit2-play26/docs/Pet.md new file mode 100644 index 00000000000..5b63109ef92 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/Pet.md @@ -0,0 +1,24 @@ + +# Pet + +## 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/retrofit2-play26/docs/PetApi.md b/samples/client/petstore/java/retrofit2-play26/docs/PetApi.md new file mode 100644 index 00000000000..829565c5db1 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/PetApi.md @@ -0,0 +1,494 @@ +# 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** +> addPet(pet) + +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.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.addPet(pet); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#addPet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + + +# **deletePet** +> 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.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 56L; // Long | Pet id to delete +String apiKey = "apiKey_example"; // String | +try { + apiInstance.deletePet(petId, apiKey); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#deletePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| Pet id to delete | + **apiKey** | **String**| | [optional] + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **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.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +List status = Arrays.asList("available"); // List | Status values that need to be considered for filter +try { + List result = apiInstance.findPetsByStatus(status); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByStatus"); + e.printStackTrace(); +} +``` + +### 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 + + +# **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.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +List tags = Arrays.asList(); // List | Tags to filter by +try { + List result = apiInstance.findPetsByTags(tags); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#findPetsByTags"); + e.printStackTrace(); +} +``` + +### 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 + + +# **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.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure API key authorization: api_key +ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); +api_key.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.setApiKeyPrefix("Token"); + +PetApi apiInstance = new PetApi(); +Long petId = 56L; // Long | ID of pet to return +try { + Pet result = apiInstance.getPetById(petId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#getPetById"); + e.printStackTrace(); +} +``` + +### 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 + + +# **updatePet** +> updatePet(pet) + +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.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Pet pet = new Pet(); // Pet | Pet object that needs to be added to the store +try { + apiInstance.updatePet(pet); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePet"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + +### Return type + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/json, application/xml + - **Accept**: Not defined + + +# **updatePetWithForm** +> 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.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 56L; // Long | ID of pet that needs to be updated +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet +try { + apiInstance.updatePetWithForm(petId, name, status); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#updatePetWithForm"); + e.printStackTrace(); +} +``` + +### 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 + +null (empty response body) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **Accept**: Not defined + + +# **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.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 56L; // Long | ID of pet to update +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server +File file = new File("/path/to/file"); // File | file to upload +try { + ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFile"); + e.printStackTrace(); +} +``` + +### 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 + + +# **uploadFileWithRequiredFile** +> ModelApiResponse uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata) + +uploads an image (required) + +### 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.api.PetApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure OAuth2 access token for authorization: petstore_auth +OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); +petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); + +PetApi apiInstance = new PetApi(); +Long petId = 56L; // Long | ID of pet to update +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server +try { + ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling PetApi#uploadFileWithRequiredFile"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Long**| ID of pet to update | + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + +### Return type + +[**ModelApiResponse**](ModelApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: multipart/form-data + - **Accept**: application/json + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/ReadOnlyFirst.md b/samples/client/petstore/java/retrofit2-play26/docs/ReadOnlyFirst.md new file mode 100644 index 00000000000..426b7cde95a --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/ReadOnlyFirst.md @@ -0,0 +1,11 @@ + +# ReadOnlyFirst + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bar** | **String** | | [optional] +**baz** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/SpecialModelName.md b/samples/client/petstore/java/retrofit2-play26/docs/SpecialModelName.md new file mode 100644 index 00000000000..6cf53410ace --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/SpecialModelName.md @@ -0,0 +1,10 @@ + +# SpecialModelName + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**$specialPropertyName** | **Long** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/StoreApi.md b/samples/client/petstore/java/retrofit2-play26/docs/StoreApi.md new file mode 100644 index 00000000000..06886f6d565 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/StoreApi.md @@ -0,0 +1,195 @@ +# 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** +> 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.ApiException; +//import org.openapitools.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +String orderId = "orderId_example"; // String | ID of the order that needs to be deleted +try { + apiInstance.deleteOrder(orderId); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#deleteOrder"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **orderId** | **String**| ID of the order that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **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.api.StoreApi; + +ApiClient defaultClient = Configuration.getDefaultApiClient(); + +// Configure API key authorization: api_key +ApiKeyAuth api_key = (ApiKeyAuth) defaultClient.getAuthentication("api_key"); +api_key.setApiKey("YOUR API KEY"); +// Uncomment the following line to set a prefix for the API key, e.g. "Token" (defaults to null) +//api_key.setApiKeyPrefix("Token"); + +StoreApi apiInstance = new StoreApi(); +try { + Map result = apiInstance.getInventory(); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getInventory"); + e.printStackTrace(); +} +``` + +### 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 + + +# **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.ApiException; +//import org.openapitools.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +Long orderId = 56L; // Long | ID of pet that needs to be fetched +try { + Order result = apiInstance.getOrderById(orderId); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#getOrderById"); + e.printStackTrace(); +} +``` + +### 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 + + +# **placeOrder** +> Order placeOrder(order) + +Place an order for a pet + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.StoreApi; + + +StoreApi apiInstance = new StoreApi(); +Order order = new Order(); // Order | order placed for purchasing the pet +try { + Order result = apiInstance.placeOrder(order); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling StoreApi#placeOrder"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **order** | [**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 + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/StringBooleanMap.md b/samples/client/petstore/java/retrofit2-play26/docs/StringBooleanMap.md new file mode 100644 index 00000000000..cac7afc80e0 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/StringBooleanMap.md @@ -0,0 +1,9 @@ + +# StringBooleanMap + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/Tag.md b/samples/client/petstore/java/retrofit2-play26/docs/Tag.md new file mode 100644 index 00000000000..de6814b55d5 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/Tag.md @@ -0,0 +1,11 @@ + +# Tag + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **Long** | | [optional] +**name** | **String** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play26/docs/User.md b/samples/client/petstore/java/retrofit2-play26/docs/User.md new file mode 100644 index 00000000000..8b6753dd284 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/User.md @@ -0,0 +1,17 @@ + +# User + +## 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/retrofit2-play26/docs/UserApi.md b/samples/client/petstore/java/retrofit2-play26/docs/UserApi.md new file mode 100644 index 00000000000..170d5027e1a --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/docs/UserApi.md @@ -0,0 +1,360 @@ +# 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** +> createUser(user) + +Create user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +User user = new User(); // User | Created user object +try { + apiInstance.createUser(user); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**User**](User.md)| Created user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **createUsersWithArrayInput** +> createUsersWithArrayInput(user) + +Creates list of users with given input array + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +List user = Arrays.asList(null); // List | List of user object +try { + apiInstance.createUsersWithArrayInput(user); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithArrayInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](List.md)| List of user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **createUsersWithListInput** +> createUsersWithListInput(user) + +Creates list of users with given input array + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +List user = Arrays.asList(null); // List | List of user object +try { + apiInstance.createUsersWithListInput(user); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#createUsersWithListInput"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **user** | [**List<User>**](List.md)| List of user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **deleteUser** +> deleteUser(username) + +Delete user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be deleted +try { + apiInstance.deleteUser(username); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#deleteUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| The name that needs to be deleted | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **getUserByName** +> User getUserByName(username) + +Get user by user name + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The name that needs to be fetched. Use user1 for testing. +try { + User result = apiInstance.getUserByName(username); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#getUserByName"); + e.printStackTrace(); +} +``` + +### 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 + + +# **loginUser** +> String loginUser(username, password) + +Logs user into the system + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | The user name for login +String password = "password_example"; // String | The password for login in clear text +try { + String result = apiInstance.loginUser(username, password); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#loginUser"); + e.printStackTrace(); +} +``` + +### 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 + + +# **logoutUser** +> logoutUser() + +Logs out current logged in user session + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +try { + apiInstance.logoutUser(); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#logoutUser"); + e.printStackTrace(); +} +``` + +### Parameters +This endpoint does not need any parameter. + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **updateUser** +> updateUser(username, user) + +Updated user + +This can only be done by the logged in user. + +### Example +```java +// Import classes: +//import org.openapitools.client.ApiException; +//import org.openapitools.client.api.UserApi; + + +UserApi apiInstance = new UserApi(); +String username = "username_example"; // String | name that need to be deleted +User user = new User(); // User | Updated user object +try { + apiInstance.updateUser(username, user); +} catch (ApiException e) { + System.err.println("Exception when calling UserApi#updateUser"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **username** | **String**| name that need to be deleted | + **user** | [**User**](User.md)| Updated user object | + +### Return type + +null (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + diff --git a/samples/client/petstore/java/retrofit2-play26/git_push.sh b/samples/client/petstore/java/retrofit2-play26/git_push.sh new file mode 100644 index 00000000000..8442b80bb44 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/git_push.sh @@ -0,0 +1,52 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +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://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/samples/client/petstore/java/retrofit2-play26/gradle.properties b/samples/client/petstore/java/retrofit2-play26/gradle.properties new file mode 100644 index 00000000000..05644f0754a --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/gradle.properties @@ -0,0 +1,2 @@ +# Uncomment to build for Android +#target = android \ No newline at end of file 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 new file mode 100644 index 00000000000..2c6137b8789 Binary files /dev/null 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 new file mode 100644 index 00000000000..b7a36473955 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Tue May 17 23:08:05 CST 2016 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-2.6-bin.zip diff --git a/samples/client/petstore/java/retrofit2-play26/gradlew b/samples/client/petstore/java/retrofit2-play26/gradlew new file mode 100644 index 00000000000..9d82f789151 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# 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 +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# 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 + +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" ] ; 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 + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/samples/client/petstore/java/retrofit2-play26/gradlew.bat b/samples/client/petstore/java/retrofit2-play26/gradlew.bat new file mode 100644 index 00000000000..5f192121eb4 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/gradlew.bat @@ -0,0 +1,90 @@ +@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 + +@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 DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@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 +if "%@eval[2+2]" == "4" goto 4NT_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=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +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/samples/client/petstore/java/retrofit2-play26/pom.xml b/samples/client/petstore/java/retrofit2-play26/pom.xml new file mode 100644 index 00000000000..6957bc7ec62 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/pom.xml @@ -0,0 +1,288 @@ + + 4.0.0 + org.openapitools + petstore-java-client-retrofit2-play26 + jar + petstore-java-client-retrofit2-play26 + 1.0.0 + https://github.com/openapitools/openapi-generator + OpenAPI Java + + scm:git:git@github.com:openapitools/openapi-generator.git + scm:git:git@github.com:openapitools/openapi-generator.git + https://github.com/openapitools/openapi-generator + + + + + Unlicense + http://www.apache.org/licenses/LICENSE-2.0.html + repo + + + + + + OpenAPI + team@openapitools.org + OpenAPI + http://openapitools.org + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + 3.0.0-M1 + + + enforce-maven + + enforce + + + + + 2.2.0 + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.12 + + + + loggerPath + conf/log4j.properties + + + -Xms512m -Xmx1500m + methods + pertest + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory}/lib + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + + + + jar + test-jar + + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 1.10 + + + add_sources + generate-sources + + add-source + + + + src/main/java + + + + + add_test_sources + generate-test-sources + + add-test-source + + + + src/test/java + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 2.10.4 + + + attach-javadocs + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + + + + + sign-artifacts + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + + + + + + + io.swagger + swagger-annotations + ${swagger-annotations-version} + + + com.squareup.retrofit2 + converter-gson + ${retrofit-version} + + + com.squareup.retrofit2 + retrofit + ${retrofit-version} + + + com.squareup.retrofit2 + converter-scalars + ${retrofit-version} + + + org.apache.oltu.oauth2 + org.apache.oltu.oauth2.client + ${oltu-version} + + + org.apache.oltu.oauth2 + common + + + + + io.gsonfire + gson-fire + ${gson-fire-version} + + + org.threeten + threetenbp + ${threetenbp-version} + + + + com.squareup.retrofit2 + converter-jackson + ${retrofit-version} + + + com.fasterxml.jackson.core + jackson-core + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-version} + + + com.fasterxml.jackson.core + jackson-databind + ${jackson-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + ${jackson-version} + + + com.typesafe.play + play-ahc-ws_2.12 + ${play-version} + + + javax.validation + validation-api + 1.1.0.Final + + + + junit + junit + ${junit-version} + test + + + + UTF-8 + 1.8 + ${java.version} + ${java.version} + 1.8.0 + 1.5.21 + 2.8.10 + 2.6.7 + 2.3.0 + 1.3.5 + 1.0.1 + 4.12 + + diff --git a/samples/client/petstore/java/retrofit2-play26/project/build.properties b/samples/client/petstore/java/retrofit2-play26/project/build.properties new file mode 100644 index 00000000000..5620cc502b4 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/project/build.properties @@ -0,0 +1 @@ +sbt.version=1.2.1 diff --git a/samples/client/petstore/java/retrofit2-play26/settings.gradle b/samples/client/petstore/java/retrofit2-play26/settings.gradle new file mode 100644 index 00000000000..5b3f1e58867 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "petstore-java-client-retrofit2-play26" \ No newline at end of file diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/AndroidManifest.xml b/samples/client/petstore/java/retrofit2-play26/src/main/AndroidManifest.xml new file mode 100644 index 00000000000..54fbcb3da1e --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/ApiClient.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/ApiClient.java new file mode 100644 index 00000000000..6daa98296f7 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/ApiClient.java @@ -0,0 +1,206 @@ +package org.openapitools.client; + +import java.io.File; +import java.io.IOException; +import java.lang.annotation.Annotation; +import java.lang.reflect.Type; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.*; + +import com.fasterxml.jackson.databind.ObjectMapper; +import retrofit2.Converter; +import retrofit2.Retrofit; +import retrofit2.converter.scalars.ScalarsConverterFactory; +import retrofit2.converter.jackson.JacksonConverterFactory; + +import play.libs.Json; +import play.libs.ws.WSClient; + +import org.openapitools.client.Play26CallAdapterFactory; +import org.openapitools.client.Play26CallFactory; + +import okhttp3.Interceptor; +import okhttp3.ResponseBody; +import org.openapitools.client.auth.ApiKeyAuth; +import org.openapitools.client.auth.Authentication; + +/** + * API client + */ +public class ApiClient { + + /** Underlying HTTP-client */ + private WSClient wsClient; + + /** Creates HTTP call instances */ + private Play26CallFactory callFactory; + + /** Create {@link java.util.concurrent.CompletionStage} instances from HTTP calls */ + private Play26CallAdapterFactory callAdapterFactory; + + /** Supported auths */ + private Map authentications; + + /** API base path */ + private String basePath = "http://petstore.swagger.io:80/v2"; + + /** Default ObjectMapper */ + private ObjectMapper defaultMapper; + + public ApiClient(WSClient wsClient) { + this(); + this.wsClient = wsClient; + } + + public ApiClient() { + // Setup authentications (key: authentication name, value: authentication). + authentications = new HashMap<>(); + authentications.put("api_key", new ApiKeyAuth("header", "api_key")); + authentications.put("api_key_query", new ApiKeyAuth("query", "api_key_query")); + // authentications.put("http_basic_test", new HttpBasicAuth()); + // authentications.put("petstore_auth", new OAuth()); + // Prevent the authentications from being modified. + authentications = Collections.unmodifiableMap(authentications); + } + + /** + * Creates a retrofit2 client for given API interface + */ + public S createService(Class serviceClass) { + if(!basePath.endsWith("/")) { + basePath = basePath + "/"; + } + + Map extraHeaders = new HashMap<>(); + List extraQueryParams = new ArrayList<>(); + + for (String authName : authentications.keySet()) { + Authentication auth = authentications.get(authName); + if (auth == null) throw new RuntimeException("Authentication undefined: " + authName); + + auth.applyToParams(extraQueryParams, extraHeaders); + } + + if (callFactory == null) { + callFactory = new Play26CallFactory(wsClient, extraHeaders, extraQueryParams); + } + if (callAdapterFactory == null) { + callAdapterFactory = new Play26CallAdapterFactory(); + } + if (defaultMapper == null) { + defaultMapper = Json.mapper(); + } + + return new Retrofit.Builder() + .baseUrl(basePath) + .addConverterFactory(new FileConverter()) + .addConverterFactory(ScalarsConverterFactory.create()) + .addConverterFactory(JacksonConverterFactory.create(defaultMapper)) + .callFactory(callFactory) + .addCallAdapterFactory(callAdapterFactory) + .build() + .create(serviceClass); + } + + /** + * Helper method to set API base path + */ + public ApiClient setBasePath(String basePath) { + this.basePath = basePath; + return this; + } + + /** + * Get authentications (key: authentication name, value: authentication). + */ + public Map getAuthentications() { + return authentications; + } + + /** + * Get authentication for the given name. + * + * @param authName The authentication name + * @return The authentication, null if not found + */ + public Authentication getAuthentication(String authName) { + return authentications.get(authName); + } + + /** + * Helper method to set API key value for the first API key authentication. + */ + public ApiClient setApiKey(String apiKey) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKey(apiKey); + return this; + } + } + + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set API key prefix for the first API key authentication. + */ + public ApiClient setApiKeyPrefix(String apiKeyPrefix) { + for (Authentication auth : authentications.values()) { + if (auth instanceof ApiKeyAuth) { + ((ApiKeyAuth) auth).setApiKeyPrefix(apiKeyPrefix); + return this; + } + } + + throw new RuntimeException("No API key authentication configured!"); + } + + /** + * Helper method to set HTTP call instances factory + */ + public ApiClient setCallFactory(Play26CallFactory callFactory) { + this.callFactory = callFactory; + return this; + } + + /** + * Helper method to set {@link java.util.concurrent.CompletionStage} instances factory + */ + public ApiClient setCallAdapterFactory(Play26CallAdapterFactory callAdapterFactory) { + this.callAdapterFactory = callAdapterFactory; + return this; + } + + /** + * Helper method to set Jackson's {@link ObjectMapper} + */ + public ApiClient setObjectMapper(ObjectMapper mapper) { + this.defaultMapper = mapper; + return this; + } + + static class FileConverter extends Converter.Factory { + + @Override + public Converter responseBodyConverter(Type type, + Annotation[] annotations, Retrofit retrofit) { + + if (!File.class.getTypeName().equals(type.getTypeName())) { + return null; + } + + return new Converter() { + + @Override + public File convert(ResponseBody value) throws IOException { + + File file = File.createTempFile("retrofit-file", ".tmp"); + Files.write(Paths.get(file.getPath()), value.bytes()); + return file; + } + }; + } + } + +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/CollectionFormats.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/CollectionFormats.java new file mode 100644 index 00000000000..15cfcd1bd93 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/CollectionFormats.java @@ -0,0 +1,95 @@ +package org.openapitools.client; + +import java.util.Arrays; +import java.util.List; + +public class CollectionFormats { + + public static class CSVParams { + + protected List params; + + public CSVParams() { + } + + public CSVParams(List params) { + this.params = params; + } + + public CSVParams(String... params) { + this.params = Arrays.asList(params); + } + + public List getParams() { + return params; + } + + public void setParams(List params) { + this.params = params; + } + + @Override + public String toString() { + return StringUtil.join(params.toArray(new String[0]), ","); + } + + } + + public static class SSVParams extends CSVParams { + + public SSVParams() { + } + + public SSVParams(List params) { + super(params); + } + + public SSVParams(String... params) { + super(params); + } + + @Override + public String toString() { + return StringUtil.join(params.toArray(new String[0]), " "); + } + } + + public static class TSVParams extends CSVParams { + + public TSVParams() { + } + + public TSVParams(List params) { + super(params); + } + + public TSVParams(String... params) { + super(params); + } + + @Override + public String toString() { + return StringUtil.join( params.toArray(new String[0]), "\t"); + } + } + + public static class PIPESParams extends CSVParams { + + public PIPESParams() { + } + + public PIPESParams(List params) { + super(params); + } + + public PIPESParams(String... params) { + super(params); + } + + @Override + public String toString() { + return StringUtil.join(params.toArray(new String[0]), "|"); + } + } + +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/Pair.java new file mode 100644 index 00000000000..0619e8c408b --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/Pair.java @@ -0,0 +1,61 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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; + + +public class Pair { + private String name = ""; + private String value = ""; + + public Pair (String name, String value) { + setName(name); + setValue(value); + } + + private void setName(String name) { + if (!isValidString(name)) { + return; + } + + this.name = name; + } + + private void setValue(String value) { + if (!isValidString(value)) { + return; + } + + this.value = value; + } + + public String getName() { + return this.name; + } + + public String getValue() { + return this.value; + } + + private boolean isValidString(String arg) { + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } + + return true; + } +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/Play26CallAdapterFactory.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/Play26CallAdapterFactory.java new file mode 100644 index 00000000000..e3777b8eb7c --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/Play26CallAdapterFactory.java @@ -0,0 +1,116 @@ +package org.openapitools.client; + +import java.util.concurrent.CompletionStage; +import retrofit2.*; + +import java.lang.annotation.Annotation; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.lang.reflect.WildcardType; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import java.util.function.Function; + +/** + * Creates {@link CallAdapter} instances that convert {@link Call} into {@link java.util.concurrent.CompletionStage} + */ +public class Play26CallAdapterFactory extends CallAdapter.Factory { + + private Function exceptionConverter = Function.identity(); + + public Play26CallAdapterFactory() { + } + + public Play26CallAdapterFactory( + Function exceptionConverter) { + this.exceptionConverter = exceptionConverter; + } + + @Override + public CallAdapter get(Type returnType, Annotation[] annotations, Retrofit retrofit) { + if (!(returnType instanceof ParameterizedType)) { + return null; + } + + ParameterizedType type = (ParameterizedType) returnType; + if (type.getRawType() != CompletionStage.class) { + return null; + } + + return createAdapter((ParameterizedType) returnType); + } + + private CallAdapter> createAdapter(ParameterizedType returnType) { + // Get CompletionStage type argument + Type[] types = returnType.getActualTypeArguments(); + if (types.length != 1) { + throw new IllegalStateException("Must be exactly one type parameter"); + } + + Type resultType = types[0]; + Class rawTypeParam = getRawType(resultType); + + boolean includeResponse = false; + if (rawTypeParam == Response.class) { + if (!(resultType instanceof ParameterizedType)) { + throw new IllegalStateException("Response must be parameterized" + + " as Response"); + } + resultType = ((ParameterizedType) resultType).getActualTypeArguments()[0]; + includeResponse = true; + } + + return new ValueAdapter(resultType, includeResponse, exceptionConverter); + } + + /** + * Adpater that coverts values returned by API interface into CompletionStage + */ + private static final class ValueAdapter implements CallAdapter> { + + private final Type responseType; + private final boolean includeResponse; + private Function exceptionConverter; + + ValueAdapter(Type responseType, boolean includeResponse, + Function exceptionConverter) { + this.responseType = responseType; + this.includeResponse = includeResponse; + this.exceptionConverter = exceptionConverter; + } + + @Override + public Type responseType() { + return responseType; + } + + @Override + public CompletionStage adapt(final Call call) { + final CompletableFuture promise = new CompletableFuture(); + + call.enqueue(new Callback() { + + @Override + public void onResponse(Call call, Response response) { + if (response.isSuccessful()) { + if (includeResponse) { + promise.complete((R) response); + } else { + promise.complete(response.body()); + } + } else { + promise.completeExceptionally(exceptionConverter.apply(new HttpException(response))); + } + } + + @Override + public void onFailure(Call call, Throwable t) { + promise.completeExceptionally(t); + } + + }); + + return promise; + } + } +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/Play26CallFactory.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/Play26CallFactory.java new file mode 100644 index 00000000000..d320157bcf2 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/Play26CallFactory.java @@ -0,0 +1,245 @@ +package org.openapitools.client; + +import okhttp3.*; +import okio.Buffer; +import okio.BufferedSource; +import play.libs.ws.WSClient; +import play.libs.ws.WSRequest; +import play.libs.ws.WSResponse; +import play.libs.ws.WSRequestFilter; + +import java.io.IOException; +import java.net.MalformedURLException; +import java.net.URI; +import java.net.URISyntaxException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.Executor; + +/** + * Creates {@link Call} instances that invoke underlying {@link WSClient} + */ +public class Play26CallFactory implements okhttp3.Call.Factory { + + /** PlayWS http client */ + private final WSClient wsClient; + + /** Extra headers to add to request */ + private Map extraHeaders = new HashMap<>(); + + /** Extra query parameters to add to request */ + private List extraQueryParams = new ArrayList<>(); + + /** Filters (interceptors) */ + private List filters = new ArrayList<>(); + + /** Executor for WSClient */ + private Executor executor; + + public Play26CallFactory(WSClient wsClient) { + this.wsClient = wsClient; + } + + public Play26CallFactory(WSClient wsClient, List filters) { + this.wsClient = wsClient; + this.filters.addAll(filters); + } + + public Play26CallFactory(WSClient wsClient, Map extraHeaders, + List extraQueryParams) { + this.wsClient = wsClient; + + this.extraHeaders.putAll(extraHeaders); + this.extraQueryParams.addAll(extraQueryParams); + } + + public Play26CallFactory withExecutor(Executor executor) { + this.executor = executor; + return this; + } + + @Override + public Call newCall(Request request) { + // add extra headers + Request.Builder rb = request.newBuilder(); + for (Map.Entry header : this.extraHeaders.entrySet()) { + rb.addHeader(header.getKey(), header.getValue()); + } + + // add extra query params + if (!this.extraQueryParams.isEmpty()) { + String newQuery = request.url().uri().getQuery(); + for (Pair queryParam : this.extraQueryParams) { + String param = String.format("%s=%s", queryParam.getName(), queryParam.getValue()); + if (newQuery == null) { + newQuery = param; + } else { + newQuery += "&" + param; + } + } + + URI newUri; + try { + newUri = new URI(request.url().uri().getScheme(), request.url().uri().getAuthority(), + request.url().uri().getPath(), newQuery, request.url().uri().getFragment()); + rb.url(newUri.toURL()); + } catch (MalformedURLException | URISyntaxException e) { + throw new RuntimeException("Error while updating an url", e); + } + } + + return new PlayWSCall(wsClient, this.executor, this.filters, rb.build()); + } + + /** + * Call implementation that delegates to Play WS Client + */ + static class PlayWSCall implements Call { + + private final WSClient wsClient; + private WSRequest wsRequest; + private List filters; + private Executor executor = java.util.concurrent.ForkJoinPool.commonPool(); + + private final Request request; + + public PlayWSCall(WSClient wsClient, Executor executor, List filters, Request request) { + this.wsClient = wsClient; + this.request = request; + this.filters = filters; + + if (executor != null) { + this.executor = executor; + } + } + + @Override + public Request request() { + return request; + } + + @Override + public void enqueue(final okhttp3.Callback responseCallback) { + final Call call = this; + final CompletionStage promise = executeAsync(); + + promise.whenCompleteAsync((v, t) -> { + if (t != null) { + if (t instanceof IOException) { + responseCallback.onFailure(call, (IOException) t); + } else { + responseCallback.onFailure(call, new IOException(t)); + } + } else { + try { + responseCallback.onResponse(call, PlayWSCall.this.toWSResponse(v)); + } catch (Exception e) { + responseCallback.onFailure(call, new IOException(e)); + } + } + }, this.executor); + } + + CompletionStage executeAsync() { + try { + HttpUrl url = request.url(); + wsRequest = wsClient.url(url.scheme()+ "://" + url.host() + ":" + url.port() + url.encodedPath()); + url.queryParameterNames().forEach(queryParam -> { + wsRequest.addQueryParameter(queryParam, url.queryParameter(queryParam)); + }); + addHeaders(wsRequest); + if (request.body() != null) { + addBody(wsRequest); + } + filters.stream().forEach(f -> wsRequest.setRequestFilter(f)); + + return wsRequest.execute(request.method()); + } catch (Exception e) { + throw new RuntimeException(e.getMessage(), e); + } + } + + private void addHeaders(WSRequest wsRequest) { + for(Map.Entry> entry : request.headers().toMultimap().entrySet()) { + List values = entry.getValue(); + for (String value : values) { + wsRequest.setHeader(entry.getKey(), value); + } + } + } + + private void addBody(WSRequest wsRequest) throws IOException { + MediaType mediaType = request.body().contentType(); + if (mediaType != null) { + wsRequest.setContentType(mediaType.toString()); + } + + Buffer buffer = new Buffer(); + request.body().writeTo(buffer); + wsRequest.setBody(buffer.inputStream()); + } + + private Response toWSResponse(final WSResponse r) { + final Response.Builder builder = new Response.Builder(); + builder.request(request) + .code(r.getStatus()) + .body(new ResponseBody() { + + @Override + public MediaType contentType() { + return r.getSingleHeader("Content-Type") + .map(MediaType::parse) + .orElse(null); + } + + @Override + public long contentLength() { + return r.asByteArray().length; + } + + @Override + public BufferedSource source() { + return new Buffer().write(r.asByteArray()); + } + }); + + for (Map.Entry> entry : r.getAllHeaders().entrySet()) { + for (String value : entry.getValue()) { + builder.addHeader(entry.getKey(), value); + } + } + + builder.message(r.getStatusText()); + builder.protocol(Protocol.HTTP_1_1); + return builder.build(); + } + + @Override + public Response execute() throws IOException { + throw new UnsupportedOperationException("Not supported"); + } + + @Override + public void cancel() { + throw new UnsupportedOperationException("Not supported"); + } + + @Override + public PlayWSCall clone() { + throw new UnsupportedOperationException("Not supported"); + } + + @Override + public boolean isExecuted() { + return false; + } + + @Override + public boolean isCanceled() { + return false; + } + } +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/RFC3339DateFormat.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/RFC3339DateFormat.java new file mode 100644 index 00000000000..4ed672bced9 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/RFC3339DateFormat.java @@ -0,0 +1,32 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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; + +import com.fasterxml.jackson.databind.util.ISO8601DateFormat; +import com.fasterxml.jackson.databind.util.ISO8601Utils; + +import java.text.FieldPosition; +import java.util.Date; + + +public class RFC3339DateFormat extends ISO8601DateFormat { + + // Same as ISO8601DateFormat but serializing milliseconds. + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + String value = ISO8601Utils.format(date, true); + toAppendTo.append(value); + return toAppendTo; + } + +} \ No newline at end of file diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/StringUtil.java new file mode 100644 index 00000000000..c51b3bcf661 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/StringUtil.java @@ -0,0 +1,61 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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; + + +public class StringUtil { + /** + * Check if the given array contains the given value (with case-insensitive comparison). + * + * @param array The array + * @param value The value to search + * @return true if the array contains the value + */ + public static boolean containsIgnoreCase(String[] array, String value) { + for (String str : array) { + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } + } + return false; + } + + /** + * Join an array of strings with the given separator. + *

+ * Note: This might be replaced by utility method from commons-lang or guava someday + * if one of those libraries is added as dependency. + *

+ * + * @param array The array of strings + * @param separator The separator + * @return the resulting string + */ + public static String join(String[] array, String separator) { + int len = array.length; + if (len == 0) { + return ""; + } + + StringBuilder out = new StringBuilder(); + out.append(array[0]); + for (int i = 1; i < len; i++) { + out.append(separator).append(array[i]); + } + return out.toString(); + } +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/AnotherFakeApi.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/AnotherFakeApi.java new file mode 100644 index 00000000000..616c44b0102 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/AnotherFakeApi.java @@ -0,0 +1,39 @@ +package org.openapitools.client.api; + +import org.openapitools.client.CollectionFormats.*; + + + +import retrofit2.Call; +import retrofit2.http.*; + +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import okhttp3.MultipartBody; + +import org.openapitools.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import java.util.concurrent.*; +import retrofit2.Response; + +public interface AnotherFakeApi { + /** + * To test special tags + * To test special tags and operation ID starting with number + * @param client client model (required) + * @return Call<Client> + */ + @Headers({ + "Content-Type:application/json" + }) + @PATCH("another-fake/dummy") + CompletionStage> call123testSpecialTags( + @retrofit2.http.Body Client client + ); + +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/FakeApi.java new file mode 100644 index 00000000000..0c4b1f21257 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/FakeApi.java @@ -0,0 +1,190 @@ +package org.openapitools.client.api; + +import org.openapitools.client.CollectionFormats.*; + + + +import retrofit2.Call; +import retrofit2.http.*; + +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import okhttp3.MultipartBody; + +import java.math.BigDecimal; +import org.openapitools.client.model.Client; +import java.io.File; +import org.openapitools.client.model.FileSchemaTestClass; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.User; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import java.util.concurrent.*; +import retrofit2.Response; + +public interface FakeApi { + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Call<Boolean> + */ + @POST("fake/outer/boolean") + CompletionStage> fakeOuterBooleanSerialize( + @retrofit2.http.Body Boolean body + ); + + /** + * + * Test serialization of object with outer number type + * @param outerComposite Input composite as post body (optional) + * @return Call<OuterComposite> + */ + @POST("fake/outer/composite") + CompletionStage> fakeOuterCompositeSerialize( + @retrofit2.http.Body OuterComposite outerComposite + ); + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return Call<BigDecimal> + */ + @POST("fake/outer/number") + CompletionStage> fakeOuterNumberSerialize( + @retrofit2.http.Body BigDecimal body + ); + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return Call<String> + */ + @POST("fake/outer/string") + CompletionStage> fakeOuterStringSerialize( + @retrofit2.http.Body String body + ); + + /** + * + * For this test, the body for this request much reference a schema named `File`. + * @param fileSchemaTestClass (required) + * @return Call<Void> + */ + @Headers({ + "Content-Type:application/json" + }) + @PUT("fake/body-with-file-schema") + CompletionStage> testBodyWithFileSchema( + @retrofit2.http.Body FileSchemaTestClass fileSchemaTestClass + ); + + /** + * + * + * @param query (required) + * @param user (required) + * @return Call<Void> + */ + @Headers({ + "Content-Type:application/json" + }) + @PUT("fake/body-with-query-params") + CompletionStage> testBodyWithQueryParams( + @retrofit2.http.Query("query") String query, @retrofit2.http.Body User user + ); + + /** + * To test \"client\" model + * To test \"client\" model + * @param client client model (required) + * @return Call<Client> + */ + @Headers({ + "Content-Type:application/json" + }) + @PATCH("fake") + CompletionStage> testClientModel( + @retrofit2.http.Body Client client + ); + + /** + * 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 Call<Void> + */ + @retrofit2.http.FormUrlEncoded + @POST("fake") + CompletionStage> testEndpointParameters( + @retrofit2.http.Field("number") BigDecimal number, @retrofit2.http.Field("double") Double _double, @retrofit2.http.Field("pattern_without_delimiter") String patternWithoutDelimiter, @retrofit2.http.Field("byte") byte[] _byte, @retrofit2.http.Field("integer") Integer integer, @retrofit2.http.Field("int32") Integer int32, @retrofit2.http.Field("int64") Long int64, @retrofit2.http.Field("float") Float _float, @retrofit2.http.Field("string") String string, @retrofit2.http.Field("binary") MultipartBody.Part binary, @retrofit2.http.Field("date") LocalDate date, @retrofit2.http.Field("dateTime") OffsetDateTime dateTime, @retrofit2.http.Field("password") String password, @retrofit2.http.Field("callback") String paramCallback + ); + + /** + * 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 Call<Void> + */ + @retrofit2.http.FormUrlEncoded + @GET("fake") + CompletionStage> testEnumParameters( + @retrofit2.http.Header("enum_header_string_array") List enumHeaderStringArray, @retrofit2.http.Header("enum_header_string") String enumHeaderString, @retrofit2.http.Query("enum_query_string_array") CSVParams enumQueryStringArray, @retrofit2.http.Query("enum_query_string") String enumQueryString, @retrofit2.http.Query("enum_query_integer") Integer enumQueryInteger, @retrofit2.http.Query("enum_query_double") Double enumQueryDouble, @retrofit2.http.Field("enum_form_string_array") List enumFormStringArray, @retrofit2.http.Field("enum_form_string") String enumFormString + ); + + /** + * test inline additionalProperties + * + * @param requestBody request body (required) + * @return Call<Void> + */ + @Headers({ + "Content-Type:application/json" + }) + @POST("fake/inline-additionalProperties") + CompletionStage> testInlineAdditionalProperties( + @retrofit2.http.Body Map requestBody + ); + + /** + * test json serialization of form data + * + * @param param field1 (required) + * @param param2 field2 (required) + * @return Call<Void> + */ + @retrofit2.http.FormUrlEncoded + @GET("fake/jsonFormData") + CompletionStage> testJsonFormData( + @retrofit2.http.Field("param") String param, @retrofit2.http.Field("param2") String param2 + ); + +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java new file mode 100644 index 00000000000..c3db217e30d --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/FakeClassnameTags123Api.java @@ -0,0 +1,39 @@ +package org.openapitools.client.api; + +import org.openapitools.client.CollectionFormats.*; + + + +import retrofit2.Call; +import retrofit2.http.*; + +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import okhttp3.MultipartBody; + +import org.openapitools.client.model.Client; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import java.util.concurrent.*; +import retrofit2.Response; + +public interface FakeClassnameTags123Api { + /** + * To test class name in snake case + * To test class name in snake case + * @param client client model (required) + * @return Call<Client> + */ + @Headers({ + "Content-Type:application/json" + }) + @PATCH("fake_classname_test") + CompletionStage> testClassname( + @retrofit2.http.Body Client client + ); + +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/PetApi.java new file mode 100644 index 00000000000..98c3b6b42bd --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/PetApi.java @@ -0,0 +1,142 @@ +package org.openapitools.client.api; + +import org.openapitools.client.CollectionFormats.*; + + + +import retrofit2.Call; +import retrofit2.http.*; + +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import okhttp3.MultipartBody; + +import java.io.File; +import org.openapitools.client.model.ModelApiResponse; +import org.openapitools.client.model.Pet; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import java.util.concurrent.*; +import retrofit2.Response; + +public interface PetApi { + /** + * Add a new pet to the store + * + * @param pet Pet object that needs to be added to the store (required) + * @return Call<Void> + */ + @Headers({ + "Content-Type:application/json" + }) + @POST("pet") + CompletionStage> addPet( + @retrofit2.http.Body Pet pet + ); + + /** + * Deletes a pet + * + * @param petId Pet id to delete (required) + * @param apiKey (optional) + * @return Call<Void> + */ + @DELETE("pet/{petId}") + CompletionStage> deletePet( + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Header("api_key") String apiKey + ); + + /** + * 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 Call<List<Pet>> + */ + @GET("pet/findByStatus") + CompletionStage>> findPetsByStatus( + @retrofit2.http.Query("status") CSVParams status + ); + + /** + * 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 Call<List<Pet>> + */ + @GET("pet/findByTags") + CompletionStage>> findPetsByTags( + @retrofit2.http.Query("tags") CSVParams tags + ); + + /** + * Find pet by ID + * Returns a single pet + * @param petId ID of pet to return (required) + * @return Call<Pet> + */ + @GET("pet/{petId}") + CompletionStage> getPetById( + @retrofit2.http.Path("petId") Long petId + ); + + /** + * Update an existing pet + * + * @param pet Pet object that needs to be added to the store (required) + * @return Call<Void> + */ + @Headers({ + "Content-Type:application/json" + }) + @PUT("pet") + CompletionStage> updatePet( + @retrofit2.http.Body Pet pet + ); + + /** + * 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 Call<Void> + */ + @retrofit2.http.FormUrlEncoded + @POST("pet/{petId}") + CompletionStage> updatePetWithForm( + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Field("name") String name, @retrofit2.http.Field("status") String status + ); + + /** + * 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 Call<ModelApiResponse> + */ + @retrofit2.http.Multipart + @POST("pet/{petId}/uploadImage") + CompletionStage> uploadFile( + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part MultipartBody.Part file + ); + + /** + * 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 Call<ModelApiResponse> + */ + @retrofit2.http.Multipart + @POST("fake/{petId}/uploadImageWithRequiredFile") + CompletionStage> uploadFileWithRequiredFile( + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part MultipartBody.Part requiredFile, @retrofit2.http.Part("additionalMetadata") String additionalMetadata + ); + +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/StoreApi.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/StoreApi.java new file mode 100644 index 00000000000..040c1680202 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/StoreApi.java @@ -0,0 +1,67 @@ +package org.openapitools.client.api; + +import org.openapitools.client.CollectionFormats.*; + + + +import retrofit2.Call; +import retrofit2.http.*; + +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import okhttp3.MultipartBody; + +import org.openapitools.client.model.Order; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import java.util.concurrent.*; +import retrofit2.Response; + +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 + * @param orderId ID of the order that needs to be deleted (required) + * @return Call<Void> + */ + @DELETE("store/order/{order_id}") + CompletionStage> deleteOrder( + @retrofit2.http.Path("order_id") String orderId + ); + + /** + * Returns pet inventories by status + * Returns a map of status codes to quantities + * @return Call<Map<String, Integer>> + */ + @GET("store/inventory") + CompletionStage>> getInventory(); + + + /** + * 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 Call<Order> + */ + @GET("store/order/{order_id}") + CompletionStage> getOrderById( + @retrofit2.http.Path("order_id") Long orderId + ); + + /** + * Place an order for a pet + * + * @param order order placed for purchasing the pet (required) + * @return Call<Order> + */ + @POST("store/order") + CompletionStage> placeOrder( + @retrofit2.http.Body Order order + ); + +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/UserApi.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/UserApi.java new file mode 100644 index 00000000000..47f55e188ef --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/api/UserApi.java @@ -0,0 +1,113 @@ +package org.openapitools.client.api; + +import org.openapitools.client.CollectionFormats.*; + + + +import retrofit2.Call; +import retrofit2.http.*; + +import okhttp3.RequestBody; +import okhttp3.ResponseBody; +import okhttp3.MultipartBody; + +import org.openapitools.client.model.User; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import java.util.concurrent.*; +import retrofit2.Response; + +public interface UserApi { + /** + * Create user + * This can only be done by the logged in user. + * @param user Created user object (required) + * @return Call<Void> + */ + @POST("user") + CompletionStage> createUser( + @retrofit2.http.Body User user + ); + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return Call<Void> + */ + @POST("user/createWithArray") + CompletionStage> createUsersWithArrayInput( + @retrofit2.http.Body List user + ); + + /** + * Creates list of users with given input array + * + * @param user List of user object (required) + * @return Call<Void> + */ + @POST("user/createWithList") + CompletionStage> createUsersWithListInput( + @retrofit2.http.Body List user + ); + + /** + * Delete user + * This can only be done by the logged in user. + * @param username The name that needs to be deleted (required) + * @return Call<Void> + */ + @DELETE("user/{username}") + CompletionStage> deleteUser( + @retrofit2.http.Path("username") String username + ); + + /** + * Get user by user name + * + * @param username The name that needs to be fetched. Use user1 for testing. (required) + * @return Call<User> + */ + @GET("user/{username}") + CompletionStage> getUserByName( + @retrofit2.http.Path("username") String username + ); + + /** + * Logs user into the system + * + * @param username The user name for login (required) + * @param password The password for login in clear text (required) + * @return Call<String> + */ + @GET("user/login") + CompletionStage> loginUser( + @retrofit2.http.Query("username") String username, @retrofit2.http.Query("password") String password + ); + + /** + * Logs out current logged in user session + * + * @return Call<Void> + */ + @GET("user/logout") + CompletionStage> logoutUser(); + + + /** + * Updated user + * This can only be done by the logged in user. + * @param username name that need to be deleted (required) + * @param user Updated user object (required) + * @return Call<Void> + */ + @PUT("user/{username}") + CompletionStage> updateUser( + @retrofit2.http.Path("username") String username, @retrofit2.http.Body User user + ); + +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java new file mode 100644 index 00000000000..a84e0135241 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/auth/ApiKeyAuth.java @@ -0,0 +1,78 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.auth; + +import org.openapitools.client.Pair; + +import java.util.Map; +import java.util.List; + +/** + * Holds ApiKey auth info + */ + +public class ApiKeyAuth implements Authentication { + private final String location; + private final String paramName; + + private String apiKey; + private String apiKeyPrefix; + + public ApiKeyAuth(String location, String paramName) { + this.location = location; + this.paramName = paramName; + } + + public String getLocation() { + return location; + } + + public String getParamName() { + return paramName; + } + + public String getApiKey() { + return apiKey; + } + + public void setApiKey(String apiKey) { + this.apiKey = apiKey; + } + + public String getApiKeyPrefix() { + return apiKeyPrefix; + } + + public void setApiKeyPrefix(String apiKeyPrefix) { + this.apiKeyPrefix = apiKeyPrefix; + } + + @Override + public void applyToParams(List queryParams, Map headerParams) { + if (apiKey == null) { + return; + } + String value; + if (apiKeyPrefix != null) { + value = apiKeyPrefix + " " + apiKey; + } else { + value = apiKey; + } + if ("query".equals(location)) { + queryParams.add(new Pair(paramName, value)); + } else if ("header".equals(location)) { + headerParams.put(paramName, value); + } + } +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/auth/Authentication.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/auth/Authentication.java new file mode 100644 index 00000000000..ff392f0451a --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/auth/Authentication.java @@ -0,0 +1,29 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.auth; + +import org.openapitools.client.Pair; + +import java.util.Map; +import java.util.List; + +public interface Authentication { + /** + * Apply authentication settings to header and query params. + * + * @param queryParams List of query parameters + * @param headerParams Map of header parameters + */ + void applyToParams(List queryParams, Map headerParams); +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java new file mode 100644 index 00000000000..2f9a3c4eae1 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -0,0 +1,136 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * AdditionalPropertiesClass + */ + +public class AdditionalPropertiesClass { + @JsonProperty("map_property") + private Map mapProperty = null; + + @JsonProperty("map_of_map_property") + private Map> mapOfMapProperty = null; + + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap<>(); + } + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + /** + * Get mapProperty + * @return mapProperty + **/ + @ApiModelProperty(value = "") + public Map getMapProperty() { + return mapProperty; + } + + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap<>(); + } + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + /** + * Get mapOfMapProperty + * @return mapOfMapProperty + **/ + @Valid + @ApiModelProperty(value = "") + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Animal.java new file mode 100644 index 00000000000..914a2588134 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Animal.java @@ -0,0 +1,125 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Animal + */ + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "Cat"), +}) + +public class Animal { + @JsonProperty("className") + private String className; + + @JsonProperty("color") + private String color = "red"; + + public Animal className(String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public Animal color(String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + **/ + @ApiModelProperty(value = "") + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AnimalFarm.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AnimalFarm.java new file mode 100644 index 00000000000..867cf78d4ac --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/AnimalFarm.java @@ -0,0 +1,68 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Animal; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * AnimalFarm + */ + +public class AnimalFarm extends ArrayList { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 00000000000..3f30332d244 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,105 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * ArrayOfArrayOfNumberOnly + */ + +public class ArrayOfArrayOfNumberOnly { + @JsonProperty("ArrayArrayNumber") + private List> arrayArrayNumber = null; + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList<>(); + } + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + /** + * Get arrayArrayNumber + * @return arrayArrayNumber + **/ + @Valid + @ApiModelProperty(value = "") + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java new file mode 100644 index 00000000000..6f9af6ac2c3 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -0,0 +1,105 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * ArrayOfNumberOnly + */ + +public class ArrayOfNumberOnly { + @JsonProperty("ArrayNumber") + private List arrayNumber = null; + + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList<>(); + } + this.arrayNumber.add(arrayNumberItem); + return this; + } + + /** + * Get arrayNumber + * @return arrayNumber + **/ + @Valid + @ApiModelProperty(value = "") + public List getArrayNumber() { + return arrayNumber; + } + + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayTest.java new file mode 100644 index 00000000000..1dab8f3356b --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -0,0 +1,168 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.ReadOnlyFirst; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * ArrayTest + */ + +public class ArrayTest { + @JsonProperty("array_of_string") + private List arrayOfString = null; + + @JsonProperty("array_array_of_integer") + private List> arrayArrayOfInteger = null; + + @JsonProperty("array_array_of_model") + private List> arrayArrayOfModel = null; + + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList<>(); + } + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + /** + * Get arrayOfString + * @return arrayOfString + **/ + @ApiModelProperty(value = "") + public List getArrayOfString() { + return arrayOfString; + } + + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList<>(); + } + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @Valid + @ApiModelProperty(value = "") + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList<>(); + } + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @Valid + @ApiModelProperty(value = "") + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Capitalization.java new file mode 100644 index 00000000000..622bec62787 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Capitalization.java @@ -0,0 +1,208 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Capitalization + */ + +public class Capitalization { + @JsonProperty("smallCamel") + private String smallCamel; + + @JsonProperty("CapitalCamel") + private String capitalCamel; + + @JsonProperty("small_Snake") + private String smallSnake; + + @JsonProperty("Capital_Snake") + private String capitalSnake; + + @JsonProperty("SCA_ETH_Flow_Points") + private String scAETHFlowPoints; + + @JsonProperty("ATT_NAME") + private String ATT_NAME; + + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @ApiModelProperty(value = "") + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @ApiModelProperty(value = "") + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @ApiModelProperty(value = "") + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @ApiModelProperty(value = "") + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @ApiModelProperty(value = "") + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @ApiModelProperty(value = "Name of the pet ") + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Cat.java new file mode 100644 index 00000000000..a9cb91f0af7 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Cat.java @@ -0,0 +1,95 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Animal; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Cat + */ + +public class Cat extends Animal { + @JsonProperty("declawed") + private Boolean declawed; + + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @ApiModelProperty(value = "") + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Category.java new file mode 100644 index 00000000000..07563857e8b --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Category.java @@ -0,0 +1,116 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Category + */ + +public class Category { + @JsonProperty("id") + private Long id; + + @JsonProperty("name") + private String name; + + public Category id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Category name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ClassModel.java new file mode 100644 index 00000000000..446a0c4b56f --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ClassModel.java @@ -0,0 +1,94 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") + +public class ClassModel { + @JsonProperty("_class") + private String propertyClass; + + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @ApiModelProperty(value = "") + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Client.java new file mode 100644 index 00000000000..82fecf7069a --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Client.java @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Client + */ + +public class Client { + @JsonProperty("client") + private String client; + + public Client client(String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + **/ + @ApiModelProperty(value = "") + public String getClient() { + return client; + } + + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + + sb.append(" client: ").append(toIndentedString(client)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Dog.java new file mode 100644 index 00000000000..fee0559008f --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Dog.java @@ -0,0 +1,95 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.Animal; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Dog + */ + +public class Dog extends Animal { + @JsonProperty("breed") + private String breed; + + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @ApiModelProperty(value = "") + public String getBreed() { + return breed; + } + + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumArrays.java new file mode 100644 index 00000000000..52bd8e7be93 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -0,0 +1,196 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * EnumArrays + */ + +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String text) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("just_symbol") + private JustSymbolEnum justSymbol; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String text) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("array_enum") + private List arrayEnum = null; + + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + **/ + @ApiModelProperty(value = "") + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList<>(); + } + this.arrayEnum.add(arrayEnumItem); + return this; + } + + /** + * Get arrayEnum + * @return arrayEnum + **/ + @ApiModelProperty(value = "") + public List getArrayEnum() { + return arrayEnum; + } + + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumClass.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumClass.java new file mode 100644 index 00000000000..5ba02415fc9 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumClass.java @@ -0,0 +1,61 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String text) { + for (EnumClass b : EnumClass.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumTest.java new file mode 100644 index 00000000000..dce97a38c8f --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/EnumTest.java @@ -0,0 +1,332 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.client.model.OuterEnum; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * EnumTest + */ + +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringEnum fromValue(String text) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_string") + private EnumStringEnum enumString; + + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @JsonValue + public Integer getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(String text) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_integer") + private EnumIntegerEnum enumInteger; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @JsonValue + public Double getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumNumberEnum fromValue(String text) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_number") + private EnumNumberEnum enumNumber; + + @JsonProperty("outerEnum") + private OuterEnum outerEnum = null; + + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + **/ + @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { + return enumString; + } + + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + **/ + @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @Valid + @ApiModelProperty(value = "") + public OuterEnum getOuterEnum() { + return outerEnum; + } + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java new file mode 100644 index 00000000000..0733417b912 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -0,0 +1,128 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * FileSchemaTestClass + */ + +public class FileSchemaTestClass { + @JsonProperty("file") + private java.io.File file = null; + + @JsonProperty("files") + private List files = null; + + public FileSchemaTestClass file(java.io.File file) { + this.file = file; + return this; + } + + /** + * Get file + * @return file + **/ + @Valid + @ApiModelProperty(value = "") + public java.io.File getFile() { + return file; + } + + public void setFile(java.io.File file) { + this.file = file; + } + + public FileSchemaTestClass files(List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(java.io.File filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + **/ + @Valid + @ApiModelProperty(value = "") + public List getFiles() { + return files; + } + + public void setFiles(List files) { + this.files = files; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this.file, fileSchemaTestClass.file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(file, files); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FormatTest.java new file mode 100644 index 00000000000..40086f0cf6d --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/FormatTest.java @@ -0,0 +1,393 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import java.math.BigDecimal; +import java.util.UUID; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * FormatTest + */ + +public class FormatTest { + @JsonProperty("integer") + private Integer integer; + + @JsonProperty("int32") + private Integer int32; + + @JsonProperty("int64") + private Long int64; + + @JsonProperty("number") + private BigDecimal number; + + @JsonProperty("float") + private Float _float; + + @JsonProperty("double") + private Double _double; + + @JsonProperty("string") + private String string; + + @JsonProperty("byte") + private byte[] _byte; + + @JsonProperty("binary") + private File binary; + + @JsonProperty("date") + private LocalDate date; + + @JsonProperty("dateTime") + private OffsetDateTime dateTime; + + @JsonProperty("uuid") + private UUID uuid; + + @JsonProperty("password") + private String password; + + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @Min(10) @Max(100) @ApiModelProperty(value = "") + public Integer getInteger() { + return integer; + } + + public void setInteger(Integer integer) { + this.integer = integer; + } + + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @Min(20) @Max(200) @ApiModelProperty(value = "") + public Integer getInt32() { + return int32; + } + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + **/ + @ApiModelProperty(value = "") + public Long getInt64() { + return int64; + } + + public void setInt64(Long int64) { + this.int64 = int64; + } + + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @NotNull + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") @ApiModelProperty(required = true, value = "") + public BigDecimal getNumber() { + return number; + } + + public void setNumber(BigDecimal number) { + this.number = number; + } + + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @DecimalMin("54.3") @DecimalMax("987.6") @ApiModelProperty(value = "") + public Float getFloat() { + return _float; + } + + public void setFloat(Float _float) { + this._float = _float; + } + + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @DecimalMin("67.8") @DecimalMax("123.4") @ApiModelProperty(value = "") + public Double getDouble() { + return _double; + } + + public void setDouble(Double _double) { + this._double = _double; + } + + public FormatTest string(String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @Pattern(regexp="/[a-z]/i") @ApiModelProperty(value = "") + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + **/ + @NotNull + @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") @ApiModelProperty(required = true, value = "") + public byte[] getByte() { + return _byte; + } + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + public FormatTest binary(File binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + **/ + @Valid + @ApiModelProperty(value = "") + public File getBinary() { + return binary; + } + + public void setBinary(File binary) { + this.binary = binary; + } + + public FormatTest date(LocalDate date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + **/ + @NotNull + @Valid + @ApiModelProperty(required = true, value = "") + public LocalDate getDate() { + return date; + } + + public void setDate(LocalDate date) { + this.date = date; + } + + public FormatTest dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @Valid + @ApiModelProperty(value = "") + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @Valid + @ApiModelProperty(value = "") + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public FormatTest password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @NotNull + @Size(min=10,max=64) @ApiModelProperty(required = true, value = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.string, formatTest.string) && + Arrays.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, Arrays.hashCode(_byte), binary, date, dateTime, uuid, password); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java new file mode 100644 index 00000000000..e6c5e1b86a2 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -0,0 +1,98 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * HasOnlyReadOnly + */ + +public class HasOnlyReadOnly { + @JsonProperty("bar") + private String bar; + + @JsonProperty("foo") + private String foo; + + /** + * Get bar + * @return bar + **/ + @ApiModelProperty(value = "") + public String getBar() { + return bar; + } + + /** + * Get foo + * @return foo + **/ + @ApiModelProperty(value = "") + public String getFoo() { + return foo; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MapTest.java new file mode 100644 index 00000000000..861dec2d06f --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MapTest.java @@ -0,0 +1,233 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * MapTest + */ + +public class MapTest { + @JsonProperty("map_map_of_string") + private Map> mapMapOfString = null; + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InnerEnum fromValue(String text) { + for (InnerEnum b : InnerEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("map_of_enum_string") + private Map mapOfEnumString = null; + + @JsonProperty("direct_map") + private Map directMap = null; + + @JsonProperty("indirect_map") + private Map indirectMap = null; + + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap<>(); + } + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + /** + * Get mapMapOfString + * @return mapMapOfString + **/ + @Valid + @ApiModelProperty(value = "") + public Map> getMapMapOfString() { + return mapMapOfString; + } + + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap<>(); + } + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + /** + * Get mapOfEnumString + * @return mapOfEnumString + **/ + @ApiModelProperty(value = "") + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + public MapTest directMap(Map directMap) { + this.directMap = directMap; + return this; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap<>(); + } + this.directMap.put(key, directMapItem); + return this; + } + + /** + * Get directMap + * @return directMap + **/ + @ApiModelProperty(value = "") + public Map getDirectMap() { + return directMap; + } + + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + public MapTest indirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @ApiModelProperty(value = "") + public Map getIndirectMap() { + return indirectMap; + } + + public void setIndirectMap(Map indirectMap) { + this.indirectMap = indirectMap; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 00000000000..230369158c0 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,156 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.client.model.Animal; +import org.threeten.bp.OffsetDateTime; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ + +public class MixedPropertiesAndAdditionalPropertiesClass { + @JsonProperty("uuid") + private UUID uuid; + + @JsonProperty("dateTime") + private OffsetDateTime dateTime; + + @JsonProperty("map") + private Map map = null; + + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @Valid + @ApiModelProperty(value = "") + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @Valid + @ApiModelProperty(value = "") + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap<>(); + } + this.map.put(key, mapItem); + return this; + } + + /** + * Get map + * @return map + **/ + @Valid + @ApiModelProperty(value = "") + public Map getMap() { + return map; + } + + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Model200Response.java new file mode 100644 index 00000000000..3a496beb0dc --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Model200Response.java @@ -0,0 +1,117 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Model for testing model name starting with number + */ +@ApiModel(description = "Model for testing model name starting with number") + +public class Model200Response { + @JsonProperty("name") + private Integer name; + + @JsonProperty("class") + private String propertyClass; + + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @ApiModelProperty(value = "") + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelApiResponse.java new file mode 100644 index 00000000000..66d8f67164f --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -0,0 +1,139 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * ModelApiResponse + */ + +public class ModelApiResponse { + @JsonProperty("code") + private Integer code; + + @JsonProperty("type") + private String type; + + @JsonProperty("message") + private String message; + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @ApiModelProperty(value = "") + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(value = "") + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @ApiModelProperty(value = "") + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelReturn.java new file mode 100644 index 00000000000..861aa8cb445 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -0,0 +1,94 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Model for testing reserved words + */ +@ApiModel(description = "Model for testing reserved words") + +public class ModelReturn { + @JsonProperty("return") + private Integer _return; + + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + **/ + @ApiModelProperty(value = "") + public Integer getReturn() { + return _return; + } + + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Name.java new file mode 100644 index 00000000000..fe8680f3963 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Name.java @@ -0,0 +1,146 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Model for testing model name same as property name + */ +@ApiModel(description = "Model for testing model name same as property name") + +public class Name { + @JsonProperty("name") + private Integer name; + + @JsonProperty("snake_case") + private Integer snakeCase; + + @JsonProperty("property") + private String property; + + @JsonProperty("123Number") + private Integer _123number; + + public Name name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + /** + * Get snakeCase + * @return snakeCase + **/ + @ApiModelProperty(value = "") + public Integer getSnakeCase() { + return snakeCase; + } + + public Name property(String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + **/ + @ApiModelProperty(value = "") + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + /** + * Get _123number + * @return _123number + **/ + @ApiModelProperty(value = "") + public Integer get123number() { + return _123number; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/NumberOnly.java new file mode 100644 index 00000000000..0b8dbf2b0a2 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -0,0 +1,95 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * NumberOnly + */ + +public class NumberOnly { + @JsonProperty("JustNumber") + private BigDecimal justNumber; + + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + **/ + @Valid + @ApiModelProperty(value = "") + public BigDecimal getJustNumber() { + return justNumber; + } + + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + + sb.append(" justNumber: ").append(toIndentedString(justNumber)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Order.java new file mode 100644 index 00000000000..d15cd79db0b --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Order.java @@ -0,0 +1,247 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.threeten.bp.OffsetDateTime; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Order + */ + +public class Order { + @JsonProperty("id") + private Long id; + + @JsonProperty("petId") + private Long petId; + + @JsonProperty("quantity") + private Integer quantity; + + @JsonProperty("shipDate") + private OffsetDateTime shipDate; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("status") + private StatusEnum status; + + @JsonProperty("complete") + private Boolean complete = false; + + public Order id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + **/ + @ApiModelProperty(value = "") + public Long getPetId() { + return petId; + } + + public void setPetId(Long petId) { + this.petId = petId; + } + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @ApiModelProperty(value = "") + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Order shipDate(OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @Valid + @ApiModelProperty(value = "") + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + **/ + @ApiModelProperty(value = "Order Status") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + **/ + @ApiModelProperty(value = "") + public Boolean getComplete() { + return complete; + } + + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/OuterComposite.java new file mode 100644 index 00000000000..3fe27174b80 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -0,0 +1,141 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber; + + @JsonProperty("my_string") + private String myString; + + @JsonProperty("my_boolean") + private Boolean myBoolean; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @Valid + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/OuterEnum.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/OuterEnum.java new file mode 100644 index 00000000000..7a9fbfc01f6 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/OuterEnum.java @@ -0,0 +1,61 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import javax.validation.constraints.*; +import javax.validation.Valid; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String text) { + for (OuterEnum b : OuterEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Pet.java new file mode 100644 index 00000000000..341de124475 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Pet.java @@ -0,0 +1,266 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.client.model.Category; +import org.openapitools.client.model.Tag; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Pet + */ + +public class Pet { + @JsonProperty("id") + private Long id; + + @JsonProperty("category") + private Category category = null; + + @JsonProperty("name") + private String name; + + @JsonProperty("photoUrls") + private List photoUrls = new ArrayList<>(); + + @JsonProperty("tags") + private List tags = null; + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("status") + private StatusEnum status; + + public Pet id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Pet category(Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + **/ + @Valid + @ApiModelProperty(value = "") + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + public Pet name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @NotNull + @ApiModelProperty(example = "doggie", required = true, value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @NotNull + @ApiModelProperty(required = true, value = "") + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @Valid + @ApiModelProperty(value = "") + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + **/ + @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java new file mode 100644 index 00000000000..03502706b5b --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -0,0 +1,107 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * ReadOnlyFirst + */ + +public class ReadOnlyFirst { + @JsonProperty("bar") + private String bar; + + @JsonProperty("baz") + private String baz; + + /** + * Get bar + * @return bar + **/ + @ApiModelProperty(value = "") + public String getBar() { + return bar; + } + + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + **/ + @ApiModelProperty(value = "") + public String getBaz() { + return baz; + } + + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/SpecialModelName.java new file mode 100644 index 00000000000..6c87458f501 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -0,0 +1,93 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * SpecialModelName + */ + +public class SpecialModelName { + @JsonProperty("$special[property.name]") + private Long $specialPropertyName; + + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + **/ + @ApiModelProperty(value = "") + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName $specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/StringBooleanMap.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/StringBooleanMap.java new file mode 100644 index 00000000000..c651556f7d0 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/StringBooleanMap.java @@ -0,0 +1,67 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Map; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * StringBooleanMap + */ + +public class StringBooleanMap extends HashMap { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StringBooleanMap {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Tag.java new file mode 100644 index 00000000000..0cee1356078 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/Tag.java @@ -0,0 +1,116 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Tag + */ + +public class Tag { + @JsonProperty("id") + private Long id; + + @JsonProperty("name") + private String name; + + public Tag id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Tag name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/User.java new file mode 100644 index 00000000000..5f62375eb77 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/main/java/org/openapitools/client/model/User.java @@ -0,0 +1,254 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * + * + * 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.model; + +import java.util.Objects; +import java.util.Arrays; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * User + */ + +public class User { + @JsonProperty("id") + private Long id; + + @JsonProperty("username") + private String username; + + @JsonProperty("firstName") + private String firstName; + + @JsonProperty("lastName") + private String lastName; + + @JsonProperty("email") + private String email; + + @JsonProperty("password") + private String password; + + @JsonProperty("phone") + private String phone; + + @JsonProperty("userStatus") + private Integer userStatus; + + public User id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public User username(String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @ApiModelProperty(value = "") + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @ApiModelProperty(value = "") + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @ApiModelProperty(value = "") + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public User email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @ApiModelProperty(value = "") + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public User password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(value = "") + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public User phone(String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @ApiModelProperty(value = "") + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @ApiModelProperty(value = "User Status") + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java new file mode 100644 index 00000000000..0307ed17779 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/AnotherFakeApiTest.java @@ -0,0 +1,32 @@ +package org.openapitools.client.api; + +import org.junit.Before; +import org.junit.Test; +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.Client; + +/** + * API tests for AnotherFakeApi + */ +public class AnotherFakeApiTest { + + private AnotherFakeApi api; + + @Before + public void setup() { + api = new ApiClient().createService(AnotherFakeApi.class); + } + + /** + * To test special tags + * + * To test special tags and operation ID starting with number + */ + @Test + public void call123testSpecialTagsTest() { + Client client = null; + // Client response = api.call123testSpecialTags(client); + + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/FakeApiTest.java b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/FakeApiTest.java new file mode 100644 index 00000000000..4889e92772c --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/FakeApiTest.java @@ -0,0 +1,184 @@ +package org.openapitools.client.api; + +import org.junit.Before; +import org.junit.Test; +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.Client; +import org.openapitools.client.model.FileSchemaTestClass; +import org.openapitools.client.model.OuterComposite; +import org.openapitools.client.model.User; +import org.threeten.bp.LocalDate; +import org.threeten.bp.OffsetDateTime; + +import java.io.File; +import java.math.BigDecimal; +import java.util.List; +import java.util.Map; + +/** + * API tests for FakeApi + */ +public class FakeApiTest { + + private FakeApi api; + + @Before + public void setup() { + api = new ApiClient().createService(FakeApi.class); + } + + /** + * + * + * Test serialization of outer boolean types + */ + @Test + public void fakeOuterBooleanSerializeTest() { + Boolean body = null; + // Boolean response = api.fakeOuterBooleanSerialize(body); + + // TODO: test validations + } + /** + * + * + * Test serialization of object with outer number type + */ + @Test + public void fakeOuterCompositeSerializeTest() { + OuterComposite outerComposite = null; + // OuterComposite response = api.fakeOuterCompositeSerialize(outerComposite); + + // TODO: test validations + } + /** + * + * + * Test serialization of outer number types + */ + @Test + public void fakeOuterNumberSerializeTest() { + BigDecimal body = null; + // BigDecimal response = api.fakeOuterNumberSerialize(body); + + // TODO: test validations + } + /** + * + * + * Test serialization of outer string types + */ + @Test + public void fakeOuterStringSerializeTest() { + String body = null; + // String response = api.fakeOuterStringSerialize(body); + + // TODO: test validations + } + /** + * + * + * For this test, the body for this request much reference a schema named `File`. + */ + @Test + public void testBodyWithFileSchemaTest() { + FileSchemaTestClass fileSchemaTestClass = null; + // api.testBodyWithFileSchema(fileSchemaTestClass); + + // TODO: test validations + } + /** + * + * + * + */ + @Test + public void testBodyWithQueryParamsTest() { + String query = null; + User user = null; + // api.testBodyWithQueryParams(query, user); + + // TODO: test validations + } + /** + * To test \"client\" model + * + * To test \"client\" model + */ + @Test + public void testClientModelTest() { + Client client = null; + // Client response = api.testClientModel(client); + + // TODO: test validations + } + /** + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + * + * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + */ + @Test + public void testEndpointParametersTest() { + BigDecimal number = null; + Double _double = null; + String patternWithoutDelimiter = null; + byte[] _byte = null; + Integer integer = null; + Integer int32 = null; + Long int64 = null; + Float _float = null; + String string = null; + File binary = null; + LocalDate date = null; + OffsetDateTime dateTime = null; + String password = null; + String paramCallback = null; + // api.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); + + // TODO: test validations + } + /** + * To test enum parameters + * + * To test enum parameters + */ + @Test + public void testEnumParametersTest() { + List enumHeaderStringArray = null; + String enumHeaderString = null; + List enumQueryStringArray = null; + String enumQueryString = null; + Integer enumQueryInteger = null; + Double enumQueryDouble = null; + List enumFormStringArray = null; + String enumFormString = null; + // api.testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); + + // TODO: test validations + } + /** + * test inline additionalProperties + * + * + */ + @Test + public void testInlineAdditionalPropertiesTest() { + Map requestBody = null; + // api.testInlineAdditionalProperties(requestBody); + + // TODO: test validations + } + /** + * test json serialization of form data + * + * + */ + @Test + public void testJsonFormDataTest() { + String param = null; + String param2 = null; + // api.testJsonFormData(param, param2); + + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java new file mode 100644 index 00000000000..e615576da23 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/FakeClassnameTags123ApiTest.java @@ -0,0 +1,32 @@ +package org.openapitools.client.api; + +import org.junit.Before; +import org.junit.Test; +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.Client; + +/** + * API tests for FakeClassnameTags123Api + */ +public class FakeClassnameTags123ApiTest { + + private FakeClassnameTags123Api api; + + @Before + public void setup() { + api = new ApiClient().createService(FakeClassnameTags123Api.class); + } + + /** + * To test class name in snake case + * + * To test class name in snake case + */ + @Test + public void testClassnameTest() { + Client client = null; + // Client response = api.testClassname(client); + + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/PetApiTest.java b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/PetApiTest.java new file mode 100644 index 00000000000..9d7a40be314 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/PetApiTest.java @@ -0,0 +1,138 @@ +package org.openapitools.client.api; + +import org.junit.Before; +import org.junit.Test; +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.Pet; + +import java.io.File; +import java.util.List; + +/** + * API tests for PetApi + */ +public class PetApiTest { + + private PetApi api; + + @Before + public void setup() { + api = new ApiClient().createService(PetApi.class); + } + + /** + * Add a new pet to the store + * + * + */ + @Test + public void addPetTest() { + Pet pet = null; + // api.addPet(pet); + + // TODO: test validations + } + /** + * Deletes a pet + * + * + */ + @Test + public void deletePetTest() { + Long petId = null; + String apiKey = null; + // api.deletePet(petId, apiKey); + + // TODO: test validations + } + /** + * Finds Pets by status + * + * Multiple status values can be provided with comma separated strings + */ + @Test + public void findPetsByStatusTest() { + List status = null; + // List response = 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. + */ + @Test + public void findPetsByTagsTest() { + List tags = null; + // List response = api.findPetsByTags(tags); + + // TODO: test validations + } + /** + * Find pet by ID + * + * Returns a single pet + */ + @Test + public void getPetByIdTest() { + Long petId = null; + // Pet response = api.getPetById(petId); + + // TODO: test validations + } + /** + * Update an existing pet + * + * + */ + @Test + public void updatePetTest() { + Pet pet = null; + // api.updatePet(pet); + + // TODO: test validations + } + /** + * Updates a pet in the store with form data + * + * + */ + @Test + public void updatePetWithFormTest() { + Long petId = null; + String name = null; + String status = null; + // api.updatePetWithForm(petId, name, status); + + // TODO: test validations + } + /** + * uploads an image + * + * + */ + @Test + public void uploadFileTest() { + Long petId = null; + String additionalMetadata = null; + File file = null; + // ModelApiResponse response = api.uploadFile(petId, additionalMetadata, file); + + // TODO: test validations + } + /** + * uploads an image (required) + * + * + */ + @Test + public void uploadFileWithRequiredFileTest() { + Long petId = null; + File requiredFile = null; + String additionalMetadata = null; + // ModelApiResponse response = api.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); + + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/StoreApiTest.java b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/StoreApiTest.java new file mode 100644 index 00000000000..90c204243b9 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/StoreApiTest.java @@ -0,0 +1,67 @@ +package org.openapitools.client.api; + +import org.junit.Before; +import org.junit.Test; +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.Order; + +/** + * API tests for StoreApi + */ +public class StoreApiTest { + + private StoreApi api; + + @Before + public void setup() { + api = new ApiClient().createService(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 + */ + @Test + public void deleteOrderTest() { + String orderId = null; + // api.deleteOrder(orderId); + + // TODO: test validations + } + /** + * Returns pet inventories by status + * + * Returns a map of status codes to quantities + */ + @Test + public void getInventoryTest() { + // Map response = 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 + */ + @Test + public void getOrderByIdTest() { + Long orderId = null; + // Order response = api.getOrderById(orderId); + + // TODO: test validations + } + /** + * Place an order for a pet + * + * + */ + @Test + public void placeOrderTest() { + Order order = null; + // Order response = api.placeOrder(order); + + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/UserApiTest.java b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/UserApiTest.java new file mode 100644 index 00000000000..c64cf2a1a68 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play26/src/test/java/org/openapitools/client/api/UserApiTest.java @@ -0,0 +1,119 @@ +package org.openapitools.client.api; + +import org.junit.Before; +import org.junit.Test; +import org.openapitools.client.ApiClient; +import org.openapitools.client.model.User; + +import java.util.List; + +/** + * API tests for UserApi + */ +public class UserApiTest { + + private UserApi api; + + @Before + public void setup() { + api = new ApiClient().createService(UserApi.class); + } + + /** + * Create user + * + * This can only be done by the logged in user. + */ + @Test + public void createUserTest() { + User user = null; + // api.createUser(user); + + // TODO: test validations + } + /** + * Creates list of users with given input array + * + * + */ + @Test + public void createUsersWithArrayInputTest() { + List user = null; + // api.createUsersWithArrayInput(user); + + // TODO: test validations + } + /** + * Creates list of users with given input array + * + * + */ + @Test + public void createUsersWithListInputTest() { + List user = null; + // api.createUsersWithListInput(user); + + // TODO: test validations + } + /** + * Delete user + * + * This can only be done by the logged in user. + */ + @Test + public void deleteUserTest() { + String username = null; + // api.deleteUser(username); + + // TODO: test validations + } + /** + * Get user by user name + * + * + */ + @Test + public void getUserByNameTest() { + String username = null; + // User response = api.getUserByName(username); + + // TODO: test validations + } + /** + * Logs user into the system + * + * + */ + @Test + public void loginUserTest() { + String username = null; + String password = null; + // String response = api.loginUser(username, password); + + // TODO: test validations + } + /** + * Logs out current logged in user session + * + * + */ + @Test + public void logoutUserTest() { + // api.logoutUser(); + + // TODO: test validations + } + /** + * Updated user + * + * This can only be done by the logged in user. + */ + @Test + public void updateUserTest() { + String username = null; + User user = null; + // api.updateUser(username, user); + + // TODO: test validations + } +} diff --git a/samples/client/petstore/java/retrofit2/build.gradle b/samples/client/petstore/java/retrofit2/build.gradle index f4017a3f71f..5b2dbdafa34 100644 --- a/samples/client/petstore/java/retrofit2/build.gradle +++ b/samples/client/petstore/java/retrofit2/build.gradle @@ -96,7 +96,7 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" retrofit_version = "2.3.0" - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" junit_version = "4.12" threetenbp_version = "1.3.5" json_fire_version = "1.8.0" diff --git a/samples/client/petstore/java/retrofit2/build.sbt b/samples/client/petstore/java/retrofit2/build.sbt index ef3a285ecb9..32ae3006148 100644 --- a/samples/client/petstore/java/retrofit2/build.sbt +++ b/samples/client/petstore/java/retrofit2/build.sbt @@ -12,7 +12,7 @@ lazy val root = (project in file(".")). "com.squareup.retrofit2" % "retrofit" % "2.3.0" % "compile", "com.squareup.retrofit2" % "converter-scalars" % "2.3.0" % "compile", "com.squareup.retrofit2" % "converter-gson" % "2.3.0" % "compile", - "io.swagger" % "swagger-annotations" % "1.5.17" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "org.threeten" % "threetenbp" % "1.3.5" % "compile", "io.gsonfire" % "gson-fire" % "1.8.0" % "compile", diff --git a/samples/client/petstore/java/retrofit2/docs/FakeApi.md b/samples/client/petstore/java/retrofit2/docs/FakeApi.md index 2d5d6ba1369..d529c54f05a 100644 --- a/samples/client/petstore/java/retrofit2/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/retrofit2/docs/MapTest.md b/samples/client/petstore/java/retrofit2/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/retrofit2/docs/MapTest.md +++ b/samples/client/petstore/java/retrofit2/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/retrofit2/docs/PetApi.md b/samples/client/petstore/java/retrofit2/docs/PetApi.md index 0005f283293..829565c5db1 100644 --- a/samples/client/petstore/java/retrofit2/docs/PetApi.md +++ b/samples/client/petstore/java/retrofit2/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/retrofit2/docs/UserApi.md b/samples/client/petstore/java/retrofit2/docs/UserApi.md index 795bb22a03f..170d5027e1a 100644 --- a/samples/client/petstore/java/retrofit2/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/retrofit2/pom.xml b/samples/client/petstore/java/retrofit2/pom.xml index eefa92c58a4..6cba3499f5a 100644 --- a/samples/client/petstore/java/retrofit2/pom.xml +++ b/samples/client/petstore/java/retrofit2/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -191,7 +189,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} com.squareup.retrofit2 @@ -229,9 +227,6 @@ threetenbp ${threetenbp-version} - - - junit @@ -246,9 +241,9 @@ ${java.version} ${java.version} 1.8.0 - 1.5.18 + 1.5.21 2.3.0 - 1.3.5 + 1.3.5 1.0.1 4.12
diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/FakeApi.java index abd6cdca2ff..b2dbdf2f378 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/FakeApi.java @@ -118,16 +118,16 @@ public interface FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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 Call<Void> */ @retrofit2.http.FormUrlEncoded @@ -139,9 +139,9 @@ public interface FakeApi { /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/PetApi.java index 861c810234c..4935b7b895f 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/api/PetApi.java @@ -98,8 +98,8 @@ public interface PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @return Call<Void> */ @retrofit2.http.FormUrlEncoded @@ -112,14 +112,14 @@ public interface PetApi { * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return Call<ModelApiResponse> */ @retrofit2.http.Multipart @POST("pet/{petId}/uploadImage") Call uploadFile( - @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file") MultipartBody.Part file + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part MultipartBody.Part file ); /** @@ -127,13 +127,13 @@ public interface PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return Call<ModelApiResponse> */ @retrofit2.http.Multipart @POST("fake/{petId}/uploadImageWithRequiredFile") Call uploadFileWithRequiredFile( - @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("requiredFile") MultipartBody.Part requiredFile, @retrofit2.http.Part("additionalMetadata") String additionalMetadata + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part MultipartBody.Part requiredFile, @retrofit2.http.Part("additionalMetadata") String additionalMetadata ); } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Animal.java index 02469e22e51..4cc9f9fc81b 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Animal.java @@ -32,7 +32,7 @@ import java.io.IOException; public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className = null; + private String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Capitalization.java index bd3be0876f6..364dc3f2e4b 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Capitalization.java @@ -31,27 +31,27 @@ import java.io.IOException; public class Capitalization { public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) - private String smallCamel = null; + private String smallCamel; public static final String SERIALIZED_NAME_CAPITAL_CAMEL = "CapitalCamel"; @SerializedName(SERIALIZED_NAME_CAPITAL_CAMEL) - private String capitalCamel = null; + private String capitalCamel; public static final String SERIALIZED_NAME_SMALL_SNAKE = "small_Snake"; @SerializedName(SERIALIZED_NAME_SMALL_SNAKE) - private String smallSnake = null; + private String smallSnake; public static final String SERIALIZED_NAME_CAPITAL_SNAKE = "Capital_Snake"; @SerializedName(SERIALIZED_NAME_CAPITAL_SNAKE) - private String capitalSnake = null; + private String capitalSnake; public static final String SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; @SerializedName(SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS) - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; public static final String SERIALIZED_NAME_A_T_T_N_A_M_E = "ATT_NAME"; @SerializedName(SERIALIZED_NAME_A_T_T_N_A_M_E) - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Cat.java index cede1ca4c75..67827ff3973 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Cat.java @@ -32,7 +32,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Category.java index 7223fd28279..68177b01908 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Category.java @@ -31,11 +31,11 @@ import java.io.IOException; public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ClassModel.java index 3150b5919b0..225a08b9344 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ClassModel.java @@ -32,7 +32,7 @@ import java.io.IOException; public class ClassModel { public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Client.java index 219520a7ab1..a724368de1b 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Client.java @@ -31,7 +31,7 @@ import java.io.IOException; public class Client { public static final String SERIALIZED_NAME_CLIENT = "client"; @SerializedName(SERIALIZED_NAME_CLIENT) - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Dog.java index 3c86defe3c8..929dae95e51 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Dog.java @@ -32,7 +32,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumArrays.java index c2f60d79983..4db242f3a11 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -80,7 +80,7 @@ public class EnumArrays { public static final String SERIALIZED_NAME_JUST_SYMBOL = "just_symbol"; @SerializedName(SERIALIZED_NAME_JUST_SYMBOL) - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumTest.java index a2319a67a7d..1dc613b8501 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/EnumTest.java @@ -81,7 +81,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_STRING = "enum_string"; @SerializedName(SERIALIZED_NAME_ENUM_STRING) - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -134,7 +134,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required"; @SerializedName(SERIALIZED_NAME_ENUM_STRING_REQUIRED) - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -185,7 +185,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_INTEGER = "enum_integer"; @SerializedName(SERIALIZED_NAME_ENUM_INTEGER) - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -236,7 +236,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_NUMBER = "enum_number"; @SerializedName(SERIALIZED_NAME_ENUM_NUMBER) - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; public static final String SERIALIZED_NAME_OUTER_ENUM = "outerEnum"; @SerializedName(SERIALIZED_NAME_OUTER_ENUM) diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FormatTest.java index 528a49bac3f..e2cc8f57fab 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/FormatTest.java @@ -36,55 +36,55 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { public static final String SERIALIZED_NAME_INTEGER = "integer"; @SerializedName(SERIALIZED_NAME_INTEGER) - private Integer integer = null; + private Integer integer; public static final String SERIALIZED_NAME_INT32 = "int32"; @SerializedName(SERIALIZED_NAME_INT32) - private Integer int32 = null; + private Integer int32; public static final String SERIALIZED_NAME_INT64 = "int64"; @SerializedName(SERIALIZED_NAME_INT64) - private Long int64 = null; + private Long int64; public static final String SERIALIZED_NAME_NUMBER = "number"; @SerializedName(SERIALIZED_NAME_NUMBER) - private BigDecimal number = null; + private BigDecimal number; public static final String SERIALIZED_NAME_FLOAT = "float"; @SerializedName(SERIALIZED_NAME_FLOAT) - private Float _float = null; + private Float _float; public static final String SERIALIZED_NAME_DOUBLE = "double"; @SerializedName(SERIALIZED_NAME_DOUBLE) - private Double _double = null; + private Double _double; public static final String SERIALIZED_NAME_STRING = "string"; @SerializedName(SERIALIZED_NAME_STRING) - private String string = null; + private String string; public static final String SERIALIZED_NAME_BYTE = "byte"; @SerializedName(SERIALIZED_NAME_BYTE) - private byte[] _byte = null; + private byte[] _byte; public static final String SERIALIZED_NAME_BINARY = "binary"; @SerializedName(SERIALIZED_NAME_BINARY) - private File binary = null; + private File binary; public static final String SERIALIZED_NAME_DATE = "date"; @SerializedName(SERIALIZED_NAME_DATE) - private LocalDate date = null; + private LocalDate date; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 602ff3afb43..597dcffd820 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -31,11 +31,11 @@ import java.io.IOException; public class HasOnlyReadOnly { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_FOO = "foo"; @SerializedName(SERIALIZED_NAME_FOO) - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MapTest.java index 8f4186f986d..bf598190bd1 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MapTest.java @@ -26,7 +26,6 @@ import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -94,7 +93,7 @@ public class MapTest { public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map"; @SerializedName(SERIALIZED_NAME_INDIRECT_MAP) - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -174,21 +173,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 96a6bc24503..6e69e3fe8be 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -37,11 +37,11 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; public static final String SERIALIZED_NAME_MAP = "map"; @SerializedName(SERIALIZED_NAME_MAP) diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Model200Response.java index fdc7ed42acb..2251a56b578 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Model200Response.java @@ -32,11 +32,11 @@ import java.io.IOException; public class Model200Response { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_PROPERTY_CLASS = "class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 1a871eeb59f..f5d77a2901b 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -31,15 +31,15 @@ import java.io.IOException; public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) - private Integer code = null; + private Integer code; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) - private String type = null; + private String type; public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelReturn.java index 83e7b1c601b..91bdd8d4b93 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -32,7 +32,7 @@ import java.io.IOException; public class ModelReturn { public static final String SERIALIZED_NAME_RETURN = "return"; @SerializedName(SERIALIZED_NAME_RETURN) - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Name.java index e88b3009cd6..e59fad09270 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Name.java @@ -32,19 +32,19 @@ import java.io.IOException; public class Name { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_SNAKE_CASE = "snake_case"; @SerializedName(SERIALIZED_NAME_SNAKE_CASE) - private Integer snakeCase = null; + private Integer snakeCase; public static final String SERIALIZED_NAME_PROPERTY = "property"; @SerializedName(SERIALIZED_NAME_PROPERTY) - private String property = null; + private String property; public static final String SERIALIZED_NAME_123NUMBER = "123Number"; @SerializedName(SERIALIZED_NAME_123NUMBER) - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/NumberOnly.java index 81cb0ece54d..0c0620ae66d 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -32,7 +32,7 @@ import java.math.BigDecimal; public class NumberOnly { public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; @SerializedName(SERIALIZED_NAME_JUST_NUMBER) - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Order.java index 3a679d5d79e..107a0c7bacc 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Order.java @@ -32,19 +32,19 @@ import org.threeten.bp.OffsetDateTime; public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_PET_ID = "petId"; @SerializedName(SERIALIZED_NAME_PET_ID) - private Long petId = null; + private Long petId; public static final String SERIALIZED_NAME_QUANTITY = "quantity"; @SerializedName(SERIALIZED_NAME_QUANTITY) - private Integer quantity = null; + private Integer quantity; public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; @SerializedName(SERIALIZED_NAME_SHIP_DATE) - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -97,7 +97,7 @@ public class Order { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public static final String SERIALIZED_NAME_COMPLETE = "complete"; @SerializedName(SERIALIZED_NAME_COMPLETE) diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/OuterComposite.java index 63b15607287..05fa264021e 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -32,15 +32,15 @@ import java.math.BigDecimal; public class OuterComposite { public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; @SerializedName(SERIALIZED_NAME_MY_NUMBER) - private BigDecimal myNumber = null; + private BigDecimal myNumber; public static final String SERIALIZED_NAME_MY_STRING = "my_string"; @SerializedName(SERIALIZED_NAME_MY_STRING) - private String myString = null; + private String myString; public static final String SERIALIZED_NAME_MY_BOOLEAN = "my_boolean"; @SerializedName(SERIALIZED_NAME_MY_BOOLEAN) - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Pet.java index 82dd8b088a6..f191512b221 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Pet.java @@ -35,7 +35,7 @@ import org.openapitools.client.model.Tag; public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_CATEGORY = "category"; @SerializedName(SERIALIZED_NAME_CATEGORY) @@ -43,7 +43,7 @@ public class Pet { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) @@ -104,7 +104,7 @@ public class Pet { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index c25d42c2724..e1496b4bc9a 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -31,11 +31,11 @@ import java.io.IOException; public class ReadOnlyFirst { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_BAZ = "baz"; @SerializedName(SERIALIZED_NAME_BAZ) - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/SpecialModelName.java index db6241ec143..510b8a00318 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -31,7 +31,7 @@ import java.io.IOException; public class SpecialModelName { public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Tag.java index c80a102aef4..f889117e7f0 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/Tag.java @@ -31,11 +31,11 @@ import java.io.IOException; public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/User.java index bcc3e9164db..b551c8d25d2 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/org/openapitools/client/model/User.java @@ -31,35 +31,35 @@ import java.io.IOException; public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_USERNAME = "username"; @SerializedName(SERIALIZED_NAME_USERNAME) - private String username = null; + private String username; public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; @SerializedName(SERIALIZED_NAME_FIRST_NAME) - private String firstName = null; + private String firstName; public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; @SerializedName(SERIALIZED_NAME_LAST_NAME) - private String lastName = null; + private String lastName; public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) - private String email = null; + private String email; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public static final String SERIALIZED_NAME_PHONE = "phone"; @SerializedName(SERIALIZED_NAME_PHONE) - private String phone = null; + private String phone; public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; @SerializedName(SERIALIZED_NAME_USER_STATUS) - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2rx/build.gradle b/samples/client/petstore/java/retrofit2rx/build.gradle index 79af8dae49d..9ea182cc720 100644 --- a/samples/client/petstore/java/retrofit2rx/build.gradle +++ b/samples/client/petstore/java/retrofit2rx/build.gradle @@ -96,7 +96,7 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" retrofit_version = "2.3.0" - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" junit_version = "4.12" rx_java_version = "1.3.0" threetenbp_version = "1.3.5" diff --git a/samples/client/petstore/java/retrofit2rx/build.sbt b/samples/client/petstore/java/retrofit2rx/build.sbt index 023b614314e..1cabf93331f 100644 --- a/samples/client/petstore/java/retrofit2rx/build.sbt +++ b/samples/client/petstore/java/retrofit2rx/build.sbt @@ -14,7 +14,7 @@ lazy val root = (project in file(".")). "com.squareup.retrofit2" % "converter-gson" % "2.3.0" % "compile", "com.squareup.retrofit2" % "adapter-rxjava" % "2.3.0" % "compile", "io.reactivex" % "rxjava" % "1.3.0" % "compile", - "io.swagger" % "swagger-annotations" % "1.5.17" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "org.threeten" % "threetenbp" % "1.3.5" % "compile", "io.gsonfire" % "gson-fire" % "1.8.0" % "compile", diff --git a/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md b/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md index 2d5d6ba1369..d529c54f05a 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/retrofit2rx/docs/MapTest.md b/samples/client/petstore/java/retrofit2rx/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/MapTest.md +++ b/samples/client/petstore/java/retrofit2rx/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/retrofit2rx/docs/PetApi.md b/samples/client/petstore/java/retrofit2rx/docs/PetApi.md index 0005f283293..829565c5db1 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/PetApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/retrofit2rx/docs/UserApi.md b/samples/client/petstore/java/retrofit2rx/docs/UserApi.md index 795bb22a03f..170d5027e1a 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/retrofit2rx/pom.xml b/samples/client/petstore/java/retrofit2rx/pom.xml index d438ede5b46..d764b2112d3 100644 --- a/samples/client/petstore/java/retrofit2rx/pom.xml +++ b/samples/client/petstore/java/retrofit2rx/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -191,7 +189,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} com.squareup.retrofit2 @@ -239,9 +237,6 @@ adapter-rxjava ${retrofit-version} - - - junit @@ -256,10 +251,10 @@ ${java.version} ${java.version} 1.8.0 - 1.5.18 + 1.5.21 2.3.0 - 1.3.0 - 1.3.5 + 1.3.0 + 1.3.5 1.0.1 4.12
diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/api/FakeApi.java index 3a696b4beb2..b871372608e 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/api/FakeApi.java @@ -118,16 +118,16 @@ public interface FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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 Observable<Void> */ @retrofit2.http.FormUrlEncoded @@ -139,9 +139,9 @@ public interface FakeApi { /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/api/PetApi.java index 6258d82a58b..66c9488578f 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/api/PetApi.java @@ -98,8 +98,8 @@ public interface PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @return Observable<Void> */ @retrofit2.http.FormUrlEncoded @@ -112,14 +112,14 @@ public interface PetApi { * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return Observable<ModelApiResponse> */ @retrofit2.http.Multipart @POST("pet/{petId}/uploadImage") Observable uploadFile( - @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file") MultipartBody.Part file + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part MultipartBody.Part file ); /** @@ -127,13 +127,13 @@ public interface PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return Observable<ModelApiResponse> */ @retrofit2.http.Multipart @POST("fake/{petId}/uploadImageWithRequiredFile") Observable uploadFileWithRequiredFile( - @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("requiredFile") MultipartBody.Part requiredFile, @retrofit2.http.Part("additionalMetadata") String additionalMetadata + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part MultipartBody.Part requiredFile, @retrofit2.http.Part("additionalMetadata") String additionalMetadata ); } diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Animal.java index 02469e22e51..4cc9f9fc81b 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Animal.java @@ -32,7 +32,7 @@ import java.io.IOException; public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className = null; + private String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Capitalization.java index bd3be0876f6..364dc3f2e4b 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Capitalization.java @@ -31,27 +31,27 @@ import java.io.IOException; public class Capitalization { public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) - private String smallCamel = null; + private String smallCamel; public static final String SERIALIZED_NAME_CAPITAL_CAMEL = "CapitalCamel"; @SerializedName(SERIALIZED_NAME_CAPITAL_CAMEL) - private String capitalCamel = null; + private String capitalCamel; public static final String SERIALIZED_NAME_SMALL_SNAKE = "small_Snake"; @SerializedName(SERIALIZED_NAME_SMALL_SNAKE) - private String smallSnake = null; + private String smallSnake; public static final String SERIALIZED_NAME_CAPITAL_SNAKE = "Capital_Snake"; @SerializedName(SERIALIZED_NAME_CAPITAL_SNAKE) - private String capitalSnake = null; + private String capitalSnake; public static final String SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; @SerializedName(SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS) - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; public static final String SERIALIZED_NAME_A_T_T_N_A_M_E = "ATT_NAME"; @SerializedName(SERIALIZED_NAME_A_T_T_N_A_M_E) - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Cat.java index cede1ca4c75..67827ff3973 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Cat.java @@ -32,7 +32,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Category.java index 7223fd28279..68177b01908 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Category.java @@ -31,11 +31,11 @@ import java.io.IOException; public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ClassModel.java index 3150b5919b0..225a08b9344 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ClassModel.java @@ -32,7 +32,7 @@ import java.io.IOException; public class ClassModel { public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Client.java index 219520a7ab1..a724368de1b 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Client.java @@ -31,7 +31,7 @@ import java.io.IOException; public class Client { public static final String SERIALIZED_NAME_CLIENT = "client"; @SerializedName(SERIALIZED_NAME_CLIENT) - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Dog.java index 3c86defe3c8..929dae95e51 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Dog.java @@ -32,7 +32,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/EnumArrays.java index c2f60d79983..4db242f3a11 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -80,7 +80,7 @@ public class EnumArrays { public static final String SERIALIZED_NAME_JUST_SYMBOL = "just_symbol"; @SerializedName(SERIALIZED_NAME_JUST_SYMBOL) - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/EnumTest.java index a2319a67a7d..1dc613b8501 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/EnumTest.java @@ -81,7 +81,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_STRING = "enum_string"; @SerializedName(SERIALIZED_NAME_ENUM_STRING) - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -134,7 +134,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required"; @SerializedName(SERIALIZED_NAME_ENUM_STRING_REQUIRED) - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -185,7 +185,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_INTEGER = "enum_integer"; @SerializedName(SERIALIZED_NAME_ENUM_INTEGER) - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -236,7 +236,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_NUMBER = "enum_number"; @SerializedName(SERIALIZED_NAME_ENUM_NUMBER) - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; public static final String SERIALIZED_NAME_OUTER_ENUM = "outerEnum"; @SerializedName(SERIALIZED_NAME_OUTER_ENUM) diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/FormatTest.java index 528a49bac3f..e2cc8f57fab 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/FormatTest.java @@ -36,55 +36,55 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { public static final String SERIALIZED_NAME_INTEGER = "integer"; @SerializedName(SERIALIZED_NAME_INTEGER) - private Integer integer = null; + private Integer integer; public static final String SERIALIZED_NAME_INT32 = "int32"; @SerializedName(SERIALIZED_NAME_INT32) - private Integer int32 = null; + private Integer int32; public static final String SERIALIZED_NAME_INT64 = "int64"; @SerializedName(SERIALIZED_NAME_INT64) - private Long int64 = null; + private Long int64; public static final String SERIALIZED_NAME_NUMBER = "number"; @SerializedName(SERIALIZED_NAME_NUMBER) - private BigDecimal number = null; + private BigDecimal number; public static final String SERIALIZED_NAME_FLOAT = "float"; @SerializedName(SERIALIZED_NAME_FLOAT) - private Float _float = null; + private Float _float; public static final String SERIALIZED_NAME_DOUBLE = "double"; @SerializedName(SERIALIZED_NAME_DOUBLE) - private Double _double = null; + private Double _double; public static final String SERIALIZED_NAME_STRING = "string"; @SerializedName(SERIALIZED_NAME_STRING) - private String string = null; + private String string; public static final String SERIALIZED_NAME_BYTE = "byte"; @SerializedName(SERIALIZED_NAME_BYTE) - private byte[] _byte = null; + private byte[] _byte; public static final String SERIALIZED_NAME_BINARY = "binary"; @SerializedName(SERIALIZED_NAME_BINARY) - private File binary = null; + private File binary; public static final String SERIALIZED_NAME_DATE = "date"; @SerializedName(SERIALIZED_NAME_DATE) - private LocalDate date = null; + private LocalDate date; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 602ff3afb43..597dcffd820 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -31,11 +31,11 @@ import java.io.IOException; public class HasOnlyReadOnly { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_FOO = "foo"; @SerializedName(SERIALIZED_NAME_FOO) - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/MapTest.java index 8f4186f986d..bf598190bd1 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/MapTest.java @@ -26,7 +26,6 @@ import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -94,7 +93,7 @@ public class MapTest { public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map"; @SerializedName(SERIALIZED_NAME_INDIRECT_MAP) - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -174,21 +173,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 96a6bc24503..6e69e3fe8be 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -37,11 +37,11 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; public static final String SERIALIZED_NAME_MAP = "map"; @SerializedName(SERIALIZED_NAME_MAP) diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Model200Response.java index fdc7ed42acb..2251a56b578 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Model200Response.java @@ -32,11 +32,11 @@ import java.io.IOException; public class Model200Response { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_PROPERTY_CLASS = "class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 1a871eeb59f..f5d77a2901b 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -31,15 +31,15 @@ import java.io.IOException; public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) - private Integer code = null; + private Integer code; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) - private String type = null; + private String type; public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ModelReturn.java index 83e7b1c601b..91bdd8d4b93 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -32,7 +32,7 @@ import java.io.IOException; public class ModelReturn { public static final String SERIALIZED_NAME_RETURN = "return"; @SerializedName(SERIALIZED_NAME_RETURN) - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Name.java index e88b3009cd6..e59fad09270 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Name.java @@ -32,19 +32,19 @@ import java.io.IOException; public class Name { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_SNAKE_CASE = "snake_case"; @SerializedName(SERIALIZED_NAME_SNAKE_CASE) - private Integer snakeCase = null; + private Integer snakeCase; public static final String SERIALIZED_NAME_PROPERTY = "property"; @SerializedName(SERIALIZED_NAME_PROPERTY) - private String property = null; + private String property; public static final String SERIALIZED_NAME_123NUMBER = "123Number"; @SerializedName(SERIALIZED_NAME_123NUMBER) - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/NumberOnly.java index 81cb0ece54d..0c0620ae66d 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -32,7 +32,7 @@ import java.math.BigDecimal; public class NumberOnly { public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; @SerializedName(SERIALIZED_NAME_JUST_NUMBER) - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Order.java index 3a679d5d79e..107a0c7bacc 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Order.java @@ -32,19 +32,19 @@ import org.threeten.bp.OffsetDateTime; public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_PET_ID = "petId"; @SerializedName(SERIALIZED_NAME_PET_ID) - private Long petId = null; + private Long petId; public static final String SERIALIZED_NAME_QUANTITY = "quantity"; @SerializedName(SERIALIZED_NAME_QUANTITY) - private Integer quantity = null; + private Integer quantity; public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; @SerializedName(SERIALIZED_NAME_SHIP_DATE) - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -97,7 +97,7 @@ public class Order { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public static final String SERIALIZED_NAME_COMPLETE = "complete"; @SerializedName(SERIALIZED_NAME_COMPLETE) diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/OuterComposite.java index 63b15607287..05fa264021e 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -32,15 +32,15 @@ import java.math.BigDecimal; public class OuterComposite { public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; @SerializedName(SERIALIZED_NAME_MY_NUMBER) - private BigDecimal myNumber = null; + private BigDecimal myNumber; public static final String SERIALIZED_NAME_MY_STRING = "my_string"; @SerializedName(SERIALIZED_NAME_MY_STRING) - private String myString = null; + private String myString; public static final String SERIALIZED_NAME_MY_BOOLEAN = "my_boolean"; @SerializedName(SERIALIZED_NAME_MY_BOOLEAN) - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Pet.java index 82dd8b088a6..f191512b221 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Pet.java @@ -35,7 +35,7 @@ import org.openapitools.client.model.Tag; public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_CATEGORY = "category"; @SerializedName(SERIALIZED_NAME_CATEGORY) @@ -43,7 +43,7 @@ public class Pet { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) @@ -104,7 +104,7 @@ public class Pet { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index c25d42c2724..e1496b4bc9a 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -31,11 +31,11 @@ import java.io.IOException; public class ReadOnlyFirst { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_BAZ = "baz"; @SerializedName(SERIALIZED_NAME_BAZ) - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/SpecialModelName.java index db6241ec143..510b8a00318 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -31,7 +31,7 @@ import java.io.IOException; public class SpecialModelName { public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Tag.java index c80a102aef4..f889117e7f0 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/Tag.java @@ -31,11 +31,11 @@ import java.io.IOException; public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/User.java index bcc3e9164db..b551c8d25d2 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/org/openapitools/client/model/User.java @@ -31,35 +31,35 @@ import java.io.IOException; public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_USERNAME = "username"; @SerializedName(SERIALIZED_NAME_USERNAME) - private String username = null; + private String username; public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; @SerializedName(SERIALIZED_NAME_FIRST_NAME) - private String firstName = null; + private String firstName; public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; @SerializedName(SERIALIZED_NAME_LAST_NAME) - private String lastName = null; + private String lastName; public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) - private String email = null; + private String email; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public static final String SERIALIZED_NAME_PHONE = "phone"; @SerializedName(SERIALIZED_NAME_PHONE) - private String phone = null; + private String phone; public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; @SerializedName(SERIALIZED_NAME_USER_STATUS) - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2rx2/build.gradle b/samples/client/petstore/java/retrofit2rx2/build.gradle index fc7fcf23f4c..44233fa5817 100644 --- a/samples/client/petstore/java/retrofit2rx2/build.gradle +++ b/samples/client/petstore/java/retrofit2rx2/build.gradle @@ -96,7 +96,7 @@ if(hasProperty('target') && target == 'android') { ext { oltu_version = "1.0.1" retrofit_version = "2.3.0" - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" junit_version = "4.12" rx_java_version = "2.1.1" threetenbp_version = "1.3.5" diff --git a/samples/client/petstore/java/retrofit2rx2/build.sbt b/samples/client/petstore/java/retrofit2rx2/build.sbt index 73856859866..fbdee2f1683 100644 --- a/samples/client/petstore/java/retrofit2rx2/build.sbt +++ b/samples/client/petstore/java/retrofit2rx2/build.sbt @@ -14,7 +14,7 @@ lazy val root = (project in file(".")). "com.squareup.retrofit2" % "converter-gson" % "2.3.0" % "compile", "com.squareup.retrofit2" % "adapter-rxjava2" % "2.3.0" % "compile", "io.reactivex.rxjava2" % "rxjava" % "2.1.1" % "compile", - "io.swagger" % "swagger-annotations" % "1.5.17" % "compile", + "io.swagger" % "swagger-annotations" % "1.5.21" % "compile", "org.apache.oltu.oauth2" % "org.apache.oltu.oauth2.client" % "1.0.1" % "compile", "org.threeten" % "threetenbp" % "1.3.5" % "compile", "io.gsonfire" % "gson-fire" % "1.8.0" % "compile", diff --git a/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md b/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md index 2d5d6ba1369..d529c54f05a 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/retrofit2rx2/docs/MapTest.md b/samples/client/petstore/java/retrofit2rx2/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/MapTest.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/retrofit2rx2/docs/PetApi.md b/samples/client/petstore/java/retrofit2rx2/docs/PetApi.md index 0005f283293..829565c5db1 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/PetApi.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/retrofit2rx2/docs/UserApi.md b/samples/client/petstore/java/retrofit2rx2/docs/UserApi.md index 795bb22a03f..170d5027e1a 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/UserApi.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/retrofit2rx2/pom.xml b/samples/client/petstore/java/retrofit2rx2/pom.xml index 0ffd258fae9..316cedb4f2e 100644 --- a/samples/client/petstore/java/retrofit2rx2/pom.xml +++ b/samples/client/petstore/java/retrofit2rx2/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -191,7 +189,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} com.squareup.retrofit2 @@ -239,9 +237,6 @@ adapter-rxjava2 ${retrofit-version} - - - junit @@ -256,10 +251,10 @@ ${java.version} ${java.version} 1.8.0 - 1.5.18 + 1.5.21 2.3.0 - 2.1.1 - 1.3.5 + 2.1.1 + 1.3.5 1.0.1 4.12
diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/FakeApi.java index b3c4309f641..f0196a69a2a 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/FakeApi.java @@ -119,16 +119,16 @@ public interface FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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 Completable */ @retrofit2.http.FormUrlEncoded @@ -140,9 +140,9 @@ public interface FakeApi { /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/PetApi.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/PetApi.java index bb0b709561c..47b71e74580 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/PetApi.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/api/PetApi.java @@ -99,8 +99,8 @@ public interface PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @return Completable */ @retrofit2.http.FormUrlEncoded @@ -113,14 +113,14 @@ public interface PetApi { * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return Observable<ModelApiResponse> */ @retrofit2.http.Multipart @POST("pet/{petId}/uploadImage") Observable uploadFile( - @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part("file") MultipartBody.Part file + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("additionalMetadata") String additionalMetadata, @retrofit2.http.Part MultipartBody.Part file ); /** @@ -128,13 +128,13 @@ public interface PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return Observable<ModelApiResponse> */ @retrofit2.http.Multipart @POST("fake/{petId}/uploadImageWithRequiredFile") Observable uploadFileWithRequiredFile( - @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part("requiredFile") MultipartBody.Part requiredFile, @retrofit2.http.Part("additionalMetadata") String additionalMetadata + @retrofit2.http.Path("petId") Long petId, @retrofit2.http.Part MultipartBody.Part requiredFile, @retrofit2.http.Part("additionalMetadata") String additionalMetadata ); } diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Animal.java index 02469e22e51..4cc9f9fc81b 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Animal.java @@ -32,7 +32,7 @@ import java.io.IOException; public class Animal { public static final String SERIALIZED_NAME_CLASS_NAME = "className"; @SerializedName(SERIALIZED_NAME_CLASS_NAME) - private String className = null; + private String className; public static final String SERIALIZED_NAME_COLOR = "color"; @SerializedName(SERIALIZED_NAME_COLOR) diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Capitalization.java index bd3be0876f6..364dc3f2e4b 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Capitalization.java @@ -31,27 +31,27 @@ import java.io.IOException; public class Capitalization { public static final String SERIALIZED_NAME_SMALL_CAMEL = "smallCamel"; @SerializedName(SERIALIZED_NAME_SMALL_CAMEL) - private String smallCamel = null; + private String smallCamel; public static final String SERIALIZED_NAME_CAPITAL_CAMEL = "CapitalCamel"; @SerializedName(SERIALIZED_NAME_CAPITAL_CAMEL) - private String capitalCamel = null; + private String capitalCamel; public static final String SERIALIZED_NAME_SMALL_SNAKE = "small_Snake"; @SerializedName(SERIALIZED_NAME_SMALL_SNAKE) - private String smallSnake = null; + private String smallSnake; public static final String SERIALIZED_NAME_CAPITAL_SNAKE = "Capital_Snake"; @SerializedName(SERIALIZED_NAME_CAPITAL_SNAKE) - private String capitalSnake = null; + private String capitalSnake; public static final String SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS = "SCA_ETH_Flow_Points"; @SerializedName(SERIALIZED_NAME_SC_A_E_T_H_FLOW_POINTS) - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; public static final String SERIALIZED_NAME_A_T_T_N_A_M_E = "ATT_NAME"; @SerializedName(SERIALIZED_NAME_A_T_T_N_A_M_E) - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Cat.java index cede1ca4c75..67827ff3973 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Cat.java @@ -32,7 +32,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { public static final String SERIALIZED_NAME_DECLAWED = "declawed"; @SerializedName(SERIALIZED_NAME_DECLAWED) - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Category.java index 7223fd28279..68177b01908 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Category.java @@ -31,11 +31,11 @@ import java.io.IOException; public class Category { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ClassModel.java index 3150b5919b0..225a08b9344 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ClassModel.java @@ -32,7 +32,7 @@ import java.io.IOException; public class ClassModel { public static final String SERIALIZED_NAME_PROPERTY_CLASS = "_class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Client.java index 219520a7ab1..a724368de1b 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Client.java @@ -31,7 +31,7 @@ import java.io.IOException; public class Client { public static final String SERIALIZED_NAME_CLIENT = "client"; @SerializedName(SERIALIZED_NAME_CLIENT) - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Dog.java index 3c86defe3c8..929dae95e51 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Dog.java @@ -32,7 +32,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { public static final String SERIALIZED_NAME_BREED = "breed"; @SerializedName(SERIALIZED_NAME_BREED) - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumArrays.java index c2f60d79983..4db242f3a11 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -80,7 +80,7 @@ public class EnumArrays { public static final String SERIALIZED_NAME_JUST_SYMBOL = "just_symbol"; @SerializedName(SERIALIZED_NAME_JUST_SYMBOL) - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumTest.java index a2319a67a7d..1dc613b8501 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/EnumTest.java @@ -81,7 +81,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_STRING = "enum_string"; @SerializedName(SERIALIZED_NAME_ENUM_STRING) - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -134,7 +134,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_STRING_REQUIRED = "enum_string_required"; @SerializedName(SERIALIZED_NAME_ENUM_STRING_REQUIRED) - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -185,7 +185,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_INTEGER = "enum_integer"; @SerializedName(SERIALIZED_NAME_ENUM_INTEGER) - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -236,7 +236,7 @@ public class EnumTest { public static final String SERIALIZED_NAME_ENUM_NUMBER = "enum_number"; @SerializedName(SERIALIZED_NAME_ENUM_NUMBER) - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; public static final String SERIALIZED_NAME_OUTER_ENUM = "outerEnum"; @SerializedName(SERIALIZED_NAME_OUTER_ENUM) diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FormatTest.java index 528a49bac3f..e2cc8f57fab 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/FormatTest.java @@ -36,55 +36,55 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { public static final String SERIALIZED_NAME_INTEGER = "integer"; @SerializedName(SERIALIZED_NAME_INTEGER) - private Integer integer = null; + private Integer integer; public static final String SERIALIZED_NAME_INT32 = "int32"; @SerializedName(SERIALIZED_NAME_INT32) - private Integer int32 = null; + private Integer int32; public static final String SERIALIZED_NAME_INT64 = "int64"; @SerializedName(SERIALIZED_NAME_INT64) - private Long int64 = null; + private Long int64; public static final String SERIALIZED_NAME_NUMBER = "number"; @SerializedName(SERIALIZED_NAME_NUMBER) - private BigDecimal number = null; + private BigDecimal number; public static final String SERIALIZED_NAME_FLOAT = "float"; @SerializedName(SERIALIZED_NAME_FLOAT) - private Float _float = null; + private Float _float; public static final String SERIALIZED_NAME_DOUBLE = "double"; @SerializedName(SERIALIZED_NAME_DOUBLE) - private Double _double = null; + private Double _double; public static final String SERIALIZED_NAME_STRING = "string"; @SerializedName(SERIALIZED_NAME_STRING) - private String string = null; + private String string; public static final String SERIALIZED_NAME_BYTE = "byte"; @SerializedName(SERIALIZED_NAME_BYTE) - private byte[] _byte = null; + private byte[] _byte; public static final String SERIALIZED_NAME_BINARY = "binary"; @SerializedName(SERIALIZED_NAME_BINARY) - private File binary = null; + private File binary; public static final String SERIALIZED_NAME_DATE = "date"; @SerializedName(SERIALIZED_NAME_DATE) - private LocalDate date = null; + private LocalDate date; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index 602ff3afb43..597dcffd820 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -31,11 +31,11 @@ import java.io.IOException; public class HasOnlyReadOnly { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_FOO = "foo"; @SerializedName(SERIALIZED_NAME_FOO) - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MapTest.java index 8f4186f986d..bf598190bd1 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MapTest.java @@ -26,7 +26,6 @@ import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -94,7 +93,7 @@ public class MapTest { public static final String SERIALIZED_NAME_INDIRECT_MAP = "indirect_map"; @SerializedName(SERIALIZED_NAME_INDIRECT_MAP) - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -174,21 +173,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 96a6bc24503..6e69e3fe8be 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -37,11 +37,11 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { public static final String SERIALIZED_NAME_UUID = "uuid"; @SerializedName(SERIALIZED_NAME_UUID) - private UUID uuid = null; + private UUID uuid; public static final String SERIALIZED_NAME_DATE_TIME = "dateTime"; @SerializedName(SERIALIZED_NAME_DATE_TIME) - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; public static final String SERIALIZED_NAME_MAP = "map"; @SerializedName(SERIALIZED_NAME_MAP) diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Model200Response.java index fdc7ed42acb..2251a56b578 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Model200Response.java @@ -32,11 +32,11 @@ import java.io.IOException; public class Model200Response { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_PROPERTY_CLASS = "class"; @SerializedName(SERIALIZED_NAME_PROPERTY_CLASS) - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 1a871eeb59f..f5d77a2901b 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -31,15 +31,15 @@ import java.io.IOException; public class ModelApiResponse { public static final String SERIALIZED_NAME_CODE = "code"; @SerializedName(SERIALIZED_NAME_CODE) - private Integer code = null; + private Integer code; public static final String SERIALIZED_NAME_TYPE = "type"; @SerializedName(SERIALIZED_NAME_TYPE) - private String type = null; + private String type; public static final String SERIALIZED_NAME_MESSAGE = "message"; @SerializedName(SERIALIZED_NAME_MESSAGE) - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelReturn.java index 83e7b1c601b..91bdd8d4b93 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -32,7 +32,7 @@ import java.io.IOException; public class ModelReturn { public static final String SERIALIZED_NAME_RETURN = "return"; @SerializedName(SERIALIZED_NAME_RETURN) - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Name.java index e88b3009cd6..e59fad09270 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Name.java @@ -32,19 +32,19 @@ import java.io.IOException; public class Name { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private Integer name = null; + private Integer name; public static final String SERIALIZED_NAME_SNAKE_CASE = "snake_case"; @SerializedName(SERIALIZED_NAME_SNAKE_CASE) - private Integer snakeCase = null; + private Integer snakeCase; public static final String SERIALIZED_NAME_PROPERTY = "property"; @SerializedName(SERIALIZED_NAME_PROPERTY) - private String property = null; + private String property; public static final String SERIALIZED_NAME_123NUMBER = "123Number"; @SerializedName(SERIALIZED_NAME_123NUMBER) - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/NumberOnly.java index 81cb0ece54d..0c0620ae66d 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -32,7 +32,7 @@ import java.math.BigDecimal; public class NumberOnly { public static final String SERIALIZED_NAME_JUST_NUMBER = "JustNumber"; @SerializedName(SERIALIZED_NAME_JUST_NUMBER) - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Order.java index 3a679d5d79e..107a0c7bacc 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Order.java @@ -32,19 +32,19 @@ import org.threeten.bp.OffsetDateTime; public class Order { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_PET_ID = "petId"; @SerializedName(SERIALIZED_NAME_PET_ID) - private Long petId = null; + private Long petId; public static final String SERIALIZED_NAME_QUANTITY = "quantity"; @SerializedName(SERIALIZED_NAME_QUANTITY) - private Integer quantity = null; + private Integer quantity; public static final String SERIALIZED_NAME_SHIP_DATE = "shipDate"; @SerializedName(SERIALIZED_NAME_SHIP_DATE) - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -97,7 +97,7 @@ public class Order { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public static final String SERIALIZED_NAME_COMPLETE = "complete"; @SerializedName(SERIALIZED_NAME_COMPLETE) diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/OuterComposite.java index 63b15607287..05fa264021e 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -32,15 +32,15 @@ import java.math.BigDecimal; public class OuterComposite { public static final String SERIALIZED_NAME_MY_NUMBER = "my_number"; @SerializedName(SERIALIZED_NAME_MY_NUMBER) - private BigDecimal myNumber = null; + private BigDecimal myNumber; public static final String SERIALIZED_NAME_MY_STRING = "my_string"; @SerializedName(SERIALIZED_NAME_MY_STRING) - private String myString = null; + private String myString; public static final String SERIALIZED_NAME_MY_BOOLEAN = "my_boolean"; @SerializedName(SERIALIZED_NAME_MY_BOOLEAN) - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Pet.java index 82dd8b088a6..f191512b221 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Pet.java @@ -35,7 +35,7 @@ import org.openapitools.client.model.Tag; public class Pet { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_CATEGORY = "category"; @SerializedName(SERIALIZED_NAME_CATEGORY) @@ -43,7 +43,7 @@ public class Pet { public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public static final String SERIALIZED_NAME_PHOTO_URLS = "photoUrls"; @SerializedName(SERIALIZED_NAME_PHOTO_URLS) @@ -104,7 +104,7 @@ public class Pet { public static final String SERIALIZED_NAME_STATUS = "status"; @SerializedName(SERIALIZED_NAME_STATUS) - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index c25d42c2724..e1496b4bc9a 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -31,11 +31,11 @@ import java.io.IOException; public class ReadOnlyFirst { public static final String SERIALIZED_NAME_BAR = "bar"; @SerializedName(SERIALIZED_NAME_BAR) - private String bar = null; + private String bar; public static final String SERIALIZED_NAME_BAZ = "baz"; @SerializedName(SERIALIZED_NAME_BAZ) - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/SpecialModelName.java index db6241ec143..510b8a00318 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -31,7 +31,7 @@ import java.io.IOException; public class SpecialModelName { public static final String SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME = "$special[property.name]"; @SerializedName(SERIALIZED_NAME_$_SPECIAL_PROPERTY_NAME) - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Tag.java index c80a102aef4..f889117e7f0 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/Tag.java @@ -31,11 +31,11 @@ import java.io.IOException; public class Tag { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_NAME = "name"; @SerializedName(SERIALIZED_NAME_NAME) - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/User.java index bcc3e9164db..b551c8d25d2 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/org/openapitools/client/model/User.java @@ -31,35 +31,35 @@ import java.io.IOException; public class User { public static final String SERIALIZED_NAME_ID = "id"; @SerializedName(SERIALIZED_NAME_ID) - private Long id = null; + private Long id; public static final String SERIALIZED_NAME_USERNAME = "username"; @SerializedName(SERIALIZED_NAME_USERNAME) - private String username = null; + private String username; public static final String SERIALIZED_NAME_FIRST_NAME = "firstName"; @SerializedName(SERIALIZED_NAME_FIRST_NAME) - private String firstName = null; + private String firstName; public static final String SERIALIZED_NAME_LAST_NAME = "lastName"; @SerializedName(SERIALIZED_NAME_LAST_NAME) - private String lastName = null; + private String lastName; public static final String SERIALIZED_NAME_EMAIL = "email"; @SerializedName(SERIALIZED_NAME_EMAIL) - private String email = null; + private String email; public static final String SERIALIZED_NAME_PASSWORD = "password"; @SerializedName(SERIALIZED_NAME_PASSWORD) - private String password = null; + private String password; public static final String SERIALIZED_NAME_PHONE = "phone"; @SerializedName(SERIALIZED_NAME_PHONE) - private String phone = null; + private String phone; public static final String SERIALIZED_NAME_USER_STATUS = "userStatus"; @SerializedName(SERIALIZED_NAME_USER_STATUS) - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/vertx/build.gradle b/samples/client/petstore/java/vertx/build.gradle index b10a98e8f1b..d55ccac8c36 100644 --- a/samples/client/petstore/java/vertx/build.gradle +++ b/samples/client/petstore/java/vertx/build.gradle @@ -26,7 +26,7 @@ task execute(type:JavaExec) { } ext { - swagger_annotations_version = "1.5.17" + swagger_annotations_version = "1.5.21" jackson_version = "2.6.4" vertx_version = "3.4.2" junit_version = "4.12" diff --git a/samples/client/petstore/java/vertx/docs/FakeApi.md b/samples/client/petstore/java/vertx/docs/FakeApi.md index e23fc8311ad..bbb141bb561 100644 --- a/samples/client/petstore/java/vertx/docs/FakeApi.md +++ b/samples/client/petstore/java/vertx/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None AsyncFile binary = new AsyncFile(); // AsyncFile | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **AsyncFile**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **AsyncFile**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/vertx/docs/MapTest.md b/samples/client/petstore/java/vertx/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/vertx/docs/MapTest.md +++ b/samples/client/petstore/java/vertx/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/vertx/docs/PetApi.md b/samples/client/petstore/java/vertx/docs/PetApi.md index 0bb5e1de8e0..4718ad675b1 100644 --- a/samples/client/petstore/java/vertx/docs/PetApi.md +++ b/samples/client/petstore/java/vertx/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,7 +405,7 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server AsyncFile file = new AsyncFile(); // AsyncFile | file to upload try { ModelApiResponse result = apiInstance.uploadFile(petId, additionalMetadata, file); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **AsyncFile**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **AsyncFile**| file to upload | [optional] ### Return type @@ -461,7 +461,7 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update AsyncFile requiredFile = new AsyncFile(); // AsyncFile | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **AsyncFile**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **AsyncFile**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/vertx/docs/UserApi.md b/samples/client/petstore/java/vertx/docs/UserApi.md index 102d04ac2c4..b7b880585f7 100644 --- a/samples/client/petstore/java/vertx/docs/UserApi.md +++ b/samples/client/petstore/java/vertx/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { diff --git a/samples/client/petstore/java/vertx/pom.xml b/samples/client/petstore/java/vertx/pom.xml index a7e7b8bb4ce..754d4660cae 100644 --- a/samples/client/petstore/java/vertx/pom.xml +++ b/samples/client/petstore/java/vertx/pom.xml @@ -114,8 +114,7 @@ - - src/main/java + src/main/java @@ -127,8 +126,7 @@ - - src/test/java + src/test/java @@ -200,7 +198,7 @@ io.swagger swagger-annotations - ${swagger-core-version} + ${swagger-annotations-version} @@ -260,7 +258,7 @@ UTF-8 3.4.2 - 1.5.18 + 1.5.21 2.6.4 4.12 diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/Pair.java index 18a0e96bfc7..0619e8c408b 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/Pair.java @@ -24,13 +24,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -44,8 +48,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/FakeApiImpl.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/FakeApiImpl.java index 10f02919299..96dc3fadc0f 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/FakeApiImpl.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/FakeApiImpl.java @@ -273,16 +273,16 @@ public class FakeApiImpl implements FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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) * @param resultHandler Asynchronous result handler */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, AsyncFile binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, Handler> resultHandler) { @@ -348,9 +348,9 @@ if (paramCallback != null) localVarFormParams.put("callback", paramCallback); /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApiImpl.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApiImpl.java index 8d14ef03ba6..9188af410bb 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApiImpl.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/PetApiImpl.java @@ -252,8 +252,8 @@ public class PetApiImpl implements PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @param resultHandler Asynchronous result handler */ public void updatePetWithForm(Long petId, String name, String status, Handler> resultHandler) { @@ -290,8 +290,8 @@ if (status != null) localVarFormParams.put("status", status); * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @param resultHandler Asynchronous result handler */ public void uploadFile(Long petId, String additionalMetadata, AsyncFile file, Handler> resultHandler) { @@ -329,7 +329,7 @@ if (file != null) localVarFormParams.put("file", file); * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @param resultHandler Asynchronous result handler */ public void uploadFileWithRequiredFile(Long petId, AsyncFile requiredFile, String additionalMetadata, Handler> resultHandler) { diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/FakeApi.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/FakeApi.java index 755e26f46a8..c1f17eaa765 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/FakeApi.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/FakeApi.java @@ -184,16 +184,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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) * @param resultHandler Asynchronous result handler */ public void testEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, AsyncFile binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback, Handler> resultHandler) { @@ -207,16 +207,16 @@ public class FakeApi { * @param _double None (required) * @param patternWithoutDelimiter None (required) * @param _byte None (required) - * @param integer None (optional, default to null) - * @param int32 None (optional, default to null) - * @param int64 None (optional, default to null) - * @param _float None (optional, default to null) - * @param string None (optional, default to null) - * @param binary None (optional, default to null) - * @param date None (optional, default to null) - * @param dateTime None (optional, default to null) - * @param password None (optional, default to null) - * @param paramCallback None (optional, default to null) + * @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 Asynchronous result handler (RxJava Single) */ public Single rxTestEndpointParameters(BigDecimal number, Double _double, String patternWithoutDelimiter, byte[] _byte, Integer integer, Integer int32, Long int64, Float _float, String string, AsyncFile binary, LocalDate date, OffsetDateTime dateTime, String password, String paramCallback) { @@ -227,9 +227,9 @@ public class FakeApi { /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) @@ -244,9 +244,9 @@ public class FakeApi { /** * To test enum parameters * To test enum parameters - * @param enumHeaderStringArray Header parameter enum test (string array) (optional) + * @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) + * @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) diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/PetApi.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/PetApi.java index dcdd28e163a..9955ec657dd 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/PetApi.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/api/rxjava/PetApi.java @@ -155,8 +155,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @param resultHandler Asynchronous result handler */ public void updatePetWithForm(Long petId, String name, String status, Handler> resultHandler) { @@ -167,8 +167,8 @@ public class PetApi { * 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, default to null) - * @param status Updated status of the pet (optional, default to null) + * @param name Updated name of the pet (optional) + * @param status Updated status of the pet (optional) * @return Asynchronous result handler (RxJava Single) */ public Single rxUpdatePetWithForm(Long petId, String name, String status) { @@ -180,8 +180,8 @@ public class PetApi { * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @param resultHandler Asynchronous result handler */ public void uploadFile(Long petId, String additionalMetadata, AsyncFile file, Handler> resultHandler) { @@ -192,8 +192,8 @@ public class PetApi { * uploads an image * * @param petId ID of pet to update (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) - * @param file file to upload (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) + * @param file file to upload (optional) * @return Asynchronous result handler (RxJava Single) */ public Single rxUploadFile(Long petId, String additionalMetadata, AsyncFile file) { @@ -206,7 +206,7 @@ public class PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @param resultHandler Asynchronous result handler */ public void uploadFileWithRequiredFile(Long petId, AsyncFile requiredFile, String additionalMetadata, Handler> resultHandler) { @@ -218,7 +218,7 @@ public class PetApi { * * @param petId ID of pet to update (required) * @param requiredFile file to upload (required) - * @param additionalMetadata Additional data to pass to server (optional, default to null) + * @param additionalMetadata Additional data to pass to server (optional) * @return Asynchronous result handler (RxJava Single) */ public Single rxUploadFileWithRequiredFile(Long petId, AsyncFile requiredFile, String additionalMetadata) { diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Animal.java index 6819bd7fe7d..5c049e200ff 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Animal.java @@ -35,7 +35,7 @@ import io.swagger.annotations.ApiModelProperty; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Capitalization.java index f0b2d5cd99f..061063eff71 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Capitalization.java @@ -27,22 +27,22 @@ import io.swagger.annotations.ApiModelProperty; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Cat.java index 76311c5de09..c5d652f6a3d 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Cat.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Category.java index 60f4d2b07b2..ffc9482ffc0 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Category.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ClassModel.java index d16a676db3d..4076399e9c5 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ClassModel.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Client.java index 290c475cb54..2fd30addec8 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Client.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Dog.java index b7beed2df53..a36ad9d7475 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Dog.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumArrays.java index 1caf492f5a2..abe6860634d 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -64,7 +64,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumTest.java index 122f370cef9..27e6dee1d11 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/EnumTest.java @@ -65,7 +65,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -105,7 +105,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -143,7 +143,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -181,7 +181,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/FormatTest.java index 8d9f4666ce9..d4f1f94de20 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/FormatTest.java @@ -32,43 +32,43 @@ import org.threeten.bp.OffsetDateTime; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private AsyncFile binary = null; + private AsyncFile binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index ddd9bfbf678..c9307f90621 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MapTest.java index 8e9c0d6cb1e..905b2258ede 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MapTest.java @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -75,7 +74,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -155,21 +154,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 4a295f6f71a..708f1491a5d 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -33,10 +33,10 @@ import org.threeten.bp.OffsetDateTime; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Model200Response.java index edef1b3e626..4d2da937512 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Model200Response.java @@ -28,10 +28,10 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 2f89b60db0b..04e167c98f6 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -27,13 +27,13 @@ import io.swagger.annotations.ApiModelProperty; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelReturn.java index 4adcfed3c3d..6c3bf33c6b1 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Name.java index 1f55823fcf4..da57f200d58 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Name.java @@ -28,16 +28,16 @@ import io.swagger.annotations.ApiModelProperty; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/NumberOnly.java index 7372bf2d2fd..e8952b8568d 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -28,7 +28,7 @@ import java.math.BigDecimal; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Order.java index 351e8ad268d..0e5fad25586 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Order.java @@ -28,16 +28,16 @@ import org.threeten.bp.OffsetDateTime; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -77,7 +77,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/OuterComposite.java index e1372035e86..864d298e107 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -28,13 +28,13 @@ import java.math.BigDecimal; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Pet.java index 0c495abb421..d84c2a6fc9d 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Pet.java @@ -31,13 +31,13 @@ import org.openapitools.client.model.Tag; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList<>(); @@ -83,7 +83,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 17bd805fa5c..edade3b2a37 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/SpecialModelName.java index f0181742543..494c9cd98ad 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Tag.java index 2607dc2a1a5..10334b74be4 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/Tag.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/User.java index 42d73dd62dc..0d0cd0d2908 100644 --- a/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/vertx/src/main/java/org/openapitools/client/model/User.java @@ -27,28 +27,28 @@ import io.swagger.annotations.ApiModelProperty; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/webclient/docs/FakeApi.md b/samples/client/petstore/java/webclient/docs/FakeApi.md index b550c716171..5ec1d20e445 100644 --- a/samples/client/petstore/java/webclient/docs/FakeApi.md +++ b/samples/client/petstore/java/webclient/docs/FakeApi.md @@ -357,18 +357,18 @@ http_basic_test.setPassword("YOUR PASSWORD"); FakeApi apiInstance = new FakeApi(); BigDecimal number = new BigDecimal(); // BigDecimal | None Double _double = 3.4D; // Double | None -String patternWithoutDelimiter = "null"; // String | None +String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None byte[] _byte = null; // byte[] | None -Integer integer = null; // Integer | None -Integer int32 = null; // Integer | None -Long int64 = nullL; // Long | None -Float _float = nullF; // Float | None -String string = "null"; // String | None -File binary = new File("null"); // File | None +Integer integer = 56; // Integer | None +Integer int32 = 56; // Integer | None +Long int64 = 56L; // Long | None +Float _float = 3.4F; // Float | None +String string = "string_example"; // String | None +File binary = new File("/path/to/file"); // File | None LocalDate date = new LocalDate(); // LocalDate | None OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None -String password = "null"; // String | None -String paramCallback = "null"; // String | None +String password = "password_example"; // String | None +String paramCallback = "paramCallback_example"; // String | None try { apiInstance.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } catch (ApiException e) { @@ -381,20 +381,20 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **number** | **BigDecimal**| None | [default to null] - **_double** | **Double**| None | [default to null] - **patternWithoutDelimiter** | **String**| None | [default to null] - **_byte** | **byte[]**| None | [default to null] - **integer** | **Integer**| None | [optional] [default to null] - **int32** | **Integer**| None | [optional] [default to null] - **int64** | **Long**| None | [optional] [default to null] - **_float** | **Float**| None | [optional] [default to null] - **string** | **String**| None | [optional] [default to null] - **binary** | **File**| None | [optional] [default to null] - **date** | **LocalDate**| None | [optional] [default to null] - **dateTime** | **OffsetDateTime**| None | [optional] [default to null] - **password** | **String**| None | [optional] [default to null] - **paramCallback** | **String**| None | [optional] [default to null] + **number** | **BigDecimal**| None | + **_double** | **Double**| None | + **patternWithoutDelimiter** | **String**| None | + **_byte** | **byte[]**| None | + **integer** | **Integer**| None | [optional] + **int32** | **Integer**| None | [optional] + **int64** | **Long**| None | [optional] + **_float** | **Float**| None | [optional] + **string** | **String**| None | [optional] + **binary** | **File**| None | [optional] + **date** | **LocalDate**| None | [optional] + **dateTime** | **OffsetDateTime**| None | [optional] + **password** | **String**| None | [optional] + **paramCallback** | **String**| None | [optional] ### Return type @@ -425,9 +425,9 @@ To test enum parameters FakeApi apiInstance = new FakeApi(); -List enumHeaderStringArray = Arrays.asList("enumHeaderStringArray_example"); // List | Header parameter enum test (string array) +List enumHeaderStringArray = Arrays.asList("$"); // List | Header parameter enum test (string array) String enumHeaderString = "-efg"; // String | Header parameter enum test (string) -List enumQueryStringArray = Arrays.asList("enumQueryStringArray_example"); // List | Query parameter enum test (string array) +List enumQueryStringArray = Arrays.asList("$"); // List | Query parameter enum test (string array) String enumQueryString = "-efg"; // String | Query parameter enum test (string) Integer enumQueryInteger = 56; // Integer | Query parameter enum test (double) Double enumQueryDouble = 3.4D; // Double | Query parameter enum test (double) @@ -451,7 +451,7 @@ Name | Type | Description | Notes **enumQueryString** | **String**| Query parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] **enumQueryInteger** | **Integer**| Query parameter enum test (double) | [optional] [enum: 1, -2] **enumQueryDouble** | **Double**| Query parameter enum test (double) | [optional] [enum: 1.1, -1.2] - **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [default to $] [enum: >, $] + **enumFormStringArray** | [**List<String>**](String.md)| Form parameter enum test (string array) | [optional] [enum: >, $] **enumFormString** | **String**| Form parameter enum test (string) | [optional] [default to -efg] [enum: _abc, -efg, (xyz)] ### Return type @@ -523,8 +523,8 @@ test json serialization of form data FakeApi apiInstance = new FakeApi(); -String param = "null"; // String | field1 -String param2 = "null"; // String | field2 +String param = "param_example"; // String | field1 +String param2 = "param2_example"; // String | field2 try { apiInstance.testJsonFormData(param, param2); } catch (ApiException e) { @@ -537,8 +537,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **param** | **String**| field1 | [default to null] - **param2** | **String**| field2 | [default to null] + **param** | **String**| field1 | + **param2** | **String**| field2 | ### Return type diff --git a/samples/client/petstore/java/webclient/docs/MapTest.md b/samples/client/petstore/java/webclient/docs/MapTest.md index f3b592d43fe..c8387ad9af2 100644 --- a/samples/client/petstore/java/webclient/docs/MapTest.md +++ b/samples/client/petstore/java/webclient/docs/MapTest.md @@ -7,7 +7,7 @@ Name | Type | Description | Notes **mapMapOfString** | [**Map<String, Map<String, String>>**](Map.md) | | [optional] **mapOfEnumString** | [**Map<String, InnerEnum>**](#Map<String, InnerEnum>) | | [optional] **directMap** | **Map<String, Boolean>** | | [optional] -**indirectMap** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirectMap** | **Map<String, Boolean>** | | [optional] diff --git a/samples/client/petstore/java/webclient/docs/PetApi.md b/samples/client/petstore/java/webclient/docs/PetApi.md index 41c08ccf9e3..8d621d1682a 100644 --- a/samples/client/petstore/java/webclient/docs/PetApi.md +++ b/samples/client/petstore/java/webclient/docs/PetApi.md @@ -141,7 +141,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List status = Arrays.asList("status_example"); // List | Status values that need to be considered for filter +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); @@ -194,7 +194,7 @@ OAuth petstore_auth = (OAuth) defaultClient.getAuthentication("petstore_auth"); petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); -List tags = Arrays.asList("tags_example"); // List | Tags to filter by +List tags = Arrays.asList(); // List | Tags to filter by try { List result = apiInstance.findPetsByTags(tags); System.out.println(result); @@ -351,8 +351,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet that needs to be updated -String name = "null"; // String | Updated name of the pet -String status = "null"; // String | Updated status of the pet +String name = "name_example"; // String | Updated name of the pet +String status = "status_example"; // String | Updated status of the pet try { apiInstance.updatePetWithForm(petId, name, status); } catch (ApiException e) { @@ -366,8 +366,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet that needs to be updated | - **name** | **String**| Updated name of the pet | [optional] [default to null] - **status** | **String**| Updated status of the pet | [optional] [default to null] + **name** | **String**| Updated name of the pet | [optional] + **status** | **String**| Updated status of the pet | [optional] ### Return type @@ -405,8 +405,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -String additionalMetadata = "null"; // String | Additional data to pass to server -File file = new File("null"); // File | file to upload +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); @@ -421,8 +421,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] - **file** | **File**| file to upload | [optional] [default to null] + **additionalMetadata** | **String**| Additional data to pass to server | [optional] + **file** | **File**| file to upload | [optional] ### Return type @@ -460,8 +460,8 @@ petstore_auth.setAccessToken("YOUR ACCESS TOKEN"); PetApi apiInstance = new PetApi(); Long petId = 56L; // Long | ID of pet to update -File requiredFile = new File("null"); // File | file to upload -String additionalMetadata = "null"; // String | Additional data to pass to server +File requiredFile = new File("/path/to/file"); // File | file to upload +String additionalMetadata = "additionalMetadata_example"; // String | Additional data to pass to server try { ModelApiResponse result = apiInstance.uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata); System.out.println(result); @@ -476,8 +476,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **petId** | **Long**| ID of pet to update | - **requiredFile** | **File**| file to upload | [default to null] - **additionalMetadata** | **String**| Additional data to pass to server | [optional] [default to null] + **requiredFile** | **File**| file to upload | + **additionalMetadata** | **String**| Additional data to pass to server | [optional] ### Return type diff --git a/samples/client/petstore/java/webclient/docs/UserApi.md b/samples/client/petstore/java/webclient/docs/UserApi.md index 102d04ac2c4..b7b880585f7 100644 --- a/samples/client/petstore/java/webclient/docs/UserApi.md +++ b/samples/client/petstore/java/webclient/docs/UserApi.md @@ -72,7 +72,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithArrayInput(user); } catch (ApiException e) { @@ -114,7 +114,7 @@ Creates list of users with given input array UserApi apiInstance = new UserApi(); -List user = Arrays.asList(new List()); // List | List of user object +List user = Arrays.asList(null); // List | List of user object try { apiInstance.createUsersWithListInput(user); } catch (ApiException e) { 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 ee1885811e6..7d5f7dd66bb 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 @@ -33,6 +33,7 @@ import org.springframework.web.reactive.function.BodyInserters; import org.springframework.web.reactive.function.client.ExchangeStrategies; import reactor.core.publisher.Mono; import reactor.core.publisher.Flux; +import java.util.Optional; import java.io.BufferedReader; import java.io.IOException; @@ -76,7 +77,7 @@ public class ApiClient { } private HttpHeaders defaultHeaders = new HttpHeaders(); - + private String basePath = "http://petstore.swagger.io:80/v2"; private final WebClient webClient; @@ -87,16 +88,22 @@ public class ApiClient { public ApiClient() { this.dateFormat = createDefaultDateFormat(); - this.webClient = buildWebClient(new ObjectMapper(), this.dateFormat); + this.webClient = buildWebClient(new ObjectMapper(), dateFormat); + this.init(); } public ApiClient(ObjectMapper mapper, DateFormat format) { this(buildWebClient(mapper.copy(), format), format); } + public ApiClient(WebClient webClient, ObjectMapper mapper, DateFormat format) { + this(Optional.ofNullable(webClient).orElseGet(() ->buildWebClient(mapper.copy(), format)), format); + } + private ApiClient(WebClient webClient, DateFormat format) { this.webClient = webClient; this.dateFormat = format; + this.init(); } public DateFormat createDefaultDateFormat() { @@ -104,7 +111,7 @@ public class ApiClient { dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); return dateFormat; } - + protected void init() { // Setup authentications (key: authentication name, value: authentication). authentications = new HashMap(); @@ -133,7 +140,7 @@ public class ApiClient { return webClient.build(); } - + /** * Get the current base path * @return String the base path @@ -539,7 +546,7 @@ public class ApiClient { builder.queryParams(queryParams); } - final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(builder.build().toUri()); + final WebClient.RequestBodySpec requestBuilder = webClient.method(method).uri(builder.build(true).toUri()); if(accept != null) { requestBuilder.accept(accept.toArray(new MediaType[accept.size()])); } @@ -586,7 +593,7 @@ public class ApiClient { auth.applyToParams(queryParams, headerParams); } } - + private class ApiClientHttpRequestInterceptor implements ClientHttpRequestInterceptor { private final Log log = LogFactory.getLog(ApiClientHttpRequestInterceptor.class); @@ -625,7 +632,7 @@ public class ApiClient { builder.setLength(builder.length() - 1); // Get rid of trailing comma return builder.toString(); } - + private String bodyToString(InputStream body) throws IOException { StringBuilder builder = new StringBuilder(); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(body, StandardCharsets.UTF_8)); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Pair.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Pair.java index 18a0e96bfc7..0619e8c408b 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Pair.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/Pair.java @@ -24,13 +24,17 @@ public class Pair { } private void setName(String name) { - if (!isValidString(name)) return; + if (!isValidString(name)) { + return; + } this.name = name; } private void setValue(String value) { - if (!isValidString(value)) return; + if (!isValidString(value)) { + return; + } this.value = value; } @@ -44,8 +48,13 @@ public class Pair { } private boolean isValidString(String arg) { - if (arg == null) return false; - if (arg.trim().isEmpty()) return false; + if (arg == null) { + return false; + } + + if (arg.trim().isEmpty()) { + return false; + } return true; } diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/StringUtil.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/StringUtil.java index b731bc530e2..c51b3bcf661 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/StringUtil.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/StringUtil.java @@ -24,8 +24,12 @@ public class StringUtil { */ public static boolean containsIgnoreCase(String[] array, String value) { for (String str : array) { - if (value == null && str == null) return true; - if (value != null && value.equalsIgnoreCase(str)) return true; + if (value == null && str == null) { + return true; + } + if (value != null && value.equalsIgnoreCase(str)) { + return true; + } } return false; } @@ -43,7 +47,9 @@ public class StringUtil { */ public static String join(String[] array, String separator) { int len = array.length; - if (len == 0) return ""; + if (len == 0) { + return ""; + } StringBuilder out = new StringBuilder(); out.append(array[0]); diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java index 6819bd7fe7d..5c049e200ff 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Animal.java @@ -35,7 +35,7 @@ import io.swagger.annotations.ApiModelProperty; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Capitalization.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Capitalization.java index f0b2d5cd99f..061063eff71 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Capitalization.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Capitalization.java @@ -27,22 +27,22 @@ import io.swagger.annotations.ApiModelProperty; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java index 76311c5de09..c5d652f6a3d 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Cat.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Category.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Category.java index 60f4d2b07b2..ffc9482ffc0 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Category.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Category.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ClassModel.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ClassModel.java index d16a676db3d..4076399e9c5 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ClassModel.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ClassModel.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Client.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Client.java index 290c475cb54..2fd30addec8 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Client.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Client.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java index b7beed2df53..a36ad9d7475 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Dog.java @@ -28,7 +28,7 @@ import org.openapitools.client.model.Animal; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumArrays.java index 1caf492f5a2..abe6860634d 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -64,7 +64,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumTest.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumTest.java index 122f370cef9..27e6dee1d11 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumTest.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/EnumTest.java @@ -65,7 +65,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -105,7 +105,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -143,7 +143,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -181,7 +181,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FormatTest.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FormatTest.java index 3f8ceea5022..e2060dc5c58 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FormatTest.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/FormatTest.java @@ -32,43 +32,43 @@ import java.util.UUID; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java index ddd9bfbf678..c9307f90621 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/HasOnlyReadOnly.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MapTest.java index 8e9c0d6cb1e..905b2258ede 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MapTest.java @@ -23,7 +23,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.client.model.StringBooleanMap; /** * MapTest @@ -75,7 +74,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -155,21 +154,29 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index 1fc647e6bbd..5c9562605fc 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -33,10 +33,10 @@ import org.openapitools.client.model.Animal; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Model200Response.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Model200Response.java index edef1b3e626..4d2da937512 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Model200Response.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Model200Response.java @@ -28,10 +28,10 @@ import io.swagger.annotations.ApiModelProperty; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelApiResponse.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelApiResponse.java index 2f89b60db0b..04e167c98f6 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelApiResponse.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelApiResponse.java @@ -27,13 +27,13 @@ import io.swagger.annotations.ApiModelProperty; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelReturn.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelReturn.java index 4adcfed3c3d..6c3bf33c6b1 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelReturn.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ModelReturn.java @@ -28,7 +28,7 @@ import io.swagger.annotations.ApiModelProperty; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Name.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Name.java index 1f55823fcf4..da57f200d58 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Name.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Name.java @@ -28,16 +28,16 @@ import io.swagger.annotations.ApiModelProperty; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/NumberOnly.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/NumberOnly.java index 7372bf2d2fd..e8952b8568d 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/NumberOnly.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/NumberOnly.java @@ -28,7 +28,7 @@ import java.math.BigDecimal; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Order.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Order.java index ced70217682..bc23e2ab4ee 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Order.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Order.java @@ -28,16 +28,16 @@ import java.time.OffsetDateTime; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -77,7 +77,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/OuterComposite.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/OuterComposite.java index e1372035e86..864d298e107 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/OuterComposite.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/OuterComposite.java @@ -28,13 +28,13 @@ import java.math.BigDecimal; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Pet.java index 0c495abb421..d84c2a6fc9d 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Pet.java @@ -31,13 +31,13 @@ import org.openapitools.client.model.Tag; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList<>(); @@ -83,7 +83,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java index 17bd805fa5c..edade3b2a37 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/ReadOnlyFirst.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/SpecialModelName.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/SpecialModelName.java index f0181742543..494c9cd98ad 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/SpecialModelName.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/SpecialModelName.java @@ -27,7 +27,7 @@ import io.swagger.annotations.ApiModelProperty; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Tag.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Tag.java index 2607dc2a1a5..10334b74be4 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Tag.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/Tag.java @@ -27,10 +27,10 @@ import io.swagger.annotations.ApiModelProperty; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/User.java b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/User.java index 42d73dd62dc..0d0cd0d2908 100644 --- a/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/User.java +++ b/samples/client/petstore/java/webclient/src/main/java/org/openapitools/client/model/User.java @@ -27,28 +27,28 @@ import io.swagger.annotations.ApiModelProperty; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/javascript-es6/.openapi-generator/VERSION b/samples/client/petstore/javascript-es6/.openapi-generator/VERSION index 14900cee60e..6d94c9c2e12 100644 --- a/samples/client/petstore/javascript-es6/.openapi-generator/VERSION +++ b/samples/client/petstore/javascript-es6/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.1-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/javascript-es6/src/ApiClient.js b/samples/client/petstore/javascript-es6/src/ApiClient.js index 85db2a42984..5f0486a1841 100644 --- a/samples/client/petstore/javascript-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-es6/src/ApiClient.js @@ -417,7 +417,7 @@ class ApiClient { // Attach previously saved cookies, if enabled if (this.enableCookies){ if (typeof window === 'undefined') { - this.agent.attachCookies(request); + this.agent._attachCookies(request); } else { request.withCredentials(); @@ -433,7 +433,7 @@ class ApiClient { try { data = this.deserialize(response, returnType); if (this.enableCookies && typeof window === 'undefined'){ - this.agent.saveCookies(response); + this.agent._saveCookies(response); } } catch (err) { error = err; diff --git a/samples/client/petstore/javascript-promise-es6/.openapi-generator/VERSION b/samples/client/petstore/javascript-promise-es6/.openapi-generator/VERSION index 14900cee60e..6d94c9c2e12 100644 --- a/samples/client/petstore/javascript-promise-es6/.openapi-generator/VERSION +++ b/samples/client/petstore/javascript-promise-es6/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.1-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js index 330df9845a0..4ce5c1e48d3 100644 --- a/samples/client/petstore/javascript-promise-es6/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise-es6/src/ApiClient.js @@ -410,7 +410,7 @@ class ApiClient { // Attach previously saved cookies, if enabled if (this.enableCookies){ if (typeof window === 'undefined') { - this.agent.attachCookies(request); + this.agent._attachCookies(request); } else { request.withCredentials(); @@ -425,7 +425,7 @@ class ApiClient { try { var data = this.deserialize(response, returnType); if (this.enableCookies && typeof window === 'undefined'){ - this.agent.saveCookies(response); + this.agent._saveCookies(response); } resolve({data, response}); diff --git a/samples/client/petstore/javascript-promise/.openapi-generator/VERSION b/samples/client/petstore/javascript-promise/.openapi-generator/VERSION index 14900cee60e..6d94c9c2e12 100644 --- a/samples/client/petstore/javascript-promise/.openapi-generator/VERSION +++ b/samples/client/petstore/javascript-promise/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.1-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/javascript-promise/src/ApiClient.js b/samples/client/petstore/javascript-promise/src/ApiClient.js index b2151bf9f42..dd286d4987c 100644 --- a/samples/client/petstore/javascript-promise/src/ApiClient.js +++ b/samples/client/petstore/javascript-promise/src/ApiClient.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * @@ -460,7 +460,7 @@ // Attach previously saved cookies, if enabled if (this.enableCookies){ if (typeof window === 'undefined') { - this.agent.attachCookies(request); + this.agent._attachCookies(request); } else { request.withCredentials(); @@ -475,7 +475,7 @@ try { var data = _this.deserialize(response, returnType); if (_this.enableCookies && typeof window === 'undefined'){ - _this.agent.saveCookies(response); + _this.agent._saveCookies(response); } resolve({data: data, response: response}); } catch (err) { diff --git a/samples/client/petstore/javascript-promise/src/api/AnotherFakeApi.js b/samples/client/petstore/javascript-promise/src/api/AnotherFakeApi.js index 84c0b45c7cd..d744580ecdd 100644 --- a/samples/client/petstore/javascript-promise/src/api/AnotherFakeApi.js +++ b/samples/client/petstore/javascript-promise/src/api/AnotherFakeApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/api/FakeApi.js b/samples/client/petstore/javascript-promise/src/api/FakeApi.js index 284f964a43c..a26b09ce175 100644 --- a/samples/client/petstore/javascript-promise/src/api/FakeApi.js +++ b/samples/client/petstore/javascript-promise/src/api/FakeApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/api/FakeClassnameTags123Api.js b/samples/client/petstore/javascript-promise/src/api/FakeClassnameTags123Api.js index 409db18bdb9..b626387882b 100644 --- a/samples/client/petstore/javascript-promise/src/api/FakeClassnameTags123Api.js +++ b/samples/client/petstore/javascript-promise/src/api/FakeClassnameTags123Api.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/api/PetApi.js b/samples/client/petstore/javascript-promise/src/api/PetApi.js index 15db5e00a60..68519c5a1d5 100644 --- a/samples/client/petstore/javascript-promise/src/api/PetApi.js +++ b/samples/client/petstore/javascript-promise/src/api/PetApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/api/StoreApi.js b/samples/client/petstore/javascript-promise/src/api/StoreApi.js index 517f01e2c83..d00779af1a2 100644 --- a/samples/client/petstore/javascript-promise/src/api/StoreApi.js +++ b/samples/client/petstore/javascript-promise/src/api/StoreApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/api/UserApi.js b/samples/client/petstore/javascript-promise/src/api/UserApi.js index 2dfa2d9429d..82f0c1a06a6 100644 --- a/samples/client/petstore/javascript-promise/src/api/UserApi.js +++ b/samples/client/petstore/javascript-promise/src/api/UserApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/index.js b/samples/client/petstore/javascript-promise/src/index.js index 3f904b570ca..1eebdbf5ff3 100644 --- a/samples/client/petstore/javascript-promise/src/index.js +++ b/samples/client/petstore/javascript-promise/src/index.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/AdditionalPropertiesClass.js b/samples/client/petstore/javascript-promise/src/model/AdditionalPropertiesClass.js index 3e41a2906a5..e41dca8e660 100644 --- a/samples/client/petstore/javascript-promise/src/model/AdditionalPropertiesClass.js +++ b/samples/client/petstore/javascript-promise/src/model/AdditionalPropertiesClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/Animal.js b/samples/client/petstore/javascript-promise/src/model/Animal.js index 5ec0fe427cb..43aaacc12b5 100644 --- a/samples/client/petstore/javascript-promise/src/model/Animal.js +++ b/samples/client/petstore/javascript-promise/src/model/Animal.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/AnimalFarm.js b/samples/client/petstore/javascript-promise/src/model/AnimalFarm.js index f8099197245..f3d2c132d12 100644 --- a/samples/client/petstore/javascript-promise/src/model/AnimalFarm.js +++ b/samples/client/petstore/javascript-promise/src/model/AnimalFarm.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/ApiResponse.js b/samples/client/petstore/javascript-promise/src/model/ApiResponse.js index d3236a99234..2d33b0b7a23 100644 --- a/samples/client/petstore/javascript-promise/src/model/ApiResponse.js +++ b/samples/client/petstore/javascript-promise/src/model/ApiResponse.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/ArrayOfArrayOfNumberOnly.js b/samples/client/petstore/javascript-promise/src/model/ArrayOfArrayOfNumberOnly.js index e7ac7b24a33..41463b0e371 100644 --- a/samples/client/petstore/javascript-promise/src/model/ArrayOfArrayOfNumberOnly.js +++ b/samples/client/petstore/javascript-promise/src/model/ArrayOfArrayOfNumberOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/ArrayOfNumberOnly.js b/samples/client/petstore/javascript-promise/src/model/ArrayOfNumberOnly.js index 7c98321c3d4..f3b0ac217e1 100644 --- a/samples/client/petstore/javascript-promise/src/model/ArrayOfNumberOnly.js +++ b/samples/client/petstore/javascript-promise/src/model/ArrayOfNumberOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/ArrayTest.js b/samples/client/petstore/javascript-promise/src/model/ArrayTest.js index 0f47e3e78ef..6b8aeade8b0 100644 --- a/samples/client/petstore/javascript-promise/src/model/ArrayTest.js +++ b/samples/client/petstore/javascript-promise/src/model/ArrayTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/Capitalization.js b/samples/client/petstore/javascript-promise/src/model/Capitalization.js index 9f5e832699d..67c027686a9 100644 --- a/samples/client/petstore/javascript-promise/src/model/Capitalization.js +++ b/samples/client/petstore/javascript-promise/src/model/Capitalization.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/Cat.js b/samples/client/petstore/javascript-promise/src/model/Cat.js index 4c1d8f0c845..6f8ca2e91fd 100644 --- a/samples/client/petstore/javascript-promise/src/model/Cat.js +++ b/samples/client/petstore/javascript-promise/src/model/Cat.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/Category.js b/samples/client/petstore/javascript-promise/src/model/Category.js index 560f1a94013..ba82e88bd49 100644 --- a/samples/client/petstore/javascript-promise/src/model/Category.js +++ b/samples/client/petstore/javascript-promise/src/model/Category.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/ClassModel.js b/samples/client/petstore/javascript-promise/src/model/ClassModel.js index cadf752c644..6592fdeebc9 100644 --- a/samples/client/petstore/javascript-promise/src/model/ClassModel.js +++ b/samples/client/petstore/javascript-promise/src/model/ClassModel.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/Client.js b/samples/client/petstore/javascript-promise/src/model/Client.js index 7bf09ed3ac6..00fe25ca2d7 100644 --- a/samples/client/petstore/javascript-promise/src/model/Client.js +++ b/samples/client/petstore/javascript-promise/src/model/Client.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/Dog.js b/samples/client/petstore/javascript-promise/src/model/Dog.js index 93f8f38ae13..7a74ef477b4 100644 --- a/samples/client/petstore/javascript-promise/src/model/Dog.js +++ b/samples/client/petstore/javascript-promise/src/model/Dog.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/EnumArrays.js b/samples/client/petstore/javascript-promise/src/model/EnumArrays.js index d7b36eb6307..7bbb3af35d2 100644 --- a/samples/client/petstore/javascript-promise/src/model/EnumArrays.js +++ b/samples/client/petstore/javascript-promise/src/model/EnumArrays.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/EnumClass.js b/samples/client/petstore/javascript-promise/src/model/EnumClass.js index d2f7c69374b..3a8a7f52d94 100644 --- a/samples/client/petstore/javascript-promise/src/model/EnumClass.js +++ b/samples/client/petstore/javascript-promise/src/model/EnumClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/EnumTest.js b/samples/client/petstore/javascript-promise/src/model/EnumTest.js index e6f1a7ea9e4..25d166c5c8a 100644 --- a/samples/client/petstore/javascript-promise/src/model/EnumTest.js +++ b/samples/client/petstore/javascript-promise/src/model/EnumTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/File.js b/samples/client/petstore/javascript-promise/src/model/File.js index aa7449e2907..706f20eff08 100644 --- a/samples/client/petstore/javascript-promise/src/model/File.js +++ b/samples/client/petstore/javascript-promise/src/model/File.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/FileSchemaTestClass.js b/samples/client/petstore/javascript-promise/src/model/FileSchemaTestClass.js index f2f1b8e966a..2bc85b700b0 100644 --- a/samples/client/petstore/javascript-promise/src/model/FileSchemaTestClass.js +++ b/samples/client/petstore/javascript-promise/src/model/FileSchemaTestClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/FormatTest.js b/samples/client/petstore/javascript-promise/src/model/FormatTest.js index ea6d1966613..679e769b5b2 100644 --- a/samples/client/petstore/javascript-promise/src/model/FormatTest.js +++ b/samples/client/petstore/javascript-promise/src/model/FormatTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/HasOnlyReadOnly.js b/samples/client/petstore/javascript-promise/src/model/HasOnlyReadOnly.js index b6470082caf..6b42db4416e 100644 --- a/samples/client/petstore/javascript-promise/src/model/HasOnlyReadOnly.js +++ b/samples/client/petstore/javascript-promise/src/model/HasOnlyReadOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/List.js b/samples/client/petstore/javascript-promise/src/model/List.js index 3b9f343524e..05c95f2613a 100644 --- a/samples/client/petstore/javascript-promise/src/model/List.js +++ b/samples/client/petstore/javascript-promise/src/model/List.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/MapTest.js b/samples/client/petstore/javascript-promise/src/model/MapTest.js index 8563624adff..65b317db8b5 100644 --- a/samples/client/petstore/javascript-promise/src/model/MapTest.js +++ b/samples/client/petstore/javascript-promise/src/model/MapTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/MixedPropertiesAndAdditionalPropertiesClass.js b/samples/client/petstore/javascript-promise/src/model/MixedPropertiesAndAdditionalPropertiesClass.js index ff56b0e4981..9291b7ba8a4 100644 --- a/samples/client/petstore/javascript-promise/src/model/MixedPropertiesAndAdditionalPropertiesClass.js +++ b/samples/client/petstore/javascript-promise/src/model/MixedPropertiesAndAdditionalPropertiesClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/Model200Response.js b/samples/client/petstore/javascript-promise/src/model/Model200Response.js index 665e9d64f65..82d0b362160 100644 --- a/samples/client/petstore/javascript-promise/src/model/Model200Response.js +++ b/samples/client/petstore/javascript-promise/src/model/Model200Response.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/ModelReturn.js b/samples/client/petstore/javascript-promise/src/model/ModelReturn.js index 836fab1b221..b4ca8a7875d 100644 --- a/samples/client/petstore/javascript-promise/src/model/ModelReturn.js +++ b/samples/client/petstore/javascript-promise/src/model/ModelReturn.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/Name.js b/samples/client/petstore/javascript-promise/src/model/Name.js index 24d63b4836f..a18ddecd8d9 100644 --- a/samples/client/petstore/javascript-promise/src/model/Name.js +++ b/samples/client/petstore/javascript-promise/src/model/Name.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/NumberOnly.js b/samples/client/petstore/javascript-promise/src/model/NumberOnly.js index b50c8dadc26..f25c7bbc8b2 100644 --- a/samples/client/petstore/javascript-promise/src/model/NumberOnly.js +++ b/samples/client/petstore/javascript-promise/src/model/NumberOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/Order.js b/samples/client/petstore/javascript-promise/src/model/Order.js index 5abd1899c04..a65a0024885 100644 --- a/samples/client/petstore/javascript-promise/src/model/Order.js +++ b/samples/client/petstore/javascript-promise/src/model/Order.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/OuterComposite.js b/samples/client/petstore/javascript-promise/src/model/OuterComposite.js index 7410237332e..e9c23b1e619 100644 --- a/samples/client/petstore/javascript-promise/src/model/OuterComposite.js +++ b/samples/client/petstore/javascript-promise/src/model/OuterComposite.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/OuterEnum.js b/samples/client/petstore/javascript-promise/src/model/OuterEnum.js index 0d7f9a4fd59..bca0fdf08ce 100644 --- a/samples/client/petstore/javascript-promise/src/model/OuterEnum.js +++ b/samples/client/petstore/javascript-promise/src/model/OuterEnum.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/Pet.js b/samples/client/petstore/javascript-promise/src/model/Pet.js index 69d47d25aef..a4edb988958 100644 --- a/samples/client/petstore/javascript-promise/src/model/Pet.js +++ b/samples/client/petstore/javascript-promise/src/model/Pet.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/ReadOnlyFirst.js b/samples/client/petstore/javascript-promise/src/model/ReadOnlyFirst.js index 4e2f573958e..f05c53ebab3 100644 --- a/samples/client/petstore/javascript-promise/src/model/ReadOnlyFirst.js +++ b/samples/client/petstore/javascript-promise/src/model/ReadOnlyFirst.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js b/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js index 5bea0b84fcf..3de755a7986 100644 --- a/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js +++ b/samples/client/petstore/javascript-promise/src/model/SpecialModelName.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/StringBooleanMap.js b/samples/client/petstore/javascript-promise/src/model/StringBooleanMap.js index d07c0fc99ea..8a82f9d99ba 100644 --- a/samples/client/petstore/javascript-promise/src/model/StringBooleanMap.js +++ b/samples/client/petstore/javascript-promise/src/model/StringBooleanMap.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/Tag.js b/samples/client/petstore/javascript-promise/src/model/Tag.js index 09299a4d0d6..c57bfb9ca07 100644 --- a/samples/client/petstore/javascript-promise/src/model/Tag.js +++ b/samples/client/petstore/javascript-promise/src/model/Tag.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript-promise/src/model/User.js b/samples/client/petstore/javascript-promise/src/model/User.js index 62a2a70c680..6f2f6910f4d 100644 --- a/samples/client/petstore/javascript-promise/src/model/User.js +++ b/samples/client/petstore/javascript-promise/src/model/User.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/.openapi-generator/VERSION b/samples/client/petstore/javascript/.openapi-generator/VERSION index 14900cee60e..6d94c9c2e12 100644 --- a/samples/client/petstore/javascript/.openapi-generator/VERSION +++ b/samples/client/petstore/javascript/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.1-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/javascript/src/ApiClient.js b/samples/client/petstore/javascript/src/ApiClient.js index 666b55968cd..2e1ad976bf7 100644 --- a/samples/client/petstore/javascript/src/ApiClient.js +++ b/samples/client/petstore/javascript/src/ApiClient.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * @@ -469,7 +469,7 @@ // Attach previously saved cookies, if enabled if (this.enableCookies){ if (typeof window === 'undefined') { - this.agent.attachCookies(request); + this.agent._attachCookies(request); } else { request.withCredentials(); @@ -484,7 +484,7 @@ try { data = _this.deserialize(response, returnType); if (_this.enableCookies && typeof window === 'undefined'){ - _this.agent.saveCookies(response); + _this.agent._saveCookies(response); } } catch (err) { error = err; diff --git a/samples/client/petstore/javascript/src/api/AnotherFakeApi.js b/samples/client/petstore/javascript/src/api/AnotherFakeApi.js index 5075bf8ee34..4761e83415d 100644 --- a/samples/client/petstore/javascript/src/api/AnotherFakeApi.js +++ b/samples/client/petstore/javascript/src/api/AnotherFakeApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/api/FakeApi.js b/samples/client/petstore/javascript/src/api/FakeApi.js index 56d61947600..3f19f090267 100644 --- a/samples/client/petstore/javascript/src/api/FakeApi.js +++ b/samples/client/petstore/javascript/src/api/FakeApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/api/FakeClassnameTags123Api.js b/samples/client/petstore/javascript/src/api/FakeClassnameTags123Api.js index 9384dce1b7d..1fda0fa1451 100644 --- a/samples/client/petstore/javascript/src/api/FakeClassnameTags123Api.js +++ b/samples/client/petstore/javascript/src/api/FakeClassnameTags123Api.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/api/PetApi.js b/samples/client/petstore/javascript/src/api/PetApi.js index 34bd8e70ddc..36243ed29e1 100644 --- a/samples/client/petstore/javascript/src/api/PetApi.js +++ b/samples/client/petstore/javascript/src/api/PetApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/api/StoreApi.js b/samples/client/petstore/javascript/src/api/StoreApi.js index 33216d30b39..32ce6e83cfc 100644 --- a/samples/client/petstore/javascript/src/api/StoreApi.js +++ b/samples/client/petstore/javascript/src/api/StoreApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/api/UserApi.js b/samples/client/petstore/javascript/src/api/UserApi.js index 4ca5eb45ee7..13c24345f72 100644 --- a/samples/client/petstore/javascript/src/api/UserApi.js +++ b/samples/client/petstore/javascript/src/api/UserApi.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index 3f904b570ca..1eebdbf5ff3 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/AdditionalPropertiesClass.js b/samples/client/petstore/javascript/src/model/AdditionalPropertiesClass.js index 3e41a2906a5..e41dca8e660 100644 --- a/samples/client/petstore/javascript/src/model/AdditionalPropertiesClass.js +++ b/samples/client/petstore/javascript/src/model/AdditionalPropertiesClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/Animal.js b/samples/client/petstore/javascript/src/model/Animal.js index 5ec0fe427cb..43aaacc12b5 100644 --- a/samples/client/petstore/javascript/src/model/Animal.js +++ b/samples/client/petstore/javascript/src/model/Animal.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/AnimalFarm.js b/samples/client/petstore/javascript/src/model/AnimalFarm.js index f8099197245..f3d2c132d12 100644 --- a/samples/client/petstore/javascript/src/model/AnimalFarm.js +++ b/samples/client/petstore/javascript/src/model/AnimalFarm.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/ApiResponse.js b/samples/client/petstore/javascript/src/model/ApiResponse.js index d3236a99234..2d33b0b7a23 100644 --- a/samples/client/petstore/javascript/src/model/ApiResponse.js +++ b/samples/client/petstore/javascript/src/model/ApiResponse.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/ArrayOfArrayOfNumberOnly.js b/samples/client/petstore/javascript/src/model/ArrayOfArrayOfNumberOnly.js index e7ac7b24a33..41463b0e371 100644 --- a/samples/client/petstore/javascript/src/model/ArrayOfArrayOfNumberOnly.js +++ b/samples/client/petstore/javascript/src/model/ArrayOfArrayOfNumberOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/ArrayOfNumberOnly.js b/samples/client/petstore/javascript/src/model/ArrayOfNumberOnly.js index 7c98321c3d4..f3b0ac217e1 100644 --- a/samples/client/petstore/javascript/src/model/ArrayOfNumberOnly.js +++ b/samples/client/petstore/javascript/src/model/ArrayOfNumberOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/ArrayTest.js b/samples/client/petstore/javascript/src/model/ArrayTest.js index 0f47e3e78ef..6b8aeade8b0 100644 --- a/samples/client/petstore/javascript/src/model/ArrayTest.js +++ b/samples/client/petstore/javascript/src/model/ArrayTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/Capitalization.js b/samples/client/petstore/javascript/src/model/Capitalization.js index 9f5e832699d..67c027686a9 100644 --- a/samples/client/petstore/javascript/src/model/Capitalization.js +++ b/samples/client/petstore/javascript/src/model/Capitalization.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/Cat.js b/samples/client/petstore/javascript/src/model/Cat.js index 4c1d8f0c845..6f8ca2e91fd 100644 --- a/samples/client/petstore/javascript/src/model/Cat.js +++ b/samples/client/petstore/javascript/src/model/Cat.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/Category.js b/samples/client/petstore/javascript/src/model/Category.js index 560f1a94013..ba82e88bd49 100644 --- a/samples/client/petstore/javascript/src/model/Category.js +++ b/samples/client/petstore/javascript/src/model/Category.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/ClassModel.js b/samples/client/petstore/javascript/src/model/ClassModel.js index cadf752c644..6592fdeebc9 100644 --- a/samples/client/petstore/javascript/src/model/ClassModel.js +++ b/samples/client/petstore/javascript/src/model/ClassModel.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/Client.js b/samples/client/petstore/javascript/src/model/Client.js index 7bf09ed3ac6..00fe25ca2d7 100644 --- a/samples/client/petstore/javascript/src/model/Client.js +++ b/samples/client/petstore/javascript/src/model/Client.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/Dog.js b/samples/client/petstore/javascript/src/model/Dog.js index 93f8f38ae13..7a74ef477b4 100644 --- a/samples/client/petstore/javascript/src/model/Dog.js +++ b/samples/client/petstore/javascript/src/model/Dog.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/EnumArrays.js b/samples/client/petstore/javascript/src/model/EnumArrays.js index d7b36eb6307..7bbb3af35d2 100644 --- a/samples/client/petstore/javascript/src/model/EnumArrays.js +++ b/samples/client/petstore/javascript/src/model/EnumArrays.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/EnumClass.js b/samples/client/petstore/javascript/src/model/EnumClass.js index d2f7c69374b..3a8a7f52d94 100644 --- a/samples/client/petstore/javascript/src/model/EnumClass.js +++ b/samples/client/petstore/javascript/src/model/EnumClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/EnumTest.js b/samples/client/petstore/javascript/src/model/EnumTest.js index e6f1a7ea9e4..25d166c5c8a 100644 --- a/samples/client/petstore/javascript/src/model/EnumTest.js +++ b/samples/client/petstore/javascript/src/model/EnumTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/File.js b/samples/client/petstore/javascript/src/model/File.js index aa7449e2907..706f20eff08 100644 --- a/samples/client/petstore/javascript/src/model/File.js +++ b/samples/client/petstore/javascript/src/model/File.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/FileSchemaTestClass.js b/samples/client/petstore/javascript/src/model/FileSchemaTestClass.js index f2f1b8e966a..2bc85b700b0 100644 --- a/samples/client/petstore/javascript/src/model/FileSchemaTestClass.js +++ b/samples/client/petstore/javascript/src/model/FileSchemaTestClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/FormatTest.js b/samples/client/petstore/javascript/src/model/FormatTest.js index ea6d1966613..679e769b5b2 100644 --- a/samples/client/petstore/javascript/src/model/FormatTest.js +++ b/samples/client/petstore/javascript/src/model/FormatTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/HasOnlyReadOnly.js b/samples/client/petstore/javascript/src/model/HasOnlyReadOnly.js index b6470082caf..6b42db4416e 100644 --- a/samples/client/petstore/javascript/src/model/HasOnlyReadOnly.js +++ b/samples/client/petstore/javascript/src/model/HasOnlyReadOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/List.js b/samples/client/petstore/javascript/src/model/List.js index 3b9f343524e..05c95f2613a 100644 --- a/samples/client/petstore/javascript/src/model/List.js +++ b/samples/client/petstore/javascript/src/model/List.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/MapTest.js b/samples/client/petstore/javascript/src/model/MapTest.js index 8563624adff..65b317db8b5 100644 --- a/samples/client/petstore/javascript/src/model/MapTest.js +++ b/samples/client/petstore/javascript/src/model/MapTest.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/MixedPropertiesAndAdditionalPropertiesClass.js b/samples/client/petstore/javascript/src/model/MixedPropertiesAndAdditionalPropertiesClass.js index ff56b0e4981..9291b7ba8a4 100644 --- a/samples/client/petstore/javascript/src/model/MixedPropertiesAndAdditionalPropertiesClass.js +++ b/samples/client/petstore/javascript/src/model/MixedPropertiesAndAdditionalPropertiesClass.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/Model200Response.js b/samples/client/petstore/javascript/src/model/Model200Response.js index 665e9d64f65..82d0b362160 100644 --- a/samples/client/petstore/javascript/src/model/Model200Response.js +++ b/samples/client/petstore/javascript/src/model/Model200Response.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/ModelReturn.js b/samples/client/petstore/javascript/src/model/ModelReturn.js index 836fab1b221..b4ca8a7875d 100644 --- a/samples/client/petstore/javascript/src/model/ModelReturn.js +++ b/samples/client/petstore/javascript/src/model/ModelReturn.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/Name.js b/samples/client/petstore/javascript/src/model/Name.js index 24d63b4836f..a18ddecd8d9 100644 --- a/samples/client/petstore/javascript/src/model/Name.js +++ b/samples/client/petstore/javascript/src/model/Name.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/NumberOnly.js b/samples/client/petstore/javascript/src/model/NumberOnly.js index b50c8dadc26..f25c7bbc8b2 100644 --- a/samples/client/petstore/javascript/src/model/NumberOnly.js +++ b/samples/client/petstore/javascript/src/model/NumberOnly.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/Order.js b/samples/client/petstore/javascript/src/model/Order.js index 5abd1899c04..a65a0024885 100644 --- a/samples/client/petstore/javascript/src/model/Order.js +++ b/samples/client/petstore/javascript/src/model/Order.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/OuterComposite.js b/samples/client/petstore/javascript/src/model/OuterComposite.js index 7410237332e..e9c23b1e619 100644 --- a/samples/client/petstore/javascript/src/model/OuterComposite.js +++ b/samples/client/petstore/javascript/src/model/OuterComposite.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/OuterEnum.js b/samples/client/petstore/javascript/src/model/OuterEnum.js index 0d7f9a4fd59..bca0fdf08ce 100644 --- a/samples/client/petstore/javascript/src/model/OuterEnum.js +++ b/samples/client/petstore/javascript/src/model/OuterEnum.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/Pet.js b/samples/client/petstore/javascript/src/model/Pet.js index 69d47d25aef..a4edb988958 100644 --- a/samples/client/petstore/javascript/src/model/Pet.js +++ b/samples/client/petstore/javascript/src/model/Pet.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/ReadOnlyFirst.js b/samples/client/petstore/javascript/src/model/ReadOnlyFirst.js index 4e2f573958e..f05c53ebab3 100644 --- a/samples/client/petstore/javascript/src/model/ReadOnlyFirst.js +++ b/samples/client/petstore/javascript/src/model/ReadOnlyFirst.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/SpecialModelName.js b/samples/client/petstore/javascript/src/model/SpecialModelName.js index 5bea0b84fcf..3de755a7986 100644 --- a/samples/client/petstore/javascript/src/model/SpecialModelName.js +++ b/samples/client/petstore/javascript/src/model/SpecialModelName.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/StringBooleanMap.js b/samples/client/petstore/javascript/src/model/StringBooleanMap.js index d07c0fc99ea..8a82f9d99ba 100644 --- a/samples/client/petstore/javascript/src/model/StringBooleanMap.js +++ b/samples/client/petstore/javascript/src/model/StringBooleanMap.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/Tag.js b/samples/client/petstore/javascript/src/model/Tag.js index 09299a4d0d6..c57bfb9ca07 100644 --- a/samples/client/petstore/javascript/src/model/Tag.js +++ b/samples/client/petstore/javascript/src/model/Tag.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/javascript/src/model/User.js b/samples/client/petstore/javascript/src/model/User.js index 62a2a70c680..6f2f6910f4d 100644 --- a/samples/client/petstore/javascript/src/model/User.js +++ b/samples/client/petstore/javascript/src/model/User.js @@ -7,7 +7,7 @@ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * - * OpenAPI Generator version: 3.2.1-SNAPSHOT + * OpenAPI Generator version: 3.3.0-SNAPSHOT * * Do not edit the class manually. * diff --git a/samples/client/petstore/jaxrs-cxf-client/.openapi-generator/VERSION b/samples/client/petstore/jaxrs-cxf-client/.openapi-generator/VERSION index 411b9556532..6d94c9c2e12 100644 --- a/samples/client/petstore/jaxrs-cxf-client/.openapi-generator/VERSION +++ b/samples/client/petstore/jaxrs-cxf-client/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.2-SNAPSHOT +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/kotlin-string/docs/PetApi.md b/samples/client/petstore/kotlin-string/docs/PetApi.md index 6aef25bf53b..4264db745f0 100644 --- a/samples/client/petstore/kotlin-string/docs/PetApi.md +++ b/samples/client/petstore/kotlin-string/docs/PetApi.md @@ -88,8 +88,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| Pet id to delete | - **apiKey** | **kotlin.String**| | [optional] + **petId** | **kotlin.Long**| Pet id to delete | [default to null] + **apiKey** | **kotlin.String**| | [optional] [default to null] ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] + **status** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [default to null] [enum: available, pending, sold] ### Return type @@ -183,7 +183,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Tags to filter by | + **tags** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Tags to filter by | [default to null] ### Return type @@ -230,7 +230,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet to return | + **petId** | **kotlin.Long**| ID of pet to return | [default to null] ### Return type @@ -320,7 +320,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet that needs to be updated | + **petId** | **kotlin.Long**| ID of pet that needs to be updated | [default to null] **name** | **kotlin.String**| Updated name of the pet | [optional] [default to null] **status** | **kotlin.String**| Updated status of the pet | [optional] [default to null] @@ -369,7 +369,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet to update | + **petId** | **kotlin.Long**| ID of pet to update | [default to null] **additionalMetadata** | **kotlin.String**| Additional data to pass to server | [optional] [default to null] **file** | **java.io.File**| file to upload | [optional] [default to null] diff --git a/samples/client/petstore/kotlin-string/docs/StoreApi.md b/samples/client/petstore/kotlin-string/docs/StoreApi.md index 13e978ac895..339ded9f658 100644 --- a/samples/client/petstore/kotlin-string/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-string/docs/StoreApi.md @@ -41,7 +41,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **kotlin.String**| ID of the order that needs to be deleted | + **orderId** | **kotlin.String**| ID of the order that needs to be deleted | [default to null] ### Return type @@ -131,7 +131,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **kotlin.Long**| ID of pet that needs to be fetched | + **orderId** | **kotlin.Long**| ID of pet that needs to be fetched | [default to null] ### Return type diff --git a/samples/client/petstore/kotlin-string/docs/UserApi.md b/samples/client/petstore/kotlin-string/docs/UserApi.md index 81fc42807d3..aac410b658c 100644 --- a/samples/client/petstore/kotlin-string/docs/UserApi.md +++ b/samples/client/petstore/kotlin-string/docs/UserApi.md @@ -179,7 +179,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| The name that needs to be deleted | + **username** | **kotlin.String**| The name that needs to be deleted | [default to null] ### Return type @@ -224,7 +224,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| The name that needs to be fetched. Use user1 for testing. | + **username** | **kotlin.String**| The name that needs to be fetched. Use user1 for testing. | [default to null] ### Return type @@ -270,8 +270,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| The user name for login | - **password** | **kotlin.String**| The password for login in clear text | + **username** | **kotlin.String**| The user name for login | [default to null] + **password** | **kotlin.String**| The password for login in clear text | [default to null] ### Return type @@ -358,7 +358,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| name that need to be deleted | + **username** | **kotlin.String**| name that need to be deleted | [default to null] **user** | [**User**](User.md)| Updated user object | ### Return type diff --git a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index c27887851c1..a34f35793fe 100644 --- a/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-string/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -53,7 +53,7 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCli * Deletes a pet * * @param petId Pet id to delete - * @param apiKey (optional) + * @param apiKey (optional, default to null) * @return void */ fun deletePet(petId: kotlin.Long, apiKey: kotlin.String) : Unit { diff --git a/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md b/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md index 6aef25bf53b..4264db745f0 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/PetApi.md @@ -88,8 +88,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| Pet id to delete | - **apiKey** | **kotlin.String**| | [optional] + **petId** | **kotlin.Long**| Pet id to delete | [default to null] + **apiKey** | **kotlin.String**| | [optional] [default to null] ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] + **status** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [default to null] [enum: available, pending, sold] ### Return type @@ -183,7 +183,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Tags to filter by | + **tags** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Tags to filter by | [default to null] ### Return type @@ -230,7 +230,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet to return | + **petId** | **kotlin.Long**| ID of pet to return | [default to null] ### Return type @@ -320,7 +320,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet that needs to be updated | + **petId** | **kotlin.Long**| ID of pet that needs to be updated | [default to null] **name** | **kotlin.String**| Updated name of the pet | [optional] [default to null] **status** | **kotlin.String**| Updated status of the pet | [optional] [default to null] @@ -369,7 +369,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet to update | + **petId** | **kotlin.Long**| ID of pet to update | [default to null] **additionalMetadata** | **kotlin.String**| Additional data to pass to server | [optional] [default to null] **file** | **java.io.File**| file to upload | [optional] [default to null] diff --git a/samples/client/petstore/kotlin-threetenbp/docs/StoreApi.md b/samples/client/petstore/kotlin-threetenbp/docs/StoreApi.md index 13e978ac895..339ded9f658 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/StoreApi.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/StoreApi.md @@ -41,7 +41,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **kotlin.String**| ID of the order that needs to be deleted | + **orderId** | **kotlin.String**| ID of the order that needs to be deleted | [default to null] ### Return type @@ -131,7 +131,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **kotlin.Long**| ID of pet that needs to be fetched | + **orderId** | **kotlin.Long**| ID of pet that needs to be fetched | [default to null] ### Return type diff --git a/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md b/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md index 81fc42807d3..aac410b658c 100644 --- a/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md +++ b/samples/client/petstore/kotlin-threetenbp/docs/UserApi.md @@ -179,7 +179,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| The name that needs to be deleted | + **username** | **kotlin.String**| The name that needs to be deleted | [default to null] ### Return type @@ -224,7 +224,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| The name that needs to be fetched. Use user1 for testing. | + **username** | **kotlin.String**| The name that needs to be fetched. Use user1 for testing. | [default to null] ### Return type @@ -270,8 +270,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| The user name for login | - **password** | **kotlin.String**| The password for login in clear text | + **username** | **kotlin.String**| The user name for login | [default to null] + **password** | **kotlin.String**| The password for login in clear text | [default to null] ### Return type @@ -358,7 +358,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| name that need to be deleted | + **username** | **kotlin.String**| name that need to be deleted | [default to null] **user** | [**User**](User.md)| Updated user object | ### Return type diff --git a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index 4419bfda152..1f2746d24a0 100644 --- a/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin-threetenbp/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -54,7 +54,7 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCli * Deletes a pet * * @param petId Pet id to delete - * @param apiKey (optional) + * @param apiKey (optional, default to null) * @return void */ fun deletePet(petId: kotlin.Long, apiKey: kotlin.String) : Unit { diff --git a/samples/client/petstore/kotlin/docs/PetApi.md b/samples/client/petstore/kotlin/docs/PetApi.md index 6aef25bf53b..4264db745f0 100644 --- a/samples/client/petstore/kotlin/docs/PetApi.md +++ b/samples/client/petstore/kotlin/docs/PetApi.md @@ -88,8 +88,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| Pet id to delete | - **apiKey** | **kotlin.String**| | [optional] + **petId** | **kotlin.Long**| Pet id to delete | [default to null] + **apiKey** | **kotlin.String**| | [optional] [default to null] ### Return type @@ -136,7 +136,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **status** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [enum: available, pending, sold] + **status** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Status values that need to be considered for filter | [default to null] [enum: available, pending, sold] ### Return type @@ -183,7 +183,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tags** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Tags to filter by | + **tags** | [**kotlin.Array<kotlin.String>**](kotlin.String.md)| Tags to filter by | [default to null] ### Return type @@ -230,7 +230,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet to return | + **petId** | **kotlin.Long**| ID of pet to return | [default to null] ### Return type @@ -320,7 +320,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet that needs to be updated | + **petId** | **kotlin.Long**| ID of pet that needs to be updated | [default to null] **name** | **kotlin.String**| Updated name of the pet | [optional] [default to null] **status** | **kotlin.String**| Updated status of the pet | [optional] [default to null] @@ -369,7 +369,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **petId** | **kotlin.Long**| ID of pet to update | + **petId** | **kotlin.Long**| ID of pet to update | [default to null] **additionalMetadata** | **kotlin.String**| Additional data to pass to server | [optional] [default to null] **file** | **java.io.File**| file to upload | [optional] [default to null] diff --git a/samples/client/petstore/kotlin/docs/StoreApi.md b/samples/client/petstore/kotlin/docs/StoreApi.md index 13e978ac895..339ded9f658 100644 --- a/samples/client/petstore/kotlin/docs/StoreApi.md +++ b/samples/client/petstore/kotlin/docs/StoreApi.md @@ -41,7 +41,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **kotlin.String**| ID of the order that needs to be deleted | + **orderId** | **kotlin.String**| ID of the order that needs to be deleted | [default to null] ### Return type @@ -131,7 +131,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **orderId** | **kotlin.Long**| ID of pet that needs to be fetched | + **orderId** | **kotlin.Long**| ID of pet that needs to be fetched | [default to null] ### Return type diff --git a/samples/client/petstore/kotlin/docs/UserApi.md b/samples/client/petstore/kotlin/docs/UserApi.md index 81fc42807d3..aac410b658c 100644 --- a/samples/client/petstore/kotlin/docs/UserApi.md +++ b/samples/client/petstore/kotlin/docs/UserApi.md @@ -179,7 +179,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| The name that needs to be deleted | + **username** | **kotlin.String**| The name that needs to be deleted | [default to null] ### Return type @@ -224,7 +224,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| The name that needs to be fetched. Use user1 for testing. | + **username** | **kotlin.String**| The name that needs to be fetched. Use user1 for testing. | [default to null] ### Return type @@ -270,8 +270,8 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| The user name for login | - **password** | **kotlin.String**| The password for login in clear text | + **username** | **kotlin.String**| The user name for login | [default to null] + **password** | **kotlin.String**| The password for login in clear text | [default to null] ### Return type @@ -358,7 +358,7 @@ try { Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **username** | **kotlin.String**| name that need to be deleted | + **username** | **kotlin.String**| name that need to be deleted | [default to null] **user** | [**User**](User.md)| Updated user object | ### Return type diff --git a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt index c27887851c1..a34f35793fe 100644 --- a/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt +++ b/samples/client/petstore/kotlin/src/main/kotlin/org/openapitools/client/apis/PetApi.kt @@ -53,7 +53,7 @@ class PetApi(basePath: kotlin.String = "http://petstore.swagger.io/v2") : ApiCli * Deletes a pet * * @param petId Pet id to delete - * @param apiKey (optional) + * @param apiKey (optional, default to null) * @return void */ fun deletePet(petId: kotlin.Long, apiKey: kotlin.String) : Unit { diff --git a/samples/client/petstore/perl/.openapi-generator/VERSION b/samples/client/petstore/perl/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/client/petstore/perl/.openapi-generator/VERSION +++ b/samples/client/petstore/perl/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 7b381e92c82..c64a6dbefe8 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -248,6 +248,8 @@ use WWW::OpenAPIClient::Object::Dog; use WWW::OpenAPIClient::Object::EnumArrays; use WWW::OpenAPIClient::Object::EnumClass; use WWW::OpenAPIClient::Object::EnumTest; +use WWW::OpenAPIClient::Object::File; +use WWW::OpenAPIClient::Object::FileSchemaTestClass; use WWW::OpenAPIClient::Object::FormatTest; use WWW::OpenAPIClient::Object::HasOnlyReadOnly; use WWW::OpenAPIClient::Object::List; @@ -263,6 +265,7 @@ use WWW::OpenAPIClient::Object::OuterEnum; use WWW::OpenAPIClient::Object::Pet; use WWW::OpenAPIClient::Object::ReadOnlyFirst; use WWW::OpenAPIClient::Object::SpecialModelName; +use WWW::OpenAPIClient::Object::StringBooleanMap; use WWW::OpenAPIClient::Object::Tag; use WWW::OpenAPIClient::Object::User; @@ -300,6 +303,8 @@ use WWW::OpenAPIClient::Object::Dog; use WWW::OpenAPIClient::Object::EnumArrays; use WWW::OpenAPIClient::Object::EnumClass; use WWW::OpenAPIClient::Object::EnumTest; +use WWW::OpenAPIClient::Object::File; +use WWW::OpenAPIClient::Object::FileSchemaTestClass; use WWW::OpenAPIClient::Object::FormatTest; use WWW::OpenAPIClient::Object::HasOnlyReadOnly; use WWW::OpenAPIClient::Object::List; @@ -315,6 +320,7 @@ use WWW::OpenAPIClient::Object::OuterEnum; use WWW::OpenAPIClient::Object::Pet; use WWW::OpenAPIClient::Object::ReadOnlyFirst; use WWW::OpenAPIClient::Object::SpecialModelName; +use WWW::OpenAPIClient::Object::StringBooleanMap; use WWW::OpenAPIClient::Object::Tag; use WWW::OpenAPIClient::Object::User; @@ -328,11 +334,11 @@ my $api_instance = WWW::OpenAPIClient::->new( my $client = WWW::OpenAPIClient::Object::Client->new(); # Client | client model eval { - my $result = $api_instance->test_special_tags(client => $client); + my $result = $api_instance->call_123_test_special_tags(client => $client); print Dumper($result); }; if ($@) { - warn "Exception when calling AnotherFakeApi->test_special_tags: $@\n"; + warn "Exception when calling AnotherFakeApi->call_123_test_special_tags: $@\n"; } ``` @@ -343,11 +349,12 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**test_special_tags**](docs/AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | *FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +*FakeApi* | [**test_body_with_file_schema**](docs/FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | *FakeApi* | [**test_body_with_query_params**](docs/FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | *FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -363,6 +370,7 @@ Class | Method | HTTP request | Description *PetApi* | [**update_pet**](docs/PetApi.md#update_pet) | **PUT** /pet | Update an existing pet *PetApi* | [**update_pet_with_form**](docs/PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetApi* | [**upload_file**](docs/PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +*PetApi* | [**upload_file_with_required_file**](docs/PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) *StoreApi* | [**delete_order**](docs/StoreApi.md#delete_order) | **DELETE** /store/order/{order_id} | Delete purchase order by ID *StoreApi* | [**get_inventory**](docs/StoreApi.md#get_inventory) | **GET** /store/inventory | Returns pet inventories by status *StoreApi* | [**get_order_by_id**](docs/StoreApi.md#get_order_by_id) | **GET** /store/order/{order_id} | Find purchase order by ID @@ -394,6 +402,8 @@ Class | Method | HTTP request | Description - [WWW::OpenAPIClient::Object::EnumArrays](docs/EnumArrays.md) - [WWW::OpenAPIClient::Object::EnumClass](docs/EnumClass.md) - [WWW::OpenAPIClient::Object::EnumTest](docs/EnumTest.md) + - [WWW::OpenAPIClient::Object::File](docs/File.md) + - [WWW::OpenAPIClient::Object::FileSchemaTestClass](docs/FileSchemaTestClass.md) - [WWW::OpenAPIClient::Object::FormatTest](docs/FormatTest.md) - [WWW::OpenAPIClient::Object::HasOnlyReadOnly](docs/HasOnlyReadOnly.md) - [WWW::OpenAPIClient::Object::List](docs/List.md) @@ -409,6 +419,7 @@ Class | Method | HTTP request | Description - [WWW::OpenAPIClient::Object::Pet](docs/Pet.md) - [WWW::OpenAPIClient::Object::ReadOnlyFirst](docs/ReadOnlyFirst.md) - [WWW::OpenAPIClient::Object::SpecialModelName](docs/SpecialModelName.md) + - [WWW::OpenAPIClient::Object::StringBooleanMap](docs/StringBooleanMap.md) - [WWW::OpenAPIClient::Object::Tag](docs/Tag.md) - [WWW::OpenAPIClient::Object::User](docs/User.md) diff --git a/samples/client/petstore/perl/docs/AnotherfakeApi.md b/samples/client/petstore/perl/docs/AnotherfakeApi.md index 39008a4a53f..a0b0fd6f8ea 100644 --- a/samples/client/petstore/perl/docs/AnotherfakeApi.md +++ b/samples/client/petstore/perl/docs/AnotherfakeApi.md @@ -9,15 +9,15 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**test_special_tags**](AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +[**call_123_test_special_tags**](AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags -# **test_special_tags** -> Client test_special_tags(client => $client) +# **call_123_test_special_tags** +> Client call_123_test_special_tags(client => $client) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Example ```perl @@ -29,11 +29,11 @@ my $api_instance = WWW::OpenAPIClient::AnotherFakeApi->new( my $client = WWW::OpenAPIClient::Object::Client->new(); # Client | client model eval { - my $result = $api_instance->test_special_tags(client => $client); + my $result = $api_instance->call_123_test_special_tags(client => $client); print Dumper($result); }; if ($@) { - warn "Exception when calling AnotherFakeApi->test_special_tags: $@\n"; + warn "Exception when calling AnotherFakeApi->call_123_test_special_tags: $@\n"; } ``` diff --git a/samples/client/petstore/perl/docs/FakeApi.md b/samples/client/petstore/perl/docs/FakeApi.md index 57f57988424..88f6b8336a3 100644 --- a/samples/client/petstore/perl/docs/FakeApi.md +++ b/samples/client/petstore/perl/docs/FakeApi.md @@ -13,6 +13,7 @@ Method | HTTP request | Description [**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | [**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | [**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | +[**test_body_with_file_schema**](FakeApi.md#test_body_with_file_schema) | **PUT** /fake/body-with-file-schema | [**test_body_with_query_params**](FakeApi.md#test_body_with_query_params) | **PUT** /fake/body-with-query-params | [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model [**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -205,6 +206,51 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **test_body_with_file_schema** +> test_body_with_file_schema(file_schema_test_class => $file_schema_test_class) + + + +For this test, the body for this request much reference a schema named `File`. + +### Example +```perl +use Data::Dumper; +use WWW::OpenAPIClient::FakeApi; +my $api_instance = WWW::OpenAPIClient::FakeApi->new( +); + +my $file_schema_test_class = WWW::OpenAPIClient::Object::FileSchemaTestClass->new(); # FileSchemaTestClass | + +eval { + $api_instance->test_body_with_file_schema(file_schema_test_class => $file_schema_test_class); +}; +if ($@) { + warn "Exception when calling FakeApi->test_body_with_file_schema: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **file_schema_test_class** | [**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) + # **test_body_with_query_params** > test_body_with_query_params(query => $query, user => $user) @@ -412,7 +458,7 @@ Name | Type | Description | Notes **enum_query_string** | **string**| Query parameter enum test (string) | [optional] [default to '-efg'] **enum_query_integer** | **int**| Query parameter enum test (double) | [optional] **enum_query_double** | **double**| Query parameter enum test (double) | [optional] - **enum_form_string_array** | **ARRAY[string]**| Form parameter enum test (string array) | [optional] [default to '$'] + **enum_form_string_array** | [**ARRAY[string]**](string.md)| Form parameter enum test (string array) | [optional] [default to '$'] **enum_form_string** | **string**| Form parameter enum test (string) | [optional] [default to '-efg'] ### Return type diff --git a/samples/client/petstore/perl/docs/File.md b/samples/client/petstore/perl/docs/File.md new file mode 100644 index 00000000000..88bcb085e93 --- /dev/null +++ b/samples/client/petstore/perl/docs/File.md @@ -0,0 +1,15 @@ +# WWW::OpenAPIClient::Object::File + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::File; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**source_uri** | **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/perl/docs/FileSchemaTestClass.md b/samples/client/petstore/perl/docs/FileSchemaTestClass.md new file mode 100644 index 00000000000..4749ac0f87b --- /dev/null +++ b/samples/client/petstore/perl/docs/FileSchemaTestClass.md @@ -0,0 +1,16 @@ +# WWW::OpenAPIClient::Object::FileSchemaTestClass + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::FileSchemaTestClass; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**file** | [**File**](File.md) | | [optional] +**files** | [**ARRAY[File]**](File.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/perl/docs/MapTest.md b/samples/client/petstore/perl/docs/MapTest.md index 88df848ff99..822e4db49a2 100644 --- a/samples/client/petstore/perl/docs/MapTest.md +++ b/samples/client/petstore/perl/docs/MapTest.md @@ -10,6 +10,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **map_map_of_string** | **HASH[string,HASH[string,string]]** | | [optional] **map_of_enum_string** | **HASH[string,string]** | | [optional] +**direct_map** | **HASH[string,boolean]** | | [optional] +**indirect_map** | [**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/perl/docs/PetApi.md b/samples/client/petstore/perl/docs/PetApi.md index 5ad3f6f41fa..d18aca84067 100644 --- a/samples/client/petstore/perl/docs/PetApi.md +++ b/samples/client/petstore/perl/docs/PetApi.md @@ -17,6 +17,7 @@ Method | HTTP request | Description [**update_pet**](PetApi.md#update_pet) | **PUT** /pet | Update an existing pet [**update_pet_with_form**](PetApi.md#update_pet_with_form) | **POST** /pet/{petId} | Updates a pet in the store with form data [**upload_file**](PetApi.md#upload_file) | **POST** /pet/{petId}/uploadImage | uploads an image +[**upload_file_with_required_file**](PetApi.md#upload_file_with_required_file) | **POST** /fake/{petId}/uploadImageWithRequiredFile | uploads an image (required) # **add_pet** @@ -409,3 +410,54 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **upload_file_with_required_file** +> ApiResponse upload_file_with_required_file(pet_id => $pet_id, required_file => $required_file, additional_metadata => $additional_metadata) + +uploads an image (required) + +### Example +```perl +use Data::Dumper; +use WWW::OpenAPIClient::PetApi; +my $api_instance = WWW::OpenAPIClient::PetApi->new( + + # Configure OAuth2 access token for authorization: petstore_auth + access_token => 'YOUR_ACCESS_TOKEN', +); + +my $pet_id = 789; # int | ID of pet to update +my $required_file = "/path/to/file"; # string | file to upload +my $additional_metadata = "additional_metadata_example"; # string | Additional data to pass to server + +eval { + my $result = $api_instance->upload_file_with_required_file(pet_id => $pet_id, required_file => $required_file, additional_metadata => $additional_metadata); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling PetApi->upload_file_with_required_file: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **pet_id** | **int**| ID of pet to update | + **required_file** | **string****string**| file to upload | + **additional_metadata** | **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/perl/docs/StringBooleanMap.md b/samples/client/petstore/perl/docs/StringBooleanMap.md new file mode 100644 index 00000000000..83c9a6f5f17 --- /dev/null +++ b/samples/client/petstore/perl/docs/StringBooleanMap.md @@ -0,0 +1,14 @@ +# WWW::OpenAPIClient::Object::StringBooleanMap + +## Load the model package +```perl +use WWW::OpenAPIClient::Object::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/perl/lib/WWW/OpenAPIClient/AnotherFakeApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/AnotherFakeApi.pm index 20b9eac7c0c..d1ac90a73b4 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/AnotherFakeApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/AnotherFakeApi.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -22,7 +23,7 @@ package WWW::OpenAPIClient::AnotherFakeApi; require 5.6.0; use strict; use warnings; -use utf8; +use utf8; use Exporter; use Carp qw( croak ); use Log::Any qw($log); @@ -31,15 +32,16 @@ use WWW::OpenAPIClient::ApiClient; use base "Class::Data::Inheritable"; -__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); sub new { my $class = shift; my $api_client; - if ($_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { + if ( $_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { $api_client = $_[0]; - } else { + } + else { $api_client = WWW::OpenAPIClient::ApiClient->new(@_); } @@ -47,55 +49,60 @@ sub new { } - # -# test_special_tags +# call_123_test_special_tags # # To test special tags -# +# # @param Client $client client model (required) { my $params = { - 'client' => { - data_type => 'Client', - description => 'client model', - required => '1', - }, + 'client' => { + data_type => 'Client', + description => 'client model', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'test_special_tags' } = { - summary => 'To test special tags', - params => $params, + __PACKAGE__->method_documentation->{'call_123_test_special_tags'} = { + summary => 'To test special tags', + params => $params, returns => 'Client', - }; + }; } + # @return Client # -sub test_special_tags { - my ($self, %args) = @_; +sub call_123_test_special_tags { + my ( $self, %args ) = @_; # verify the required parameter 'client' is set - unless (exists $args{'client'}) { - croak("Missing the required parameter 'client' when calling test_special_tags"); + unless ( exists $args{'client'} ) { + croak( +"Missing the required parameter 'client' when calling call_123_test_special_tags" + ); } # parse inputs my $_resource_path = '/another-fake/dummy'; - my $_method = 'PATCH'; - my $query_params = {}; + my $_method = 'PATCH'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json'); + my $_header_accept = + $self->{api_client}->select_header_accept('application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type('application/json'); my $_body_data; + # body params - if ( exists $args{'client'}) { + if ( exists $args{'client'} ) { $_body_data = $args{'client'}; } @@ -103,13 +110,15 @@ sub test_special_tags { my $auth_settings = [qw()]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('Client', $response); + my $_response_object = + $self->{api_client}->deserialize( 'Client', $response ); return $_response_object; } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm index 573fb1ca581..9f3d65d82ad 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiClient.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -39,22 +40,25 @@ use Module::Runtime qw(use_module); use WWW::OpenAPIClient::Configuration; - sub new { my $class = shift; my $config; - if ( $_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::Configuration' ) { + if ( $_[0] + && ref $_[0] + && ref $_[0] eq 'WWW::OpenAPIClient::Configuration' ) + { $config = $_[0]; - } else { + } + else { $config = WWW::OpenAPIClient::Configuration->new(@_); } my (%args) = ( - 'ua' => LWP::UserAgent->new, + 'ua' => LWP::UserAgent->new, 'config' => $config, ); - + return bless \%args, $class; } @@ -63,17 +67,17 @@ sub new { # @param string $user_agent The user agent of the API client # sub set_user_agent { - my ($self, $user_agent) = @_; - $self->{http_user_agent}= $user_agent; + my ( $self, $user_agent ) = @_; + $self->{http_user_agent} = $user_agent; } # Set timeout # # @param integer $seconds Number of seconds before timing out [set to 0 for no timeout] -# +# sub set_timeout { - my ($self, $seconds) = @_; - if (!looks_like_number($seconds)) { + my ( $self, $seconds ) = @_; + if ( !looks_like_number($seconds) ) { croak('Timeout variable must be numeric.'); } $self->{http_timeout} = $seconds; @@ -88,72 +92,86 @@ sub set_timeout { # @return mixed sub call_api { my $self = shift; - my ($resource_path, $method, $query_params, $post_params, $header_params, $body_data, $auth_settings) = @_; - + my ( + $resource_path, $method, $query_params, $post_params, + $header_params, $body_data, $auth_settings + ) = @_; + # update parameters based on authentication settings - $self->update_params_for_auth($header_params, $query_params, $auth_settings); - - + $self->update_params_for_auth( $header_params, $query_params, + $auth_settings ); + my $_url = $self->{config}{base_url} . $resource_path; - - # build query + + # build query if (%$query_params) { - $_url = ($_url . '?' . eval { URI::Query->new($query_params)->stringify }); + $_url = + ( $_url . '?' . eval { URI::Query->new($query_params)->stringify } ); } - - + # body data - $body_data = to_json($body_data->to_hash) if defined $body_data && $body_data->can('to_hash'); # model to json string + $body_data = to_json( $body_data->to_hash ) + if defined $body_data + && $body_data->can('to_hash'); # model to json string my $_body_data = %$post_params ? $post_params : $body_data; - + # Make the HTTP request my $_request; - if ($method eq 'POST') { + if ( $method eq 'POST' ) { + # multipart - $header_params->{'Content-Type'} = lc $header_params->{'Content-Type'} eq 'multipart/form' ? - 'form-data' : $header_params->{'Content-Type'}; - - $_request = POST($_url, %$header_params, Content => $_body_data); - + $header_params->{'Content-Type'} = + lc $header_params->{'Content-Type'} eq 'multipart/form' + ? 'form-data' + : $header_params->{'Content-Type'}; + + $_request = POST( $_url, %$header_params, Content => $_body_data ); + } - elsif ($method eq 'PUT') { + elsif ( $method eq 'PUT' ) { + # multipart - $header_params->{'Content-Type'} = lc $header_params->{'Content-Type'} eq 'multipart/form' ? - 'form-data' : $header_params->{'Content-Type'}; - - $_request = PUT($_url, %$header_params, Content => $_body_data); - + $header_params->{'Content-Type'} = + lc $header_params->{'Content-Type'} eq 'multipart/form' + ? 'form-data' + : $header_params->{'Content-Type'}; + + $_request = PUT( $_url, %$header_params, Content => $_body_data ); + } - elsif ($method eq 'GET') { + elsif ( $method eq 'GET' ) { my $headers = HTTP::Headers->new(%$header_params); - $_request = GET($_url, %$header_params); + $_request = GET( $_url, %$header_params ); } - elsif ($method eq 'HEAD') { + elsif ( $method eq 'HEAD' ) { my $headers = HTTP::Headers->new(%$header_params); - $_request = HEAD($_url,%$header_params); + $_request = HEAD( $_url, %$header_params ); } - elsif ($method eq 'DELETE') { #TODO support form data + elsif ( $method eq 'DELETE' ) { #TODO support form data my $headers = HTTP::Headers->new(%$header_params); - $_request = DELETE($_url, %$headers); + $_request = DELETE( $_url, %$headers ); } - elsif ($method eq 'PATCH') { #TODO + elsif ( $method eq 'PATCH' ) { #TODO } else { } - - $self->{ua}->timeout($self->{http_timeout} || $self->{config}{http_timeout}); - $self->{ua}->agent($self->{http_user_agent} || $self->{config}{http_user_agent}); - - $log->debugf("REQUEST: %s", $_request->as_string); + + $self->{ua} + ->timeout( $self->{http_timeout} || $self->{config}{http_timeout} ); + $self->{ua} + ->agent( $self->{http_user_agent} || $self->{config}{http_user_agent} ); + + $log->debugf( "REQUEST: %s", $_request->as_string ); my $_response = $self->{ua}->request($_request); - $log->debugf("RESPONSE: %s", $_response->as_string); - - unless ($_response->is_success) { - croak(sprintf "API Exception(%s): %s\n%s", $_response->code, $_response->message, $_response->content); + $log->debugf( "RESPONSE: %s", $_response->as_string ); + + unless ( $_response->is_success ) { + croak( sprintf "API Exception(%s): %s\n%s", + $_response->code, $_response->message, $_response->content ); } - + return $_response->content; - + } # Take value and turn it into a string suitable for inclusion in @@ -161,11 +179,10 @@ sub call_api { # @param string $value a string which will be part of the path # @return string the serialized object sub to_path_value { - my ($self, $value) = @_; - return uri_escape($self->to_string($value)); + my ( $self, $value ) = @_; + return uri_escape( $self->to_string($value) ); } - # Take value and turn it into a string suitable for inclusion in # the query, by imploding comma-separated if it's an object. # If it's a string, pass through unchanged. It will be url-encoded @@ -173,22 +190,22 @@ sub to_path_value { # @param object $object an object to be serialized to a string # @return string the serialized object sub to_query_value { - my ($self, $object) = @_; - if (ref($object) eq 'ARRAY') { - return join(',', @$object); - } else { - return $self->to_string($object); - } + my ( $self, $object ) = @_; + if ( ref($object) eq 'ARRAY' ) { + return join( ',', @$object ); + } + else { + return $self->to_string($object); + } } - # Take value and turn it into a string suitable for inclusion in # the header. If it's a string, pass through unchanged # If it's a datetime object, format it in ISO8601 # @param string $value a string which will be part of the header # @return string the header string sub to_header_value { - my ($self, $value) = @_; + my ( $self, $value ) = @_; return $self->to_string($value); } @@ -198,7 +215,7 @@ sub to_header_value { # @param string $value the value of the form parameter # @return string the form string sub to_form_value { - my ($self, $value) = @_; + my ( $self, $value ) = @_; return $self->to_string($value); } @@ -208,8 +225,8 @@ sub to_form_value { # @param string $value the value of the parameter # @return string the header string sub to_string { - my ($self, $value) = @_; - if (ref($value) eq "DateTime") { # datetime in ISO8601 format + my ( $self, $value ) = @_; + if ( ref($value) eq "DateTime" ) { # datetime in ISO8601 format return $value->datetime(); } else { @@ -218,197 +235,216 @@ sub to_string { } # Deserialize a JSON string into an object -# +# # @param string $class class name is passed as a string # @param string $data data of the body # @return object an instance of $class -sub deserialize -{ - my ($self, $class, $data) = @_; - $log->debugf("deserializing %s for %s", $data, $class); - - if (not defined $data) { +sub deserialize { + my ( $self, $class, $data ) = @_; + $log->debugf( "deserializing %s for %s", $data, $class ); + + if ( not defined $data ) { return undef; - } elsif ( (substr($class, 0, 5)) eq 'HASH[') { #hash - if ($class =~ /^HASH\[(.*),(.*)\]$/) { - my ($key_type, $type) = ($1, $2); + } + elsif ( ( substr( $class, 0, 5 ) ) eq 'HASH[' ) { #hash + if ( $class =~ /^HASH\[(.*),(.*)\]$/ ) { + my ( $key_type, $type ) = ( $1, $2 ); my %hash; my $decoded_data = decode_json $data; - foreach my $key (keys %$decoded_data) { - if (ref $decoded_data->{$key} eq 'HASH') { - $hash{$key} = $self->deserialize($type, encode_json $decoded_data->{$key}); - } else { - $hash{$key} = $self->deserialize($type, $decoded_data->{$key}); + foreach my $key ( keys %$decoded_data ) { + if ( ref $decoded_data->{$key} eq 'HASH' ) { + $hash{$key} = $self->deserialize( $type, + encode_json $decoded_data->{$key} ); + } + else { + $hash{$key} = + $self->deserialize( $type, $decoded_data->{$key} ); } } return \%hash; - } else { - #TODO log error } - - } elsif ( (substr($class, 0, 6)) eq 'ARRAY[' ) { # array of data - return $data if $data eq '[]'; # return if empty array - - my $_sub_class = substr($class, 6, -1); + else { + #TODO log error + } + + } + elsif ( ( substr( $class, 0, 6 ) ) eq 'ARRAY[' ) { # array of data + return $data if $data eq '[]'; # return if empty array + + my $_sub_class = substr( $class, 6, -1 ); my $_json_data = decode_json $data; - my @_values = (); + my @_values = (); foreach my $_value (@$_json_data) { - if (ref $_value eq 'ARRAY') { - push @_values, $self->deserialize($_sub_class, encode_json $_value); - } else { - push @_values, $self->deserialize($_sub_class, $_value); + if ( ref $_value eq 'ARRAY' ) { + push @_values, + $self->deserialize( $_sub_class, encode_json $_value); + } + else { + push @_values, $self->deserialize( $_sub_class, $_value ); } } return \@_values; - } elsif ($class eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif (grep /^$class$/, ('string', 'int', 'float', 'bool', 'object')) { + } + elsif ( $class eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep /^$class$/, ( 'string', 'int', 'float', 'bool', 'object' ) ) { return $data; - } else { # model + } + else { # model my $_instance = use_module("WWW::OpenAPIClient::Object::$class")->new; - if (ref $data eq "HASH") { + if ( ref $data eq "HASH" ) { return $_instance->from_hash($data); - } else { # string, need to json decode first - return $_instance->from_hash(decode_json $data); + } + else { # string, need to json decode first + return $_instance->from_hash( decode_json $data); } } - + } # return 'Accept' based on an array of accept provided # @param [Array] header_accept_array Array fo 'Accept' # @return String Accept (e.g. application/json) -sub select_header_accept -{ - my ($self, @header) = @_; - - if (@header == 0 || (@header == 1 && $header[0] eq '')) { +sub select_header_accept { + my ( $self, @header ) = @_; + + if ( @header == 0 || ( @header == 1 && $header[0] eq '' ) ) { return undef; - } elsif (grep(/^application\/json$/i, @header)) { - return 'application/json'; - } else { - return join(',', @header); } - + elsif ( grep( /^application\/json$/i, @header ) ) { + return 'application/json'; + } + else { + return join( ',', @header ); + } + } # return the content type based on an array of content-type provided # @param [Array] content_type_array Array fo content-type # @return String Content-Type (e.g. application/json) -sub select_header_content_type -{ - my ($self, @header) = @_; - - if (@header == 0 || (@header == 1 && $header[0] eq '')) { - return 'application/json'; # default to application/json - } elsif (grep(/^application\/json$/i, @header)) { - return 'application/json'; - } else { - return join(',', @header); +sub select_header_content_type { + my ( $self, @header ) = @_; + + if ( @header == 0 || ( @header == 1 && $header[0] eq '' ) ) { + return 'application/json'; # default to application/json } - + elsif ( grep( /^application\/json$/i, @header ) ) { + return 'application/json'; + } + else { + return join( ',', @header ); + } + } # Get API key (with prefix if set) # @param string key name # @return string API key with the prefix -sub get_api_key_with_prefix -{ - my ($self, $key_name) = @_; +sub get_api_key_with_prefix { + my ( $self, $key_name ) = @_; - my $api_key = $self->{config}{api_key}{$key_name}; - - return unless $api_key; - - my $prefix = $self->{config}{api_key_prefix}{$key_name}; - return $prefix ? "$prefix $api_key" : $api_key; -} + my $api_key = $self->{config}{api_key}{$key_name}; + + return unless $api_key; + + my $prefix = $self->{config}{api_key_prefix}{$key_name}; + return $prefix ? "$prefix $api_key" : $api_key; +} # update header and query param based on authentication setting -# +# # @param array $headerParams header parameters (by ref) # @param array $queryParams query parameters (by ref) # @param array $authSettings array of authentication scheme (e.g ['api_key']) sub update_params_for_auth { - my ($self, $header_params, $query_params, $auth_settings) = @_; - - return $self->_global_auth_setup($header_params, $query_params) - unless $auth_settings && @$auth_settings; - + my ( $self, $header_params, $query_params, $auth_settings ) = @_; + + return $self->_global_auth_setup( $header_params, $query_params ) + unless $auth_settings && @$auth_settings; + # one endpoint can have more than 1 auth settings foreach my $auth (@$auth_settings) { + # determine which one to use - if (!defined($auth)) { + if ( !defined($auth) ) { + # TODO show warning about auth setting not defined } - elsif ($auth eq 'api_key') { - + elsif ( $auth eq 'api_key' ) { + my $api_key = $self->get_api_key_with_prefix('api_key'); if ($api_key) { $header_params->{'api_key'} = $api_key; } } -elsif ($auth eq 'api_key_query') { - + elsif ( $auth eq 'api_key_query' ) { + my $api_key = $self->get_api_key_with_prefix('api_key_query'); if ($api_key) { $query_params->{'api_key_query'} = $api_key; } } -elsif ($auth eq 'http_basic_test') { - - if ($self->{config}{username} || $self->{config}{password}) { - $header_params->{'Authorization'} = 'Basic ' . encode_base64($self->{config}{username} . ":" . $self->{config}{password}); + elsif ( $auth eq 'http_basic_test' ) { + + if ( $self->{config}{username} || $self->{config}{password} ) { + $header_params->{'Authorization'} = + 'Basic ' + . encode_base64( $self->{config}{username} . ":" + . $self->{config}{password} ); } } -elsif ($auth eq 'petstore_auth') { - - if ($self->{config}{access_token}) { - $header_params->{'Authorization'} = 'Bearer ' . $self->{config}{access_token}; + elsif ( $auth eq 'petstore_auth' ) { + + if ( $self->{config}{access_token} ) { + $header_params->{'Authorization'} = + 'Bearer ' . $self->{config}{access_token}; } } else { - # TODO show warning about security definition not found + # TODO show warning about security definition not found } } } -# The endpoint API class has not found any settings for auth. This may be deliberate, -# in which case update_params_for_auth() will be a no-op. But it may also be that the -# OpenAPI Spec does not describe the intended authorization. So we check in the config for any -# auth tokens and if we find any, we use them for all endpoints; +# The endpoint API class has not found any settings for auth. This may be deliberate, +# in which case update_params_for_auth() will be a no-op. But it may also be that the +# OpenAPI Spec does not describe the intended authorization. So we check in the config for any +# auth tokens and if we find any, we use them for all endpoints; sub _global_auth_setup { - my ($self, $header_params, $query_params) = @_; - - my $tokens = $self->{config}->get_tokens; - return unless keys %$tokens; - - # basic - if (my $uname = delete $tokens->{username}) { - my $pword = delete $tokens->{password}; - $header_params->{'Authorization'} = 'Basic '.encode_base64($uname.":".$pword); - } - - # oauth - if (my $access_token = delete $tokens->{access_token}) { - $header_params->{'Authorization'} = 'Bearer ' . $access_token; - } - - # other keys - foreach my $token_name (keys %$tokens) { - my $in = $tokens->{$token_name}->{in}; - my $token = $self->get_api_key_with_prefix($token_name); - if ($in eq 'head') { - $header_params->{$token_name} = $token; - } - elsif ($in eq 'query') { - $query_params->{$token_name} = $token; - } - else { - die "Don't know where to put token '$token_name' ('$in' is not 'head' or 'query')"; - } - } + my ( $self, $header_params, $query_params ) = @_; + + my $tokens = $self->{config}->get_tokens; + return unless keys %$tokens; + + # basic + if ( my $uname = delete $tokens->{username} ) { + my $pword = delete $tokens->{password}; + $header_params->{'Authorization'} = + 'Basic ' . encode_base64( $uname . ":" . $pword ); + } + + # oauth + if ( my $access_token = delete $tokens->{access_token} ) { + $header_params->{'Authorization'} = 'Bearer ' . $access_token; + } + + # other keys + foreach my $token_name ( keys %$tokens ) { + my $in = $tokens->{$token_name}->{in}; + my $token = $self->get_api_key_with_prefix($token_name); + if ( $in eq 'head' ) { + $header_params->{$token_name} = $token; + } + elsif ( $in eq 'query' ) { + $query_params->{$token_name} = $token; + } + else { + die +"Don't know where to put token '$token_name' ('$in' is not 'head' or 'query')"; + } + } } - 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiFactory.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiFactory.pm index e9fa1328dc9..68583ecd0c5 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiFactory.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/ApiFactory.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -58,9 +59,8 @@ use WWW::OpenAPIClient::ApiClient; =cut # Load all the API classes and construct a lookup table at startup time -my %_apis = map { $_ =~ /^WWW::OpenAPIClient::(.*)$/; $1 => $_ } - grep {$_ =~ /Api$/} - usesub 'WWW::OpenAPIClient'; +my %_apis = map { $_ =~ /^WWW::OpenAPIClient::(.*)$/; $1 => $_ } + grep { $_ =~ /Api$/ } usesub 'WWW::OpenAPIClient'; =head1 new($api_client) @@ -78,9 +78,10 @@ sub new { my ($class) = shift; my $api_client; - if ($_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { + if ( $_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { $api_client = $_[0]; - } else { + } + else { $api_client = WWW::OpenAPIClient::ApiClient->new(@_); } bless { api_client => $api_client }, $class; @@ -97,10 +98,10 @@ sub new { =cut sub get_api { - my ($self, $which) = @_; - croak "API not specified" unless $which; - my $api_class = $_apis{"${which}Api"} || croak "No known API for '$which'"; - return $api_class->new($self->api_client); + my ( $self, $which ) = @_; + croak "API not specified" unless $which; + my $api_class = $_apis{"${which}Api"} || croak "No known API for '$which'"; + return $api_class->new( $self->api_client ); } =head1 api_client() @@ -114,15 +115,16 @@ sub api_client { $_[0]->{api_client} } =head1 apis_available() =cut -sub apis_available { return map { $_ =~ s/Api$//; $_ } sort keys %_apis } +sub apis_available { + return map { $_ =~ s/Api$//; $_ } sort keys %_apis; +} =head1 classname_for() =cut sub classname_for { - my ($self, $api_name) = @_; - return $_apis{"${api_name}Api"}; + my ( $self, $api_name ) = @_; + return $_apis{"${api_name}Api"}; } - 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm index 678f097cbac..acd0f34f705 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Configuration.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -91,80 +92,81 @@ default: http://petstore.swagger.io:80/v2 =cut sub new { - my ($self, %p) = (shift,@_); + my ( $self, %p ) = ( shift, @_ ); - # class/static variables - $p{http_timeout} //= 180; - $p{http_user_agent} //= 'OpenAPI-Generator/1.0.0/perl'; + # class/static variables + $p{http_timeout} //= 180; + $p{http_user_agent} //= 'OpenAPI-Generator/1.0.0/perl'; - # authentication setting - $p{api_key} //= {}; - $p{api_key_prefix} //= {}; - $p{api_key_in} //= {}; + # authentication setting + $p{api_key} //= {}; + $p{api_key_prefix} //= {}; + $p{api_key_in} //= {}; - # username and password for HTTP basic authentication - $p{username} //= ''; - $p{password} //= ''; + # username and password for HTTP basic authentication + $p{username} //= ''; + $p{password} //= ''; - # access token for OAuth - $p{access_token} //= ''; + # access token for OAuth + $p{access_token} //= ''; - # base_url - $p{base_url} //= 'http://petstore.swagger.io:80/v2'; + # base_url + $p{base_url} //= 'http://petstore.swagger.io:80/v2'; - return bless \%p => $self; + return bless \%p => $self; } - sub get_tokens { - my $self = shift; - - my $tokens = {}; - $tokens->{username} = $self->{username} if $self->{username}; - $tokens->{password} = $self->{password} if $self->{password}; - $tokens->{access_token} = $self->{access_token} if $self->{access_token}; - - foreach my $token_name (keys %{ $self->{api_key} }) { - $tokens->{$token_name}->{token} = $self->{api_key}{$token_name}; - $tokens->{$token_name}->{prefix} = $self->{api_key_prefix}{$token_name}; - $tokens->{$token_name}->{in} = $self->{api_key_in}{$token_name}; - } + my $self = shift; - return $tokens; + my $tokens = {}; + $tokens->{username} = $self->{username} if $self->{username}; + $tokens->{password} = $self->{password} if $self->{password}; + $tokens->{access_token} = $self->{access_token} if $self->{access_token}; + + foreach my $token_name ( keys %{ $self->{api_key} } ) { + $tokens->{$token_name}->{token} = $self->{api_key}{$token_name}; + $tokens->{$token_name}->{prefix} = $self->{api_key_prefix}{$token_name}; + $tokens->{$token_name}->{in} = $self->{api_key_in}{$token_name}; + } + + return $tokens; } sub clear_tokens { - my $self = shift; - my %tokens = %{$self->get_tokens}; # copy - - $self->{username} = ''; - $self->{password} = ''; - $self->{access_token} = ''; + my $self = shift; + my %tokens = %{ $self->get_tokens }; # copy - $self->{api_key} = {}; - $self->{api_key_prefix} = {}; - $self->{api_key_in} = {}; - - return \%tokens; + $self->{username} = ''; + $self->{password} = ''; + $self->{access_token} = ''; + + $self->{api_key} = {}; + $self->{api_key_prefix} = {}; + $self->{api_key_in} = {}; + + return \%tokens; } sub accept_tokens { - my ($self, $tokens) = @_; - - foreach my $known_name (qw(username password access_token)) { - next unless $tokens->{$known_name}; - $self->{$known_name} = delete $tokens->{$known_name}; - } - - foreach my $token_name (keys %$tokens) { - $self->{api_key}{$token_name} = $tokens->{$token_name}{token}; - if ($tokens->{$token_name}{prefix}) { - $self->{api_key_prefix}{$token_name} = $tokens->{$token_name}{prefix}; - } - my $in = $tokens->{$token_name}->{in} || 'head'; - croak "Tokens can only go in 'head' or 'query' (not in '$in')" unless $in =~ /^(?:head|query)$/; - $self->{api_key_in}{$token_name} = $in; - } -} + my ( $self, $tokens ) = @_; + + foreach my $known_name (qw(username password access_token)) { + next unless $tokens->{$known_name}; + $self->{$known_name} = delete $tokens->{$known_name}; + } + + foreach my $token_name ( keys %$tokens ) { + $self->{api_key}{$token_name} = $tokens->{$token_name}{token}; + if ( $tokens->{$token_name}{prefix} ) { + $self->{api_key_prefix}{$token_name} = + $tokens->{$token_name}{prefix}; + } + my $in = $tokens->{$token_name}->{in} || 'head'; + croak "Tokens can only go in 'head' or 'query' (not in '$in')" + unless $in =~ /^(?:head|query)$/; + $self->{api_key_in}{$token_name} = $in; + } +} 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm index 03644d1fb18..c7a953b2ec1 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeApi.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -22,7 +23,7 @@ package WWW::OpenAPIClient::FakeApi; require 5.6.0; use strict; use warnings; -use utf8; +use utf8; use Exporter; use Carp qw( croak ); use Log::Any qw($log); @@ -31,15 +32,16 @@ use WWW::OpenAPIClient::ApiClient; use base "Class::Data::Inheritable"; -__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); sub new { my $class = shift; my $api_client; - if ($_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { + if ( $_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { $api_client = $_[0]; - } else { + } + else { $api_client = WWW::OpenAPIClient::ApiClient->new(@_); } @@ -47,50 +49,52 @@ sub new { } - # # fake_outer_boolean_serialize # -# -# +# +# # @param boolean $body Input boolean as post body (optional) { my $params = { - 'body' => { - data_type => 'boolean', - description => 'Input boolean as post body', - required => '0', - }, + 'body' => { + data_type => 'boolean', + description => 'Input boolean as post body', + required => '0', + }, }; - __PACKAGE__->method_documentation->{ 'fake_outer_boolean_serialize' } = { - summary => '', - params => $params, + __PACKAGE__->method_documentation->{'fake_outer_boolean_serialize'} = { + summary => '', + params => $params, returns => 'boolean', - }; + }; } + # @return boolean # sub fake_outer_boolean_serialize { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # parse inputs my $_resource_path = '/fake/outer/boolean'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept('*/*'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); my $_body_data; + # body params - if ( exists $args{'body'}) { + if ( exists $args{'body'} ) { $_body_data = $args{'body'}; } @@ -98,59 +102,64 @@ sub fake_outer_boolean_serialize { my $auth_settings = [qw()]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('boolean', $response); + my $_response_object = + $self->{api_client}->deserialize( 'boolean', $response ); return $_response_object; } # # fake_outer_composite_serialize # -# -# +# +# # @param OuterComposite $outer_composite Input composite as post body (optional) { my $params = { - 'outer_composite' => { - data_type => 'OuterComposite', - description => 'Input composite as post body', - required => '0', - }, + 'outer_composite' => { + data_type => 'OuterComposite', + description => 'Input composite as post body', + required => '0', + }, }; - __PACKAGE__->method_documentation->{ 'fake_outer_composite_serialize' } = { - summary => '', - params => $params, + __PACKAGE__->method_documentation->{'fake_outer_composite_serialize'} = { + summary => '', + params => $params, returns => 'OuterComposite', - }; + }; } + # @return OuterComposite # sub fake_outer_composite_serialize { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # parse inputs my $_resource_path = '/fake/outer/composite'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept('*/*'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); my $_body_data; + # body params - if ( exists $args{'outer_composite'}) { + if ( exists $args{'outer_composite'} ) { $_body_data = $args{'outer_composite'}; } @@ -158,59 +167,64 @@ sub fake_outer_composite_serialize { my $auth_settings = [qw()]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('OuterComposite', $response); + my $_response_object = + $self->{api_client}->deserialize( 'OuterComposite', $response ); return $_response_object; } # # fake_outer_number_serialize # -# -# +# +# # @param double $body Input number as post body (optional) { my $params = { - 'body' => { - data_type => 'double', - description => 'Input number as post body', - required => '0', - }, + 'body' => { + data_type => 'double', + description => 'Input number as post body', + required => '0', + }, }; - __PACKAGE__->method_documentation->{ 'fake_outer_number_serialize' } = { - summary => '', - params => $params, + __PACKAGE__->method_documentation->{'fake_outer_number_serialize'} = { + summary => '', + params => $params, returns => 'double', - }; + }; } + # @return double # sub fake_outer_number_serialize { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # parse inputs my $_resource_path = '/fake/outer/number'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept('*/*'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); my $_body_data; + # body params - if ( exists $args{'body'}) { + if ( exists $args{'body'} ) { $_body_data = $args{'body'}; } @@ -218,59 +232,64 @@ sub fake_outer_number_serialize { my $auth_settings = [qw()]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('double', $response); + my $_response_object = + $self->{api_client}->deserialize( 'double', $response ); return $_response_object; } # # fake_outer_string_serialize # -# -# +# +# # @param string $body Input string as post body (optional) { my $params = { - 'body' => { - data_type => 'string', - description => 'Input string as post body', - required => '0', - }, + 'body' => { + data_type => 'string', + description => 'Input string as post body', + required => '0', + }, }; - __PACKAGE__->method_documentation->{ 'fake_outer_string_serialize' } = { - summary => '', - params => $params, + __PACKAGE__->method_documentation->{'fake_outer_string_serialize'} = { + summary => '', + params => $params, returns => 'string', - }; + }; } + # @return string # sub fake_outer_string_serialize { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # parse inputs my $_resource_path = '/fake/outer/string'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept('*/*'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); my $_body_data; + # body params - if ( exists $args{'body'}) { + if ( exists $args{'body'} ) { $_body_data = $args{'body'}; } @@ -278,80 +297,157 @@ sub fake_outer_string_serialize { my $auth_settings = [qw()]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('string', $response); + my $_response_object = + $self->{api_client}->deserialize( 'string', $response ); return $_response_object; } # -# test_body_with_query_params +# test_body_with_file_schema # -# -# -# @param string $query (required) -# @param User $user (required) +# +# +# @param FileSchemaTestClass $file_schema_test_class (required) { my $params = { - 'query' => { - data_type => 'string', - description => '', - required => '1', - }, - 'user' => { - data_type => 'User', - description => '', - required => '1', - }, + 'file_schema_test_class' => { + data_type => 'FileSchemaTestClass', + description => '', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'test_body_with_query_params' } = { - summary => '', - params => $params, + __PACKAGE__->method_documentation->{'test_body_with_file_schema'} = { + summary => '', + params => $params, returns => undef, - }; + }; } + # @return void # -sub test_body_with_query_params { - my ($self, %args) = @_; +sub test_body_with_file_schema { + my ( $self, %args ) = @_; - # verify the required parameter 'query' is set - unless (exists $args{'query'}) { - croak("Missing the required parameter 'query' when calling test_body_with_query_params"); - } - - # verify the required parameter 'user' is set - unless (exists $args{'user'}) { - croak("Missing the required parameter 'user' when calling test_body_with_query_params"); + # verify the required parameter 'file_schema_test_class' is set + unless ( exists $args{'file_schema_test_class'} ) { + croak( +"Missing the required parameter 'file_schema_test_class' when calling test_body_with_file_schema" + ); } # parse inputs - my $_resource_path = '/fake/body-with-query-params'; + my $_resource_path = '/fake/body-with-file-schema'; - my $_method = 'PUT'; - my $query_params = {}; + my $_method = 'PUT'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type('application/json'); + + my $_body_data; + + # body params + if ( exists $args{'file_schema_test_class'} ) { + $_body_data = $args{'file_schema_test_class'}; + } + + # authentication setting, if any + my $auth_settings = [qw()]; + + # make the API Call + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + return; +} + +# +# test_body_with_query_params +# +# +# +# @param string $query (required) +# @param User $user (required) +{ + my $params = { + 'query' => { + data_type => 'string', + description => '', + required => '1', + }, + 'user' => { + data_type => 'User', + description => '', + required => '1', + }, + }; + __PACKAGE__->method_documentation->{'test_body_with_query_params'} = { + summary => '', + params => $params, + returns => undef, + }; +} + +# @return void +# +sub test_body_with_query_params { + my ( $self, %args ) = @_; + + # verify the required parameter 'query' is set + unless ( exists $args{'query'} ) { + croak( +"Missing the required parameter 'query' when calling test_body_with_query_params" + ); + } + + # verify the required parameter 'user' is set + unless ( exists $args{'user'} ) { + croak( +"Missing the required parameter 'user' when calling test_body_with_query_params" + ); + } + + # parse inputs + my $_resource_path = '/fake/body-with-query-params'; + + my $_method = 'PUT'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = $self->{api_client}->select_header_accept(); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type('application/json'); # query params - if ( exists $args{'query'}) { - $query_params->{'query'} = $self->{api_client}->to_query_value($args{'query'}); + if ( exists $args{'query'} ) { + $query_params->{'query'} = + $self->{api_client}->to_query_value( $args{'query'} ); } my $_body_data; + # body params - if ( exists $args{'user'}) { + if ( exists $args{'user'} ) { $_body_data = $args{'user'}; } @@ -359,9 +455,10 @@ sub test_body_with_query_params { my $auth_settings = [qw()]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -369,50 +466,56 @@ sub test_body_with_query_params { # test_client_model # # To test \"client\" model -# +# # @param Client $client client model (required) { my $params = { - 'client' => { - data_type => 'Client', - description => 'client model', - required => '1', - }, + 'client' => { + data_type => 'Client', + description => 'client model', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'test_client_model' } = { - summary => 'To test \"client\" model', - params => $params, + __PACKAGE__->method_documentation->{'test_client_model'} = { + summary => 'To test \"client\" model', + params => $params, returns => 'Client', - }; + }; } + # @return Client # sub test_client_model { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'client' is set - unless (exists $args{'client'}) { - croak("Missing the required parameter 'client' when calling test_client_model"); + unless ( exists $args{'client'} ) { + croak( +"Missing the required parameter 'client' when calling test_client_model" + ); } # parse inputs my $_resource_path = '/fake'; - my $_method = 'PATCH'; - my $query_params = {}; + my $_method = 'PATCH'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json'); + my $_header_accept = + $self->{api_client}->select_header_accept('application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type('application/json'); my $_body_data; + # body params - if ( exists $args{'client'}) { + if ( exists $args{'client'} ) { $_body_data = $args{'client'}; } @@ -420,21 +523,23 @@ sub test_client_model { my $auth_settings = [qw()]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('Client', $response); + my $_response_object = + $self->{api_client}->deserialize( 'Client', $response ); return $_response_object; } # # test_endpoint_parameters # -# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 -# +# Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 +# # @param double $number None (required) # @param double $double None (required) # @param string $pattern_without_delimiter None (required) @@ -451,202 +556,228 @@ sub test_client_model { # @param string $callback None (optional) { my $params = { - 'number' => { - data_type => 'double', - description => 'None', - required => '1', - }, - 'double' => { - data_type => 'double', - description => 'None', - required => '1', - }, - 'pattern_without_delimiter' => { - data_type => 'string', - description => 'None', - required => '1', - }, - 'byte' => { - data_type => 'string', - description => 'None', - required => '1', - }, - 'integer' => { - data_type => 'int', - description => 'None', - required => '0', - }, - 'int32' => { - data_type => 'int', - description => 'None', - required => '0', - }, - 'int64' => { - data_type => 'int', - description => 'None', - required => '0', - }, - 'float' => { - data_type => 'double', - description => 'None', - required => '0', - }, - 'string' => { - data_type => 'string', - description => 'None', - required => '0', - }, - 'binary' => { - data_type => 'string', - description => 'None', - required => '0', - }, - 'date' => { - data_type => 'DateTime', - description => 'None', - required => '0', - }, - 'date_time' => { - data_type => 'DateTime', - description => 'None', - required => '0', - }, - 'password' => { - data_type => 'string', - description => 'None', - required => '0', - }, - 'callback' => { - data_type => 'string', - description => 'None', - required => '0', - }, + 'number' => { + data_type => 'double', + description => 'None', + required => '1', + }, + 'double' => { + data_type => 'double', + description => 'None', + required => '1', + }, + 'pattern_without_delimiter' => { + data_type => 'string', + description => 'None', + required => '1', + }, + 'byte' => { + data_type => 'string', + description => 'None', + required => '1', + }, + 'integer' => { + data_type => 'int', + description => 'None', + required => '0', + }, + 'int32' => { + data_type => 'int', + description => 'None', + required => '0', + }, + 'int64' => { + data_type => 'int', + description => 'None', + required => '0', + }, + 'float' => { + data_type => 'double', + description => 'None', + required => '0', + }, + 'string' => { + data_type => 'string', + description => 'None', + required => '0', + }, + 'binary' => { + data_type => 'string', + description => 'None', + required => '0', + }, + 'date' => { + data_type => 'DateTime', + description => 'None', + required => '0', + }, + 'date_time' => { + data_type => 'DateTime', + description => 'None', + required => '0', + }, + 'password' => { + data_type => 'string', + description => 'None', + required => '0', + }, + 'callback' => { + data_type => 'string', + description => 'None', + required => '0', + }, }; - __PACKAGE__->method_documentation->{ 'test_endpoint_parameters' } = { - summary => 'Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ', - params => $params, + __PACKAGE__->method_documentation->{'test_endpoint_parameters'} = { + summary => +'Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ', + params => $params, returns => undef, - }; + }; } + # @return void # sub test_endpoint_parameters { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'number' is set - unless (exists $args{'number'}) { - croak("Missing the required parameter 'number' when calling test_endpoint_parameters"); + unless ( exists $args{'number'} ) { + croak( +"Missing the required parameter 'number' when calling test_endpoint_parameters" + ); } # verify the required parameter 'double' is set - unless (exists $args{'double'}) { - croak("Missing the required parameter 'double' when calling test_endpoint_parameters"); + unless ( exists $args{'double'} ) { + croak( +"Missing the required parameter 'double' when calling test_endpoint_parameters" + ); } # verify the required parameter 'pattern_without_delimiter' is set - unless (exists $args{'pattern_without_delimiter'}) { - croak("Missing the required parameter 'pattern_without_delimiter' when calling test_endpoint_parameters"); + unless ( exists $args{'pattern_without_delimiter'} ) { + croak( +"Missing the required parameter 'pattern_without_delimiter' when calling test_endpoint_parameters" + ); } # verify the required parameter 'byte' is set - unless (exists $args{'byte'}) { - croak("Missing the required parameter 'byte' when calling test_endpoint_parameters"); + unless ( exists $args{'byte'} ) { + croak( +"Missing the required parameter 'byte' when calling test_endpoint_parameters" + ); } # parse inputs my $_resource_path = '/fake'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded'); + $header_params->{'Content-Type'} = $self->{api_client} + ->select_header_content_type('application/x-www-form-urlencoded'); # form params if ( exists $args{'integer'} ) { - $form_params->{'integer'} = $self->{api_client}->to_form_value($args{'integer'}); + $form_params->{'integer'} = + $self->{api_client}->to_form_value( $args{'integer'} ); } - + # form params if ( exists $args{'int32'} ) { - $form_params->{'int32'} = $self->{api_client}->to_form_value($args{'int32'}); + $form_params->{'int32'} = + $self->{api_client}->to_form_value( $args{'int32'} ); } - + # form params if ( exists $args{'int64'} ) { - $form_params->{'int64'} = $self->{api_client}->to_form_value($args{'int64'}); + $form_params->{'int64'} = + $self->{api_client}->to_form_value( $args{'int64'} ); } - + # form params if ( exists $args{'number'} ) { - $form_params->{'number'} = $self->{api_client}->to_form_value($args{'number'}); + $form_params->{'number'} = + $self->{api_client}->to_form_value( $args{'number'} ); } - + # form params if ( exists $args{'float'} ) { - $form_params->{'float'} = $self->{api_client}->to_form_value($args{'float'}); + $form_params->{'float'} = + $self->{api_client}->to_form_value( $args{'float'} ); } - + # form params if ( exists $args{'double'} ) { - $form_params->{'double'} = $self->{api_client}->to_form_value($args{'double'}); + $form_params->{'double'} = + $self->{api_client}->to_form_value( $args{'double'} ); } - + # form params if ( exists $args{'string'} ) { - $form_params->{'string'} = $self->{api_client}->to_form_value($args{'string'}); + $form_params->{'string'} = + $self->{api_client}->to_form_value( $args{'string'} ); } - + # form params if ( exists $args{'pattern_without_delimiter'} ) { - $form_params->{'pattern_without_delimiter'} = $self->{api_client}->to_form_value($args{'pattern_without_delimiter'}); + $form_params->{'pattern_without_delimiter'} = $self->{api_client} + ->to_form_value( $args{'pattern_without_delimiter'} ); } - + # form params if ( exists $args{'byte'} ) { - $form_params->{'byte'} = $self->{api_client}->to_form_value($args{'byte'}); + $form_params->{'byte'} = + $self->{api_client}->to_form_value( $args{'byte'} ); } - + # form params if ( exists $args{'binary'} ) { $form_params->{'binary'} = [] unless defined $form_params->{'binary'}; - push @{$form_params->{'binary'}}, $args{'binary'}; - } - + push @{ $form_params->{'binary'} }, $args{'binary'}; + } + # form params if ( exists $args{'date'} ) { - $form_params->{'date'} = $self->{api_client}->to_form_value($args{'date'}); + $form_params->{'date'} = + $self->{api_client}->to_form_value( $args{'date'} ); } - + # form params if ( exists $args{'date_time'} ) { - $form_params->{'dateTime'} = $self->{api_client}->to_form_value($args{'date_time'}); + $form_params->{'dateTime'} = + $self->{api_client}->to_form_value( $args{'date_time'} ); } - + # form params if ( exists $args{'password'} ) { - $form_params->{'password'} = $self->{api_client}->to_form_value($args{'password'}); + $form_params->{'password'} = + $self->{api_client}->to_form_value( $args{'password'} ); } - + # form params if ( exists $args{'callback'} ) { - $form_params->{'callback'} = $self->{api_client}->to_form_value($args{'callback'}); + $form_params->{'callback'} = + $self->{api_client}->to_form_value( $args{'callback'} ); } - + my $_body_data; + # authentication setting, if any my $auth_settings = [qw(http_basic_test )]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -654,7 +785,7 @@ sub test_endpoint_parameters { # test_enum_parameters # # To test enum parameters -# +# # @param ARRAY[string] $enum_header_string_array Header parameter enum test (string array) (optional) # @param string $enum_header_string Header parameter enum test (string) (optional, default to '-efg') # @param ARRAY[string] $enum_query_string_array Query parameter enum test (string array) (optional) @@ -665,121 +796,133 @@ sub test_endpoint_parameters { # @param string $enum_form_string Form parameter enum test (string) (optional, default to '-efg') { my $params = { - 'enum_header_string_array' => { - data_type => 'ARRAY[string]', - description => 'Header parameter enum test (string array)', - required => '0', - }, - 'enum_header_string' => { - data_type => 'string', - description => 'Header parameter enum test (string)', - required => '0', - }, - 'enum_query_string_array' => { - data_type => 'ARRAY[string]', - description => 'Query parameter enum test (string array)', - required => '0', - }, - 'enum_query_string' => { - data_type => 'string', - description => 'Query parameter enum test (string)', - required => '0', - }, - 'enum_query_integer' => { - data_type => 'int', - description => 'Query parameter enum test (double)', - required => '0', - }, - 'enum_query_double' => { - data_type => 'double', - description => 'Query parameter enum test (double)', - required => '0', - }, - 'enum_form_string_array' => { - data_type => 'ARRAY[string]', - description => 'Form parameter enum test (string array)', - required => '0', - }, - 'enum_form_string' => { - data_type => 'string', - description => 'Form parameter enum test (string)', - required => '0', - }, + 'enum_header_string_array' => { + data_type => 'ARRAY[string]', + description => 'Header parameter enum test (string array)', + required => '0', + }, + 'enum_header_string' => { + data_type => 'string', + description => 'Header parameter enum test (string)', + required => '0', + }, + 'enum_query_string_array' => { + data_type => 'ARRAY[string]', + description => 'Query parameter enum test (string array)', + required => '0', + }, + 'enum_query_string' => { + data_type => 'string', + description => 'Query parameter enum test (string)', + required => '0', + }, + 'enum_query_integer' => { + data_type => 'int', + description => 'Query parameter enum test (double)', + required => '0', + }, + 'enum_query_double' => { + data_type => 'double', + description => 'Query parameter enum test (double)', + required => '0', + }, + 'enum_form_string_array' => { + data_type => 'ARRAY[string]', + description => 'Form parameter enum test (string array)', + required => '0', + }, + 'enum_form_string' => { + data_type => 'string', + description => 'Form parameter enum test (string)', + required => '0', + }, }; - __PACKAGE__->method_documentation->{ 'test_enum_parameters' } = { - summary => 'To test enum parameters', - params => $params, + __PACKAGE__->method_documentation->{'test_enum_parameters'} = { + summary => 'To test enum parameters', + params => $params, returns => undef, - }; + }; } + # @return void # sub test_enum_parameters { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # parse inputs my $_resource_path = '/fake'; - my $_method = 'GET'; - my $query_params = {}; + my $_method = 'GET'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded'); + $header_params->{'Content-Type'} = $self->{api_client} + ->select_header_content_type('application/x-www-form-urlencoded'); # query params - if ( exists $args{'enum_query_string_array'}) { - $query_params->{'enum_query_string_array'} = $self->{api_client}->to_query_value($args{'enum_query_string_array'}); + if ( exists $args{'enum_query_string_array'} ) { + $query_params->{'enum_query_string_array'} = $self->{api_client} + ->to_query_value( $args{'enum_query_string_array'} ); } # query params - if ( exists $args{'enum_query_string'}) { - $query_params->{'enum_query_string'} = $self->{api_client}->to_query_value($args{'enum_query_string'}); + if ( exists $args{'enum_query_string'} ) { + $query_params->{'enum_query_string'} = + $self->{api_client}->to_query_value( $args{'enum_query_string'} ); } # query params - if ( exists $args{'enum_query_integer'}) { - $query_params->{'enum_query_integer'} = $self->{api_client}->to_query_value($args{'enum_query_integer'}); + if ( exists $args{'enum_query_integer'} ) { + $query_params->{'enum_query_integer'} = + $self->{api_client}->to_query_value( $args{'enum_query_integer'} ); } # query params - if ( exists $args{'enum_query_double'}) { - $query_params->{'enum_query_double'} = $self->{api_client}->to_query_value($args{'enum_query_double'}); + if ( exists $args{'enum_query_double'} ) { + $query_params->{'enum_query_double'} = + $self->{api_client}->to_query_value( $args{'enum_query_double'} ); } # header params - if ( exists $args{'enum_header_string_array'}) { - $header_params->{'enum_header_string_array'} = $self->{api_client}->to_header_value($args{'enum_header_string_array'}); + if ( exists $args{'enum_header_string_array'} ) { + $header_params->{'enum_header_string_array'} = $self->{api_client} + ->to_header_value( $args{'enum_header_string_array'} ); } # header params - if ( exists $args{'enum_header_string'}) { - $header_params->{'enum_header_string'} = $self->{api_client}->to_header_value($args{'enum_header_string'}); + if ( exists $args{'enum_header_string'} ) { + $header_params->{'enum_header_string'} = + $self->{api_client}->to_header_value( $args{'enum_header_string'} ); } # form params if ( exists $args{'enum_form_string_array'} ) { - $form_params->{'enum_form_string_array'} = $self->{api_client}->to_form_value($args{'enum_form_string_array'}); + $form_params->{'enum_form_string_array'} = + $self->{api_client}->to_form_value( $args{'enum_form_string_array'} ); } - + # form params if ( exists $args{'enum_form_string'} ) { - $form_params->{'enum_form_string'} = $self->{api_client}->to_form_value($args{'enum_form_string'}); + $form_params->{'enum_form_string'} = + $self->{api_client}->to_form_value( $args{'enum_form_string'} ); } - + my $_body_data; + # authentication setting, if any my $auth_settings = [qw()]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -787,50 +930,55 @@ sub test_enum_parameters { # test_inline_additional_properties # # test inline additionalProperties -# +# # @param HASH[string,string] $request_body request body (required) { my $params = { - 'request_body' => { - data_type => 'HASH[string,string]', - description => 'request body', - required => '1', - }, + 'request_body' => { + data_type => 'HASH[string,string]', + description => 'request body', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'test_inline_additional_properties' } = { - summary => 'test inline additionalProperties', - params => $params, + __PACKAGE__->method_documentation->{'test_inline_additional_properties'} = { + summary => 'test inline additionalProperties', + params => $params, returns => undef, - }; + }; } + # @return void # sub test_inline_additional_properties { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'request_body' is set - unless (exists $args{'request_body'}) { - croak("Missing the required parameter 'request_body' when calling test_inline_additional_properties"); + unless ( exists $args{'request_body'} ) { + croak( +"Missing the required parameter 'request_body' when calling test_inline_additional_properties" + ); } # parse inputs my $_resource_path = '/fake/inline-additionalProperties'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type('application/json'); my $_body_data; + # body params - if ( exists $args{'request_body'}) { + if ( exists $args{'request_body'} ) { $_body_data = $args{'request_body'}; } @@ -838,9 +986,10 @@ sub test_inline_additional_properties { my $auth_settings = [qw()]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -848,76 +997,86 @@ sub test_inline_additional_properties { # test_json_form_data # # test json serialization of form data -# +# # @param string $param field1 (required) # @param string $param2 field2 (required) { my $params = { - 'param' => { - data_type => 'string', - description => 'field1', - required => '1', - }, - 'param2' => { - data_type => 'string', - description => 'field2', - required => '1', - }, + 'param' => { + data_type => 'string', + description => 'field1', + required => '1', + }, + 'param2' => { + data_type => 'string', + description => 'field2', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'test_json_form_data' } = { - summary => 'test json serialization of form data', - params => $params, + __PACKAGE__->method_documentation->{'test_json_form_data'} = { + summary => 'test json serialization of form data', + params => $params, returns => undef, - }; + }; } + # @return void # sub test_json_form_data { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'param' is set - unless (exists $args{'param'}) { - croak("Missing the required parameter 'param' when calling test_json_form_data"); + unless ( exists $args{'param'} ) { + croak( +"Missing the required parameter 'param' when calling test_json_form_data" + ); } # verify the required parameter 'param2' is set - unless (exists $args{'param2'}) { - croak("Missing the required parameter 'param2' when calling test_json_form_data"); + unless ( exists $args{'param2'} ) { + croak( +"Missing the required parameter 'param2' when calling test_json_form_data" + ); } # parse inputs my $_resource_path = '/fake/jsonFormData'; - my $_method = 'GET'; - my $query_params = {}; + my $_method = 'GET'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded'); + $header_params->{'Content-Type'} = $self->{api_client} + ->select_header_content_type('application/x-www-form-urlencoded'); # form params if ( exists $args{'param'} ) { - $form_params->{'param'} = $self->{api_client}->to_form_value($args{'param'}); + $form_params->{'param'} = + $self->{api_client}->to_form_value( $args{'param'} ); } - + # form params if ( exists $args{'param2'} ) { - $form_params->{'param2'} = $self->{api_client}->to_form_value($args{'param2'}); + $form_params->{'param2'} = + $self->{api_client}->to_form_value( $args{'param2'} ); } - + my $_body_data; + # authentication setting, if any my $auth_settings = [qw()]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm index 382b1a27925..1d84194e76e 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/FakeClassnameTags123Api.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -22,7 +23,7 @@ package WWW::OpenAPIClient::FakeClassnameTags123Api; require 5.6.0; use strict; use warnings; -use utf8; +use utf8; use Exporter; use Carp qw( croak ); use Log::Any qw($log); @@ -31,15 +32,16 @@ use WWW::OpenAPIClient::ApiClient; use base "Class::Data::Inheritable"; -__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); sub new { my $class = shift; my $api_client; - if ($_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { + if ( $_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { $api_client = $_[0]; - } else { + } + else { $api_client = WWW::OpenAPIClient::ApiClient->new(@_); } @@ -47,55 +49,60 @@ sub new { } - # # test_classname # # To test class name in snake case -# +# # @param Client $client client model (required) { my $params = { - 'client' => { - data_type => 'Client', - description => 'client model', - required => '1', - }, + 'client' => { + data_type => 'Client', + description => 'client model', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'test_classname' } = { - summary => 'To test class name in snake case', - params => $params, + __PACKAGE__->method_documentation->{'test_classname'} = { + summary => 'To test class name in snake case', + params => $params, returns => 'Client', - }; + }; } + # @return Client # sub test_classname { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'client' is set - unless (exists $args{'client'}) { - croak("Missing the required parameter 'client' when calling test_classname"); + unless ( exists $args{'client'} ) { + croak( +"Missing the required parameter 'client' when calling test_classname" + ); } # parse inputs my $_resource_path = '/fake_classname_test'; - my $_method = 'PATCH'; - my $query_params = {}; + my $_method = 'PATCH'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json'); + my $_header_accept = + $self->{api_client}->select_header_accept('application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json'); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type('application/json'); my $_body_data; + # body params - if ( exists $args{'client'}) { + if ( exists $args{'client'} ) { $_body_data = $args{'client'}; } @@ -103,13 +110,15 @@ sub test_classname { my $auth_settings = [qw(api_key_query )]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('Client', $response); + my $_response_object = + $self->{api_client}->deserialize( 'Client', $response ); return $_response_object; } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm index 5df24d81a47..f675161eba1 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AdditionalPropertiesClass.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,78 +97,91 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'AdditionalPropertiesClass', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'map_property' => { + datatype => 'HASH[string,string]', + base_name => 'map_property', + description => '', + format => '', + read_only => '', + }, + 'map_of_map_property' => { + datatype => 'HASH[string,HASH[string,string]]', + base_name => 'map_of_map_property', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'AdditionalPropertiesClass', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'map_property' => 'HASH[string,string]', + 'map_of_map_property' => 'HASH[string,HASH[string,string]]' + } +); -__PACKAGE__->method_documentation({ - 'map_property' => { - datatype => 'HASH[string,string]', - base_name => 'map_property', - description => '', - format => '', - read_only => '', - }, - 'map_of_map_property' => { - datatype => 'HASH[string,HASH[string,string]]', - base_name => 'map_of_map_property', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'map_property' => 'HASH[string,string]', - 'map_of_map_property' => 'HASH[string,HASH[string,string]]' -} ); - -__PACKAGE__->attribute_map( { - 'map_property' => 'map_property', - 'map_of_map_property' => 'map_of_map_property' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'map_property' => 'map_property', + 'map_of_map_property' => 'map_of_map_property' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm index 2d2e89fecb1..8cb4ba10272 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Animal.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,78 +97,91 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'Animal', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'class_name' => { + datatype => 'string', + base_name => 'className', + description => '', + format => '', + read_only => '', + }, + 'color' => { + datatype => 'string', + base_name => 'color', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'Animal', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'class_name' => 'string', + 'color' => 'string' + } +); -__PACKAGE__->method_documentation({ - 'class_name' => { - datatype => 'string', - base_name => 'className', - description => '', - format => '', - read_only => '', - }, - 'color' => { - datatype => 'string', - base_name => 'color', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'class_name' => 'string', - 'color' => 'string' -} ); - -__PACKAGE__->attribute_map( { - 'class_name' => 'className', - 'color' => 'color' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'class_name' => 'className', + 'color' => 'color' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AnimalFarm.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AnimalFarm.pm index 27d93be1436..9a9fd1a4538 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AnimalFarm.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/AnimalFarm.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -32,8 +33,7 @@ use DateTime; use WWW::OpenAPIClient::Object::Animal; -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -61,37 +61,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -99,62 +99,72 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'AnimalFarm', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( {} ); -__PACKAGE__->class_documentation({description => '', - class => 'AnimalFarm', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { -__PACKAGE__->method_documentation({ -}); + } +); -__PACKAGE__->openapi_types( { - -} ); +__PACKAGE__->attribute_map( + { -__PACKAGE__->attribute_map( { - -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm index ddbe5c5a211..701001ede4e 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ApiResponse.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,87 +97,100 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'ApiResponse', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'code' => { + datatype => 'int', + base_name => 'code', + description => '', + format => '', + read_only => '', + }, + 'type' => { + datatype => 'string', + base_name => 'type', + description => '', + format => '', + read_only => '', + }, + 'message' => { + datatype => 'string', + base_name => 'message', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'ApiResponse', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'code' => 'int', + 'type' => 'string', + 'message' => 'string' + } +); -__PACKAGE__->method_documentation({ - 'code' => { - datatype => 'int', - base_name => 'code', - description => '', - format => '', - read_only => '', - }, - 'type' => { - datatype => 'string', - base_name => 'type', - description => '', - format => '', - read_only => '', - }, - 'message' => { - datatype => 'string', - base_name => 'message', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'code' => 'int', - 'type' => 'string', - 'message' => 'string' -} ); - -__PACKAGE__->attribute_map( { - 'code' => 'code', - 'type' => 'type', - 'message' => 'message' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'code' => 'code', + 'type' => 'type', + 'message' => 'message' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm index 6ba81c73888..f3765dca2f0 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfArrayOfNumberOnly.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,69 +97,82 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'ArrayOfArrayOfNumberOnly', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'array_array_number' => { + datatype => 'ARRAY[ARRAY[double]]', + base_name => 'ArrayArrayNumber', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'ArrayOfArrayOfNumberOnly', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'array_array_number' => 'ARRAY[ARRAY[double]]' + } +); -__PACKAGE__->method_documentation({ - 'array_array_number' => { - datatype => 'ARRAY[ARRAY[double]]', - base_name => 'ArrayArrayNumber', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'array_array_number' => 'ARRAY[ARRAY[double]]' -} ); - -__PACKAGE__->attribute_map( { - 'array_array_number' => 'ArrayArrayNumber' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'array_array_number' => 'ArrayArrayNumber' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm index 0dd88817e11..ff843ba89e9 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayOfNumberOnly.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,69 +97,82 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'ArrayOfNumberOnly', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'array_number' => { + datatype => 'ARRAY[double]', + base_name => 'ArrayNumber', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'ArrayOfNumberOnly', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'array_number' => 'ARRAY[double]' + } +); -__PACKAGE__->method_documentation({ - 'array_number' => { - datatype => 'ARRAY[double]', - base_name => 'ArrayNumber', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'array_number' => 'ARRAY[double]' -} ); - -__PACKAGE__->attribute_map( { - 'array_number' => 'ArrayNumber' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'array_number' => 'ArrayNumber' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm index 2f04d5a797c..a8650160c4c 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ArrayTest.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -32,8 +33,7 @@ use DateTime; use WWW::OpenAPIClient::Object::ReadOnlyFirst; -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -61,37 +61,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -99,87 +99,100 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'ArrayTest', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'array_of_string' => { + datatype => 'ARRAY[string]', + base_name => 'array_of_string', + description => '', + format => '', + read_only => '', + }, + 'array_array_of_integer' => { + datatype => 'ARRAY[ARRAY[int]]', + base_name => 'array_array_of_integer', + description => '', + format => '', + read_only => '', + }, + 'array_array_of_model' => { + datatype => 'ARRAY[ARRAY[ReadOnlyFirst]]', + base_name => 'array_array_of_model', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'ArrayTest', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'array_of_string' => 'ARRAY[string]', + 'array_array_of_integer' => 'ARRAY[ARRAY[int]]', + 'array_array_of_model' => 'ARRAY[ARRAY[ReadOnlyFirst]]' + } +); -__PACKAGE__->method_documentation({ - 'array_of_string' => { - datatype => 'ARRAY[string]', - base_name => 'array_of_string', - description => '', - format => '', - read_only => '', - }, - 'array_array_of_integer' => { - datatype => 'ARRAY[ARRAY[int]]', - base_name => 'array_array_of_integer', - description => '', - format => '', - read_only => '', - }, - 'array_array_of_model' => { - datatype => 'ARRAY[ARRAY[ReadOnlyFirst]]', - base_name => 'array_array_of_model', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'array_of_string' => 'ARRAY[string]', - 'array_array_of_integer' => 'ARRAY[ARRAY[int]]', - 'array_array_of_model' => 'ARRAY[ARRAY[ReadOnlyFirst]]' -} ); - -__PACKAGE__->attribute_map( { - 'array_of_string' => 'array_of_string', - 'array_array_of_integer' => 'array_array_of_integer', - 'array_array_of_model' => 'array_array_of_model' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'array_of_string' => 'array_of_string', + 'array_array_of_integer' => 'array_array_of_integer', + 'array_array_of_model' => 'array_array_of_model' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm index 34739279f57..493e82e13e2 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Capitalization.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,114 +97,127 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'Capitalization', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'small_camel' => { + datatype => 'string', + base_name => 'smallCamel', + description => '', + format => '', + read_only => '', + }, + 'capital_camel' => { + datatype => 'string', + base_name => 'CapitalCamel', + description => '', + format => '', + read_only => '', + }, + 'small_snake' => { + datatype => 'string', + base_name => 'small_Snake', + description => '', + format => '', + read_only => '', + }, + 'capital_snake' => { + datatype => 'string', + base_name => 'Capital_Snake', + description => '', + format => '', + read_only => '', + }, + 'sca_eth_flow_points' => { + datatype => 'string', + base_name => 'SCA_ETH_Flow_Points', + description => '', + format => '', + read_only => '', + }, + 'att_name' => { + datatype => 'string', + base_name => 'ATT_NAME', + description => 'Name of the pet ', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'Capitalization', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'small_camel' => 'string', + 'capital_camel' => 'string', + 'small_snake' => 'string', + 'capital_snake' => 'string', + 'sca_eth_flow_points' => 'string', + 'att_name' => 'string' + } +); -__PACKAGE__->method_documentation({ - 'small_camel' => { - datatype => 'string', - base_name => 'smallCamel', - description => '', - format => '', - read_only => '', - }, - 'capital_camel' => { - datatype => 'string', - base_name => 'CapitalCamel', - description => '', - format => '', - read_only => '', - }, - 'small_snake' => { - datatype => 'string', - base_name => 'small_Snake', - description => '', - format => '', - read_only => '', - }, - 'capital_snake' => { - datatype => 'string', - base_name => 'Capital_Snake', - description => '', - format => '', - read_only => '', - }, - 'sca_eth_flow_points' => { - datatype => 'string', - base_name => 'SCA_ETH_Flow_Points', - description => '', - format => '', - read_only => '', - }, - 'att_name' => { - datatype => 'string', - base_name => 'ATT_NAME', - description => 'Name of the pet ', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'small_camel' => 'string', - 'capital_camel' => 'string', - 'small_snake' => 'string', - 'capital_snake' => 'string', - 'sca_eth_flow_points' => 'string', - 'att_name' => 'string' -} ); - -__PACKAGE__->attribute_map( { - 'small_camel' => 'smallCamel', - 'capital_camel' => 'CapitalCamel', - 'small_snake' => 'small_Snake', - 'capital_snake' => 'Capital_Snake', - 'sca_eth_flow_points' => 'SCA_ETH_Flow_Points', - 'att_name' => 'ATT_NAME' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'small_camel' => 'smallCamel', + 'capital_camel' => 'CapitalCamel', + 'small_snake' => 'small_Snake', + 'capital_snake' => 'Capital_Snake', + 'sca_eth_flow_points' => 'SCA_ETH_Flow_Points', + 'att_name' => 'ATT_NAME' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm index 183755cde92..0e22589604e 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Cat.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -32,8 +33,7 @@ use DateTime; use WWW::OpenAPIClient::Object::Animal; -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -61,37 +61,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -99,87 +99,100 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'Cat', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'class_name' => { + datatype => 'string', + base_name => 'className', + description => '', + format => '', + read_only => '', + }, + 'color' => { + datatype => 'string', + base_name => 'color', + description => '', + format => '', + read_only => '', + }, + 'declawed' => { + datatype => 'boolean', + base_name => 'declawed', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'Cat', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'class_name' => 'string', + 'color' => 'string', + 'declawed' => 'boolean' + } +); -__PACKAGE__->method_documentation({ - 'class_name' => { - datatype => 'string', - base_name => 'className', - description => '', - format => '', - read_only => '', - }, - 'color' => { - datatype => 'string', - base_name => 'color', - description => '', - format => '', - read_only => '', - }, - 'declawed' => { - datatype => 'boolean', - base_name => 'declawed', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'class_name' => 'string', - 'color' => 'string', - 'declawed' => 'boolean' -} ); - -__PACKAGE__->attribute_map( { - 'class_name' => 'className', - 'color' => 'color', - 'declawed' => 'declawed' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'class_name' => 'className', + 'color' => 'color', + 'declawed' => 'declawed' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm index 017b17928dc..31ca1111722 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Category.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,78 +97,91 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'Category', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'id' => { + datatype => 'int', + base_name => 'id', + description => '', + format => '', + read_only => '', + }, + 'name' => { + datatype => 'string', + base_name => 'name', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'Category', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'id' => 'int', + 'name' => 'string' + } +); -__PACKAGE__->method_documentation({ - 'id' => { - datatype => 'int', - base_name => 'id', - description => '', - format => '', - read_only => '', - }, - 'name' => { - datatype => 'string', - base_name => 'name', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'id' => 'int', - 'name' => 'string' -} ); - -__PACKAGE__->attribute_map( { - 'id' => 'id', - 'name' => 'name' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'id' => 'id', + 'name' => 'name' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm index 62a1bcefb6a..21862aa4c2f 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ClassModel.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # #Model for testing model with \"_class\" property @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,69 +97,83 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => + 'Model for testing model with \"_class\" property', + class => 'ClassModel', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + '_class' => { + datatype => 'string', + base_name => '_class', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => 'Model for testing model with \"_class\" property', - class => 'ClassModel', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + '_class' => 'string' + } +); -__PACKAGE__->method_documentation({ - '_class' => { - datatype => 'string', - base_name => '_class', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - '_class' => 'string' -} ); - -__PACKAGE__->attribute_map( { - '_class' => '_class' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + '_class' => '_class' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm index fb5375afd37..3f066f5e7be 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Client.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,69 +97,82 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'Client', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'client' => { + datatype => 'string', + base_name => 'client', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'Client', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'client' => 'string' + } +); -__PACKAGE__->method_documentation({ - 'client' => { - datatype => 'string', - base_name => 'client', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'client' => 'string' -} ); - -__PACKAGE__->attribute_map( { - 'client' => 'client' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'client' => 'client' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm index 7574b9ab1ed..0c3f8affbe2 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Dog.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -32,8 +33,7 @@ use DateTime; use WWW::OpenAPIClient::Object::Animal; -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -61,37 +61,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -99,87 +99,100 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'Dog', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'class_name' => { + datatype => 'string', + base_name => 'className', + description => '', + format => '', + read_only => '', + }, + 'color' => { + datatype => 'string', + base_name => 'color', + description => '', + format => '', + read_only => '', + }, + 'breed' => { + datatype => 'string', + base_name => 'breed', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'Dog', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'class_name' => 'string', + 'color' => 'string', + 'breed' => 'string' + } +); -__PACKAGE__->method_documentation({ - 'class_name' => { - datatype => 'string', - base_name => 'className', - description => '', - format => '', - read_only => '', - }, - 'color' => { - datatype => 'string', - base_name => 'color', - description => '', - format => '', - read_only => '', - }, - 'breed' => { - datatype => 'string', - base_name => 'breed', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'class_name' => 'string', - 'color' => 'string', - 'breed' => 'string' -} ); - -__PACKAGE__->attribute_map( { - 'class_name' => 'className', - 'color' => 'color', - 'breed' => 'breed' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'class_name' => 'className', + 'color' => 'color', + 'breed' => 'breed' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm index b9bc8ee4c51..1fd1ff7f64c 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumArrays.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,78 +97,91 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'EnumArrays', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'just_symbol' => { + datatype => 'string', + base_name => 'just_symbol', + description => '', + format => '', + read_only => '', + }, + 'array_enum' => { + datatype => 'ARRAY[string]', + base_name => 'array_enum', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'EnumArrays', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'just_symbol' => 'string', + 'array_enum' => 'ARRAY[string]' + } +); -__PACKAGE__->method_documentation({ - 'just_symbol' => { - datatype => 'string', - base_name => 'just_symbol', - description => '', - format => '', - read_only => '', - }, - 'array_enum' => { - datatype => 'ARRAY[string]', - base_name => 'array_enum', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'just_symbol' => 'string', - 'array_enum' => 'ARRAY[string]' -} ); - -__PACKAGE__->attribute_map( { - 'just_symbol' => 'just_symbol', - 'array_enum' => 'array_enum' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'just_symbol' => 'just_symbol', + 'array_enum' => 'array_enum' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm index 72fd7cd34da..536a4704b9e 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumClass.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,62 +97,72 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'EnumClass', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( {} ); -__PACKAGE__->class_documentation({description => '', - class => 'EnumClass', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { -__PACKAGE__->method_documentation({ -}); + } +); -__PACKAGE__->openapi_types( { - -} ); +__PACKAGE__->attribute_map( + { -__PACKAGE__->attribute_map( { - -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm index 3fbffd72c15..eae5b321562 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/EnumTest.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -32,8 +33,7 @@ use DateTime; use WWW::OpenAPIClient::Object::OuterEnum; -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -61,37 +61,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -99,105 +99,118 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'EnumTest', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'enum_string' => { + datatype => 'string', + base_name => 'enum_string', + description => '', + format => '', + read_only => '', + }, + 'enum_string_required' => { + datatype => 'string', + base_name => 'enum_string_required', + description => '', + format => '', + read_only => '', + }, + 'enum_integer' => { + datatype => 'int', + base_name => 'enum_integer', + description => '', + format => '', + read_only => '', + }, + 'enum_number' => { + datatype => 'double', + base_name => 'enum_number', + description => '', + format => '', + read_only => '', + }, + 'outer_enum' => { + datatype => 'OuterEnum', + base_name => 'outerEnum', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'EnumTest', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'enum_string' => 'string', + 'enum_string_required' => 'string', + 'enum_integer' => 'int', + 'enum_number' => 'double', + 'outer_enum' => 'OuterEnum' + } +); -__PACKAGE__->method_documentation({ - 'enum_string' => { - datatype => 'string', - base_name => 'enum_string', - description => '', - format => '', - read_only => '', - }, - 'enum_string_required' => { - datatype => 'string', - base_name => 'enum_string_required', - description => '', - format => '', - read_only => '', - }, - 'enum_integer' => { - datatype => 'int', - base_name => 'enum_integer', - description => '', - format => '', - read_only => '', - }, - 'enum_number' => { - datatype => 'double', - base_name => 'enum_number', - description => '', - format => '', - read_only => '', - }, - 'outer_enum' => { - datatype => 'OuterEnum', - base_name => 'outerEnum', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'enum_string' => 'string', - 'enum_string_required' => 'string', - 'enum_integer' => 'int', - 'enum_number' => 'double', - 'outer_enum' => 'OuterEnum' -} ); - -__PACKAGE__->attribute_map( { - 'enum_string' => 'enum_string', - 'enum_string_required' => 'enum_string_required', - 'enum_integer' => 'enum_integer', - 'enum_number' => 'enum_number', - 'outer_enum' => 'outerEnum' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'enum_string' => 'enum_string', + 'enum_string_required' => 'enum_string_required', + 'enum_integer' => 'enum_integer', + 'enum_number' => 'enum_number', + 'outer_enum' => 'outerEnum' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm new file mode 100644 index 00000000000..cc2bb1d41d6 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/File.pm @@ -0,0 +1,178 @@ + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::File; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ( "Class::Accessor", "Class::Data::Inheritable" ); + +# +#Must be named `File` for test. +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); + +# new object +sub new { + my ( $class, %args ) = @_; + + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json( JSON->new->convert_blessed->encode(shift) ); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ( $self, $hash ) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); + my @_array = (); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); + } + $self->{$_key} = \@_array; + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { + return $data; + } + else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + +__PACKAGE__->class_documentation( + { + description => 'Must be named `File` for test.', + class => 'File', + required => [], # TODO + } +); + +__PACKAGE__->method_documentation( + { + 'source_uri' => { + datatype => 'string', + base_name => 'sourceURI', + description => 'Test capitalization', + format => '', + read_only => '', + }, + } +); + +__PACKAGE__->openapi_types( + { + 'source_uri' => 'string' + } +); + +__PACKAGE__->attribute_map( + { + 'source_uri' => 'sourceURI' + } +); + +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm new file mode 100644 index 00000000000..5a77413ba12 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FileSchemaTestClass.pm @@ -0,0 +1,189 @@ + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::FileSchemaTestClass; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use WWW::OpenAPIClient::Object::File; + +use base ( "Class::Accessor", "Class::Data::Inheritable" ); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); + +# new object +sub new { + my ( $class, %args ) = @_; + + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json( JSON->new->convert_blessed->encode(shift) ); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ( $self, $hash ) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); + my @_array = (); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); + } + $self->{$_key} = \@_array; + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { + return $data; + } + else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + +__PACKAGE__->class_documentation( + { + description => '', + class => 'FileSchemaTestClass', + required => [], # TODO + } +); + +__PACKAGE__->method_documentation( + { + 'file' => { + datatype => 'File', + base_name => 'file', + description => '', + format => '', + read_only => '', + }, + 'files' => { + datatype => 'ARRAY[File]', + base_name => 'files', + description => '', + format => '', + read_only => '', + }, + } +); + +__PACKAGE__->openapi_types( + { + 'file' => 'File', + 'files' => 'ARRAY[File]' + } +); + +__PACKAGE__->attribute_map( + { + 'file' => 'file', + 'files' => 'files' + } +); + +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm index c796d794c84..625631c4773 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/FormatTest.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,177 +97,190 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'FormatTest', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'integer' => { + datatype => 'int', + base_name => 'integer', + description => '', + format => '', + read_only => '', + }, + 'int32' => { + datatype => 'int', + base_name => 'int32', + description => '', + format => '', + read_only => '', + }, + 'int64' => { + datatype => 'int', + base_name => 'int64', + description => '', + format => '', + read_only => '', + }, + 'number' => { + datatype => 'double', + base_name => 'number', + description => '', + format => '', + read_only => '', + }, + 'float' => { + datatype => 'double', + base_name => 'float', + description => '', + format => '', + read_only => '', + }, + 'double' => { + datatype => 'double', + base_name => 'double', + description => '', + format => '', + read_only => '', + }, + 'string' => { + datatype => 'string', + base_name => 'string', + description => '', + format => '', + read_only => '', + }, + 'byte' => { + datatype => 'string', + base_name => 'byte', + description => '', + format => '', + read_only => '', + }, + 'binary' => { + datatype => 'string', + base_name => 'binary', + description => '', + format => '', + read_only => '', + }, + 'date' => { + datatype => 'DateTime', + base_name => 'date', + description => '', + format => '', + read_only => '', + }, + 'date_time' => { + datatype => 'DateTime', + base_name => 'dateTime', + description => '', + format => '', + read_only => '', + }, + 'uuid' => { + datatype => 'string', + base_name => 'uuid', + description => '', + format => '', + read_only => '', + }, + 'password' => { + datatype => 'string', + base_name => 'password', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'FormatTest', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'integer' => 'int', + 'int32' => 'int', + 'int64' => 'int', + 'number' => 'double', + 'float' => 'double', + 'double' => 'double', + 'string' => 'string', + 'byte' => 'string', + 'binary' => 'string', + 'date' => 'DateTime', + 'date_time' => 'DateTime', + 'uuid' => 'string', + 'password' => 'string' + } +); -__PACKAGE__->method_documentation({ - 'integer' => { - datatype => 'int', - base_name => 'integer', - description => '', - format => '', - read_only => '', - }, - 'int32' => { - datatype => 'int', - base_name => 'int32', - description => '', - format => '', - read_only => '', - }, - 'int64' => { - datatype => 'int', - base_name => 'int64', - description => '', - format => '', - read_only => '', - }, - 'number' => { - datatype => 'double', - base_name => 'number', - description => '', - format => '', - read_only => '', - }, - 'float' => { - datatype => 'double', - base_name => 'float', - description => '', - format => '', - read_only => '', - }, - 'double' => { - datatype => 'double', - base_name => 'double', - description => '', - format => '', - read_only => '', - }, - 'string' => { - datatype => 'string', - base_name => 'string', - description => '', - format => '', - read_only => '', - }, - 'byte' => { - datatype => 'string', - base_name => 'byte', - description => '', - format => '', - read_only => '', - }, - 'binary' => { - datatype => 'string', - base_name => 'binary', - description => '', - format => '', - read_only => '', - }, - 'date' => { - datatype => 'DateTime', - base_name => 'date', - description => '', - format => '', - read_only => '', - }, - 'date_time' => { - datatype => 'DateTime', - base_name => 'dateTime', - description => '', - format => '', - read_only => '', - }, - 'uuid' => { - datatype => 'string', - base_name => 'uuid', - description => '', - format => '', - read_only => '', - }, - 'password' => { - datatype => 'string', - base_name => 'password', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'integer' => 'int', - 'int32' => 'int', - 'int64' => 'int', - 'number' => 'double', - 'float' => 'double', - 'double' => 'double', - 'string' => 'string', - 'byte' => 'string', - 'binary' => 'string', - 'date' => 'DateTime', - 'date_time' => 'DateTime', - 'uuid' => 'string', - 'password' => 'string' -} ); - -__PACKAGE__->attribute_map( { - 'integer' => 'integer', - 'int32' => 'int32', - 'int64' => 'int64', - 'number' => 'number', - 'float' => 'float', - 'double' => 'double', - 'string' => 'string', - 'byte' => 'byte', - 'binary' => 'binary', - 'date' => 'date', - 'date_time' => 'dateTime', - 'uuid' => 'uuid', - 'password' => 'password' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'integer' => 'integer', + 'int32' => 'int32', + 'int64' => 'int64', + 'number' => 'number', + 'float' => 'float', + 'double' => 'double', + 'string' => 'string', + 'byte' => 'byte', + 'binary' => 'binary', + 'date' => 'date', + 'date_time' => 'dateTime', + 'uuid' => 'uuid', + 'password' => 'password' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm index 0c35e214512..843d7de9a6a 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/HasOnlyReadOnly.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,78 +97,91 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'HasOnlyReadOnly', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'bar' => { + datatype => 'string', + base_name => 'bar', + description => '', + format => '', + read_only => '', + }, + 'foo' => { + datatype => 'string', + base_name => 'foo', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'HasOnlyReadOnly', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'bar' => 'string', + 'foo' => 'string' + } +); -__PACKAGE__->method_documentation({ - 'bar' => { - datatype => 'string', - base_name => 'bar', - description => '', - format => '', - read_only => '', - }, - 'foo' => { - datatype => 'string', - base_name => 'foo', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'bar' => 'string', - 'foo' => 'string' -} ); - -__PACKAGE__->attribute_map( { - 'bar' => 'bar', - 'foo' => 'foo' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'bar' => 'bar', + 'foo' => 'foo' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm index 63ee13919e2..15fe1d4dab3 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/List.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,69 +97,82 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'List', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + '_123_list' => { + datatype => 'string', + base_name => '123-list', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'List', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + '_123_list' => 'string' + } +); -__PACKAGE__->method_documentation({ - '_123_list' => { - datatype => 'string', - base_name => '123-list', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - '_123_list' => 'string' -} ); - -__PACKAGE__->attribute_map( { - '_123_list' => '123-list' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + '_123_list' => '123-list' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm index f5e16474b54..43bbd6ec8c1 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MapTest.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,9 @@ use Log::Any qw($log); use Date::Parse; use DateTime; +use WWW::OpenAPIClient::Object::StringBooleanMap; -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +61,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,78 +99,109 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'MapTest', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'map_map_of_string' => { + datatype => 'HASH[string,HASH[string,string]]', + base_name => 'map_map_of_string', + description => '', + format => '', + read_only => '', + }, + 'map_of_enum_string' => { + datatype => 'HASH[string,string]', + base_name => 'map_of_enum_string', + description => '', + format => '', + read_only => '', + }, + 'direct_map' => { + datatype => 'HASH[string,boolean]', + base_name => 'direct_map', + description => '', + format => '', + read_only => '', + }, + 'indirect_map' => { + datatype => 'StringBooleanMap', + base_name => 'indirect_map', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'MapTest', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'map_map_of_string' => 'HASH[string,HASH[string,string]]', + 'map_of_enum_string' => 'HASH[string,string]', + 'direct_map' => 'HASH[string,boolean]', + 'indirect_map' => 'StringBooleanMap' + } +); -__PACKAGE__->method_documentation({ - 'map_map_of_string' => { - datatype => 'HASH[string,HASH[string,string]]', - base_name => 'map_map_of_string', - description => '', - format => '', - read_only => '', - }, - 'map_of_enum_string' => { - datatype => 'HASH[string,string]', - base_name => 'map_of_enum_string', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'map_map_of_string' => 'HASH[string,HASH[string,string]]', - 'map_of_enum_string' => 'HASH[string,string]' -} ); - -__PACKAGE__->attribute_map( { - 'map_map_of_string' => 'map_map_of_string', - 'map_of_enum_string' => 'map_of_enum_string' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'map_map_of_string' => 'map_map_of_string', + 'map_of_enum_string' => 'map_of_enum_string', + 'direct_map' => 'direct_map', + 'indirect_map' => 'indirect_map' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm index 114601dec2b..690a897fd2a 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/MixedPropertiesAndAdditionalPropertiesClass.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -32,8 +33,7 @@ use DateTime; use WWW::OpenAPIClient::Object::Animal; -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -61,37 +61,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -99,87 +99,100 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'MixedPropertiesAndAdditionalPropertiesClass', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'uuid' => { + datatype => 'string', + base_name => 'uuid', + description => '', + format => '', + read_only => '', + }, + 'date_time' => { + datatype => 'DateTime', + base_name => 'dateTime', + description => '', + format => '', + read_only => '', + }, + 'map' => { + datatype => 'HASH[string,Animal]', + base_name => 'map', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'MixedPropertiesAndAdditionalPropertiesClass', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'uuid' => 'string', + 'date_time' => 'DateTime', + 'map' => 'HASH[string,Animal]' + } +); -__PACKAGE__->method_documentation({ - 'uuid' => { - datatype => 'string', - base_name => 'uuid', - description => '', - format => '', - read_only => '', - }, - 'date_time' => { - datatype => 'DateTime', - base_name => 'dateTime', - description => '', - format => '', - read_only => '', - }, - 'map' => { - datatype => 'HASH[string,Animal]', - base_name => 'map', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'uuid' => 'string', - 'date_time' => 'DateTime', - 'map' => 'HASH[string,Animal]' -} ); - -__PACKAGE__->attribute_map( { - 'uuid' => 'uuid', - 'date_time' => 'dateTime', - 'map' => 'map' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'uuid' => 'uuid', + 'date_time' => 'dateTime', + 'map' => 'map' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm index 295e5d11979..ddf6ce2b49b 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Model200Response.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # #Model for testing model name starting with number @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,78 +97,91 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => 'Model for testing model name starting with number', + class => 'Model200Response', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'name' => { + datatype => 'int', + base_name => 'name', + description => '', + format => '', + read_only => '', + }, + 'class' => { + datatype => 'string', + base_name => 'class', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => 'Model for testing model name starting with number', - class => 'Model200Response', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'name' => 'int', + 'class' => 'string' + } +); -__PACKAGE__->method_documentation({ - 'name' => { - datatype => 'int', - base_name => 'name', - description => '', - format => '', - read_only => '', - }, - 'class' => { - datatype => 'string', - base_name => 'class', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'name' => 'int', - 'class' => 'string' -} ); - -__PACKAGE__->attribute_map( { - 'name' => 'name', - 'class' => 'class' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'name' => 'name', + 'class' => 'class' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm index 787855c6e8a..be6304706e4 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ModelReturn.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # #Model for testing reserved words @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,69 +97,82 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => 'Model for testing reserved words', + class => 'ModelReturn', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'return' => { + datatype => 'int', + base_name => 'return', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => 'Model for testing reserved words', - class => 'ModelReturn', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'return' => 'int' + } +); -__PACKAGE__->method_documentation({ - 'return' => { - datatype => 'int', - base_name => 'return', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'return' => 'int' -} ); - -__PACKAGE__->attribute_map( { - 'return' => 'return' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'return' => 'return' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm index ec2b61fc315..28263037b06 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Name.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # #Model for testing model name same as property name @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,96 +97,109 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => 'Model for testing model name same as property name', + class => 'Name', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'name' => { + datatype => 'int', + base_name => 'name', + description => '', + format => '', + read_only => '', + }, + 'snake_case' => { + datatype => 'int', + base_name => 'snake_case', + description => '', + format => '', + read_only => '', + }, + 'property' => { + datatype => 'string', + base_name => 'property', + description => '', + format => '', + read_only => '', + }, + '_123_number' => { + datatype => 'int', + base_name => '123Number', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => 'Model for testing model name same as property name', - class => 'Name', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'name' => 'int', + 'snake_case' => 'int', + 'property' => 'string', + '_123_number' => 'int' + } +); -__PACKAGE__->method_documentation({ - 'name' => { - datatype => 'int', - base_name => 'name', - description => '', - format => '', - read_only => '', - }, - 'snake_case' => { - datatype => 'int', - base_name => 'snake_case', - description => '', - format => '', - read_only => '', - }, - 'property' => { - datatype => 'string', - base_name => 'property', - description => '', - format => '', - read_only => '', - }, - '_123_number' => { - datatype => 'int', - base_name => '123Number', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'name' => 'int', - 'snake_case' => 'int', - 'property' => 'string', - '_123_number' => 'int' -} ); - -__PACKAGE__->attribute_map( { - 'name' => 'name', - 'snake_case' => 'snake_case', - 'property' => 'property', - '_123_number' => '123Number' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'name' => 'name', + 'snake_case' => 'snake_case', + 'property' => 'property', + '_123_number' => '123Number' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm index e02ff8f11d5..f510f275e31 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/NumberOnly.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,69 +97,82 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'NumberOnly', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'just_number' => { + datatype => 'double', + base_name => 'JustNumber', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'NumberOnly', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'just_number' => 'double' + } +); -__PACKAGE__->method_documentation({ - 'just_number' => { - datatype => 'double', - base_name => 'JustNumber', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'just_number' => 'double' -} ); - -__PACKAGE__->attribute_map( { - 'just_number' => 'JustNumber' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'just_number' => 'JustNumber' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm index 3ce9a8542af..5cf212416dd 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Order.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,114 +97,127 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'Order', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'id' => { + datatype => 'int', + base_name => 'id', + description => '', + format => '', + read_only => '', + }, + 'pet_id' => { + datatype => 'int', + base_name => 'petId', + description => '', + format => '', + read_only => '', + }, + 'quantity' => { + datatype => 'int', + base_name => 'quantity', + description => '', + format => '', + read_only => '', + }, + 'ship_date' => { + datatype => 'DateTime', + base_name => 'shipDate', + description => '', + format => '', + read_only => '', + }, + 'status' => { + datatype => 'string', + base_name => 'status', + description => 'Order Status', + format => '', + read_only => '', + }, + 'complete' => { + datatype => 'boolean', + base_name => 'complete', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'Order', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'id' => 'int', + 'pet_id' => 'int', + 'quantity' => 'int', + 'ship_date' => 'DateTime', + 'status' => 'string', + 'complete' => 'boolean' + } +); -__PACKAGE__->method_documentation({ - 'id' => { - datatype => 'int', - base_name => 'id', - description => '', - format => '', - read_only => '', - }, - 'pet_id' => { - datatype => 'int', - base_name => 'petId', - description => '', - format => '', - read_only => '', - }, - 'quantity' => { - datatype => 'int', - base_name => 'quantity', - description => '', - format => '', - read_only => '', - }, - 'ship_date' => { - datatype => 'DateTime', - base_name => 'shipDate', - description => '', - format => '', - read_only => '', - }, - 'status' => { - datatype => 'string', - base_name => 'status', - description => 'Order Status', - format => '', - read_only => '', - }, - 'complete' => { - datatype => 'boolean', - base_name => 'complete', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'id' => 'int', - 'pet_id' => 'int', - 'quantity' => 'int', - 'ship_date' => 'DateTime', - 'status' => 'string', - 'complete' => 'boolean' -} ); - -__PACKAGE__->attribute_map( { - 'id' => 'id', - 'pet_id' => 'petId', - 'quantity' => 'quantity', - 'ship_date' => 'shipDate', - 'status' => 'status', - 'complete' => 'complete' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'id' => 'id', + 'pet_id' => 'petId', + 'quantity' => 'quantity', + 'ship_date' => 'shipDate', + 'status' => 'status', + 'complete' => 'complete' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm index 1d6d19287a1..2fd1f0c90b7 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterComposite.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,87 +97,100 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'OuterComposite', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'my_number' => { + datatype => 'double', + base_name => 'my_number', + description => '', + format => '', + read_only => '', + }, + 'my_string' => { + datatype => 'string', + base_name => 'my_string', + description => '', + format => '', + read_only => '', + }, + 'my_boolean' => { + datatype => 'boolean', + base_name => 'my_boolean', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'OuterComposite', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'my_number' => 'double', + 'my_string' => 'string', + 'my_boolean' => 'boolean' + } +); -__PACKAGE__->method_documentation({ - 'my_number' => { - datatype => 'double', - base_name => 'my_number', - description => '', - format => '', - read_only => '', - }, - 'my_string' => { - datatype => 'string', - base_name => 'my_string', - description => '', - format => '', - read_only => '', - }, - 'my_boolean' => { - datatype => 'boolean', - base_name => 'my_boolean', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'my_number' => 'double', - 'my_string' => 'string', - 'my_boolean' => 'boolean' -} ); - -__PACKAGE__->attribute_map( { - 'my_number' => 'my_number', - 'my_string' => 'my_string', - 'my_boolean' => 'my_boolean' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'my_number' => 'my_number', + 'my_string' => 'my_string', + 'my_boolean' => 'my_boolean' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm index bc3db9cb9a2..8971becbd38 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/OuterEnum.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,62 +97,72 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'OuterEnum', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( {} ); -__PACKAGE__->class_documentation({description => '', - class => 'OuterEnum', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { -__PACKAGE__->method_documentation({ -}); + } +); -__PACKAGE__->openapi_types( { - -} ); +__PACKAGE__->attribute_map( + { -__PACKAGE__->attribute_map( { - -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm index 926a64d7f8f..a0514b51706 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Pet.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -33,8 +34,7 @@ use DateTime; use WWW::OpenAPIClient::Object::Category; use WWW::OpenAPIClient::Object::Tag; -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -62,37 +62,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -100,114 +100,127 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'Pet', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'id' => { + datatype => 'int', + base_name => 'id', + description => '', + format => '', + read_only => '', + }, + 'category' => { + datatype => 'Category', + base_name => 'category', + description => '', + format => '', + read_only => '', + }, + 'name' => { + datatype => 'string', + base_name => 'name', + description => '', + format => '', + read_only => '', + }, + 'photo_urls' => { + datatype => 'ARRAY[string]', + base_name => 'photoUrls', + description => '', + format => '', + read_only => '', + }, + 'tags' => { + datatype => 'ARRAY[Tag]', + base_name => 'tags', + description => '', + format => '', + read_only => '', + }, + 'status' => { + datatype => 'string', + base_name => 'status', + description => 'pet status in the store', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'Pet', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'id' => 'int', + 'category' => 'Category', + 'name' => 'string', + 'photo_urls' => 'ARRAY[string]', + 'tags' => 'ARRAY[Tag]', + 'status' => 'string' + } +); -__PACKAGE__->method_documentation({ - 'id' => { - datatype => 'int', - base_name => 'id', - description => '', - format => '', - read_only => '', - }, - 'category' => { - datatype => 'Category', - base_name => 'category', - description => '', - format => '', - read_only => '', - }, - 'name' => { - datatype => 'string', - base_name => 'name', - description => '', - format => '', - read_only => '', - }, - 'photo_urls' => { - datatype => 'ARRAY[string]', - base_name => 'photoUrls', - description => '', - format => '', - read_only => '', - }, - 'tags' => { - datatype => 'ARRAY[Tag]', - base_name => 'tags', - description => '', - format => '', - read_only => '', - }, - 'status' => { - datatype => 'string', - base_name => 'status', - description => 'pet status in the store', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'id' => 'int', - 'category' => 'Category', - 'name' => 'string', - 'photo_urls' => 'ARRAY[string]', - 'tags' => 'ARRAY[Tag]', - 'status' => 'string' -} ); - -__PACKAGE__->attribute_map( { - 'id' => 'id', - 'category' => 'category', - 'name' => 'name', - 'photo_urls' => 'photoUrls', - 'tags' => 'tags', - 'status' => 'status' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'id' => 'id', + 'category' => 'category', + 'name' => 'name', + 'photo_urls' => 'photoUrls', + 'tags' => 'tags', + 'status' => 'status' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm index cfe76277e97..eff226b18ac 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/ReadOnlyFirst.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,78 +97,91 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'ReadOnlyFirst', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'bar' => { + datatype => 'string', + base_name => 'bar', + description => '', + format => '', + read_only => '', + }, + 'baz' => { + datatype => 'string', + base_name => 'baz', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'ReadOnlyFirst', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'bar' => 'string', + 'baz' => 'string' + } +); -__PACKAGE__->method_documentation({ - 'bar' => { - datatype => 'string', - base_name => 'bar', - description => '', - format => '', - read_only => '', - }, - 'baz' => { - datatype => 'string', - base_name => 'baz', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'bar' => 'string', - 'baz' => 'string' -} ); - -__PACKAGE__->attribute_map( { - 'bar' => 'bar', - 'baz' => 'baz' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'bar' => 'bar', + 'baz' => 'baz' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm index 04a7e156cec..48968ba008e 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/SpecialModelName.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,69 +97,82 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'SpecialModelName', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + '__special[property/name]' => { + datatype => 'int', + base_name => '$special[property.name]', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'SpecialModelName', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + '__special[property/name]' => 'int' + } +); -__PACKAGE__->method_documentation({ - '__special[property/name]' => { - datatype => 'int', - base_name => '$special[property.name]', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - '__special[property/name]' => 'int' -} ); - -__PACKAGE__->attribute_map( { - '__special[property/name]' => '$special[property.name]' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + '__special[property/name]' => '$special[property.name]' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/StringBooleanMap.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/StringBooleanMap.pm new file mode 100644 index 00000000000..95cc675bf78 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/StringBooleanMap.pm @@ -0,0 +1,168 @@ + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +package WWW::OpenAPIClient::Object::StringBooleanMap; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ( "Class::Accessor", "Class::Data::Inheritable" ); + +# +# +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). Do not edit the class manually. +# REF: https://openapi-generator.tech +# + +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +# Do not edit the class manually. +# Ref: https://openapi-generator.tech +# +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); + +# new object +sub new { + my ( $class, %args ) = @_; + + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json( JSON->new->convert_blessed->encode(shift) ); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ( $self, $hash ) = @_; + + # loop through attributes and use openapi_types to deserialize the data + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); + my @_array = (); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); + } + $self->{$_key} = \@_array; + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { + return $data; + } + else { # hash(model) + my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + +__PACKAGE__->class_documentation( + { + description => '', + class => 'StringBooleanMap', + required => [], # TODO + } +); + +__PACKAGE__->method_documentation( {} ); + +__PACKAGE__->openapi_types( + { + + } +); + +__PACKAGE__->attribute_map( + { + + } +); + +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); + +1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm index 835f6668a5f..9f15607bd84 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/Tag.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,78 +97,91 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'Tag', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'id' => { + datatype => 'int', + base_name => 'id', + description => '', + format => '', + read_only => '', + }, + 'name' => { + datatype => 'string', + base_name => 'name', + description => '', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'Tag', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'id' => 'int', + 'name' => 'string' + } +); -__PACKAGE__->method_documentation({ - 'id' => { - datatype => 'int', - base_name => 'id', - description => '', - format => '', - read_only => '', - }, - 'name' => { - datatype => 'string', - base_name => 'name', - description => '', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'id' => 'int', - 'name' => 'string' -} ); - -__PACKAGE__->attribute_map( { - 'id' => 'id', - 'name' => 'name' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'id' => 'id', + 'name' => 'name' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm index fecadeff77f..3712522fbb4 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Object/User.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -30,9 +31,7 @@ use Log::Any qw($log); use Date::Parse; use DateTime; - -use base ("Class::Accessor", "Class::Data::Inheritable"); - +use base ( "Class::Accessor", "Class::Data::Inheritable" ); # # @@ -60,37 +59,37 @@ Generated by: https://openapi-generator.tech # Do not edit the class manually. # Ref: https://openapi-generator.tech # -__PACKAGE__->mk_classdata('attribute_map' => {}); -__PACKAGE__->mk_classdata('openapi_types' => {}); -__PACKAGE__->mk_classdata('method_documentation' => {}); -__PACKAGE__->mk_classdata('class_documentation' => {}); +__PACKAGE__->mk_classdata( 'attribute_map' => {} ); +__PACKAGE__->mk_classdata( 'openapi_types' => {} ); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); +__PACKAGE__->mk_classdata( 'class_documentation' => {} ); # new object -sub new { - my ($class, %args) = @_; +sub new { + my ( $class, %args ) = @_; - my $self = bless {}, $class; - - foreach my $attribute (keys %{$class->attribute_map}) { - my $args_key = $class->attribute_map->{$attribute}; - $self->$attribute( $args{ $args_key } ); - } - - return $self; -} + my $self = bless {}, $class; + + foreach my $attribute ( keys %{ $class->attribute_map } ) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{$args_key} ); + } + + return $self; +} # return perl hash sub to_hash { - return decode_json(JSON->new->convert_blessed->encode( shift )); + return decode_json( JSON->new->convert_blessed->encode(shift) ); } # used by JSON for serialization -sub TO_JSON { - my $self = shift; +sub TO_JSON { + my $self = shift; my $_data = {}; - foreach my $_key (keys %{$self->attribute_map}) { - if (defined $self->{$_key}) { - $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + foreach my $_key ( keys %{ $self->attribute_map } ) { + if ( defined $self->{$_key} ) { + $_data->{ $self->attribute_map->{$_key} } = $self->{$_key}; } } return $_data; @@ -98,132 +97,145 @@ sub TO_JSON { # from Perl hashref sub from_hash { - my ($self, $hash) = @_; + my ( $self, $hash ) = @_; # loop through attributes and use openapi_types to deserialize the data - while ( my ($_key, $_type) = each %{$self->openapi_types} ) { - my $_json_attribute = $self->attribute_map->{$_key}; - if ($_type =~ /^array\[/i) { # array - my $_subclass = substr($_type, 6, -1); + while ( my ( $_key, $_type ) = each %{ $self->openapi_types } ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ( $_type =~ /^array\[/i ) { # array + my $_subclass = substr( $_type, 6, -1 ); my @_array = (); - foreach my $_element (@{$hash->{$_json_attribute}}) { - push @_array, $self->_deserialize($_subclass, $_element); + foreach my $_element ( @{ $hash->{$_json_attribute} } ) { + push @_array, $self->_deserialize( $_subclass, $_element ); } $self->{$_key} = \@_array; - } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime - $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); - } else { - $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + elsif ( exists $hash->{$_json_attribute} ) + { #hash(model), primitive, datetime + $self->{$_key} = + $self->_deserialize( $_type, $hash->{$_json_attribute} ); + } + else { + $log->debugf( "Warning: %s (%s) does not exist in input hash\n", + $_key, $_json_attribute ); } } - + return $self; } # deserialize non-array data sub _deserialize { - my ($self, $type, $data) = @_; - $log->debugf("deserializing %s with %s",Dumper($data), $type); - - if ($type eq 'DateTime') { - return DateTime->from_epoch(epoch => str2time($data)); - } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + my ( $self, $type, $data ) = @_; + $log->debugf( "deserializing %s with %s", Dumper($data), $type ); + + if ( $type eq 'DateTime' ) { + return DateTime->from_epoch( epoch => str2time($data) ); + } + elsif ( grep( /^$type$/, ( 'int', 'double', 'string', 'boolean' ) ) ) { return $data; - } else { # hash(model) + } + else { # hash(model) my $_instance = eval "WWW::OpenAPIClient::Object::$type->new()"; return $_instance->from_hash($data); } } +__PACKAGE__->class_documentation( + { + description => '', + class => 'User', + required => [], # TODO + } +); +__PACKAGE__->method_documentation( + { + 'id' => { + datatype => 'int', + base_name => 'id', + description => '', + format => '', + read_only => '', + }, + 'username' => { + datatype => 'string', + base_name => 'username', + description => '', + format => '', + read_only => '', + }, + 'first_name' => { + datatype => 'string', + base_name => 'firstName', + description => '', + format => '', + read_only => '', + }, + 'last_name' => { + datatype => 'string', + base_name => 'lastName', + description => '', + format => '', + read_only => '', + }, + 'email' => { + datatype => 'string', + base_name => 'email', + description => '', + format => '', + read_only => '', + }, + 'password' => { + datatype => 'string', + base_name => 'password', + description => '', + format => '', + read_only => '', + }, + 'phone' => { + datatype => 'string', + base_name => 'phone', + description => '', + format => '', + read_only => '', + }, + 'user_status' => { + datatype => 'int', + base_name => 'userStatus', + description => 'User Status', + format => '', + read_only => '', + }, + } +); -__PACKAGE__->class_documentation({description => '', - class => 'User', - required => [], # TODO -} ); +__PACKAGE__->openapi_types( + { + 'id' => 'int', + 'username' => 'string', + 'first_name' => 'string', + 'last_name' => 'string', + 'email' => 'string', + 'password' => 'string', + 'phone' => 'string', + 'user_status' => 'int' + } +); -__PACKAGE__->method_documentation({ - 'id' => { - datatype => 'int', - base_name => 'id', - description => '', - format => '', - read_only => '', - }, - 'username' => { - datatype => 'string', - base_name => 'username', - description => '', - format => '', - read_only => '', - }, - 'first_name' => { - datatype => 'string', - base_name => 'firstName', - description => '', - format => '', - read_only => '', - }, - 'last_name' => { - datatype => 'string', - base_name => 'lastName', - description => '', - format => '', - read_only => '', - }, - 'email' => { - datatype => 'string', - base_name => 'email', - description => '', - format => '', - read_only => '', - }, - 'password' => { - datatype => 'string', - base_name => 'password', - description => '', - format => '', - read_only => '', - }, - 'phone' => { - datatype => 'string', - base_name => 'phone', - description => '', - format => '', - read_only => '', - }, - 'user_status' => { - datatype => 'int', - base_name => 'userStatus', - description => 'User Status', - format => '', - read_only => '', - }, -}); - -__PACKAGE__->openapi_types( { - 'id' => 'int', - 'username' => 'string', - 'first_name' => 'string', - 'last_name' => 'string', - 'email' => 'string', - 'password' => 'string', - 'phone' => 'string', - 'user_status' => 'int' -} ); - -__PACKAGE__->attribute_map( { - 'id' => 'id', - 'username' => 'username', - 'first_name' => 'firstName', - 'last_name' => 'lastName', - 'email' => 'email', - 'password' => 'password', - 'phone' => 'phone', - 'user_status' => 'userStatus' -} ); - -__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); +__PACKAGE__->attribute_map( + { + 'id' => 'id', + 'username' => 'username', + 'first_name' => 'firstName', + 'last_name' => 'lastName', + 'email' => 'email', + 'password' => 'password', + 'phone' => 'phone', + 'user_status' => 'userStatus' + } +); +__PACKAGE__->mk_accessors( keys %{ __PACKAGE__->attribute_map } ); 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/PetApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/PetApi.pm index 4bbf6bc58ce..9961299544e 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/PetApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/PetApi.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -22,7 +23,7 @@ package WWW::OpenAPIClient::PetApi; require 5.6.0; use strict; use warnings; -use utf8; +use utf8; use Exporter; use Carp qw( croak ); use Log::Any qw($log); @@ -31,15 +32,16 @@ use WWW::OpenAPIClient::ApiClient; use base "Class::Data::Inheritable"; -__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); sub new { my $class = shift; my $api_client; - if ($_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { + if ( $_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { $api_client = $_[0]; - } else { + } + else { $api_client = WWW::OpenAPIClient::ApiClient->new(@_); } @@ -47,55 +49,57 @@ sub new { } - # # add_pet # # Add a new pet to the store -# +# # @param Pet $pet Pet object that needs to be added to the store (required) { my $params = { - 'pet' => { - data_type => 'Pet', - description => 'Pet object that needs to be added to the store', - required => '1', - }, + 'pet' => { + data_type => 'Pet', + description => 'Pet object that needs to be added to the store', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'add_pet' } = { - summary => 'Add a new pet to the store', - params => $params, + __PACKAGE__->method_documentation->{'add_pet'} = { + summary => 'Add a new pet to the store', + params => $params, returns => undef, - }; + }; } + # @return void # sub add_pet { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'pet' is set - unless (exists $args{'pet'}) { - croak("Missing the required parameter 'pet' when calling add_pet"); + unless ( exists $args{'pet'} ) { + croak("Missing the required parameter 'pet' when calling add_pet"); } # parse inputs my $_resource_path = '/pet'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', 'application/xml'); + $header_params->{'Content-Type'} = $self->{api_client} + ->select_header_content_type( 'application/json', 'application/xml' ); my $_body_data; + # body params - if ( exists $args{'pet'}) { + if ( exists $args{'pet'} ) { $_body_data = $args{'pet'}; } @@ -103,9 +107,10 @@ sub add_pet { my $auth_settings = [qw(petstore_auth )]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -113,73 +118,79 @@ sub add_pet { # delete_pet # # Deletes a pet -# +# # @param int $pet_id Pet id to delete (required) # @param string $api_key (optional) { my $params = { - 'pet_id' => { - data_type => 'int', - description => 'Pet id to delete', - required => '1', - }, - 'api_key' => { - data_type => 'string', - description => '', - required => '0', - }, + 'pet_id' => { + data_type => 'int', + description => 'Pet id to delete', + required => '1', + }, + 'api_key' => { + data_type => 'string', + description => '', + required => '0', + }, }; - __PACKAGE__->method_documentation->{ 'delete_pet' } = { - summary => 'Deletes a pet', - params => $params, + __PACKAGE__->method_documentation->{'delete_pet'} = { + summary => 'Deletes a pet', + params => $params, returns => undef, - }; + }; } + # @return void # sub delete_pet { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'pet_id' is set - unless (exists $args{'pet_id'}) { - croak("Missing the required parameter 'pet_id' when calling delete_pet"); + unless ( exists $args{'pet_id'} ) { + croak( + "Missing the required parameter 'pet_id' when calling delete_pet"); } # parse inputs my $_resource_path = '/pet/{petId}'; - my $_method = 'DELETE'; - my $query_params = {}; + my $_method = 'DELETE'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); # header params - if ( exists $args{'api_key'}) { - $header_params->{'api_key'} = $self->{api_client}->to_header_value($args{'api_key'}); + if ( exists $args{'api_key'} ) { + $header_params->{'api_key'} = + $self->{api_client}->to_header_value( $args{'api_key'} ); } # path params - if ( exists $args{'pet_id'}) { + if ( exists $args{'pet_id'} ) { my $_base_variable = "{" . "petId" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'pet_id'}); + my $_base_value = $self->{api_client}->to_path_value( $args{'pet_id'} ); $_resource_path =~ s/$_base_variable/$_base_value/g; } my $_body_data; + # authentication setting, if any my $auth_settings = [qw(petstore_auth )]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -187,64 +198,74 @@ sub delete_pet { # find_pets_by_status # # Finds Pets by status -# +# # @param ARRAY[string] $status Status values that need to be considered for filter (required) { my $params = { - 'status' => { - data_type => 'ARRAY[string]', - description => 'Status values that need to be considered for filter', - required => '1', - }, + 'status' => { + data_type => 'ARRAY[string]', + description => + 'Status values that need to be considered for filter', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'find_pets_by_status' } = { - summary => 'Finds Pets by status', - params => $params, + __PACKAGE__->method_documentation->{'find_pets_by_status'} = { + summary => 'Finds Pets by status', + params => $params, returns => 'ARRAY[Pet]', - }; + }; } + # @return ARRAY[Pet] # sub find_pets_by_status { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'status' is set - unless (exists $args{'status'}) { - croak("Missing the required parameter 'status' when calling find_pets_by_status"); + unless ( exists $args{'status'} ) { + croak( +"Missing the required parameter 'status' when calling find_pets_by_status" + ); } # parse inputs my $_resource_path = '/pet/findByStatus'; - my $_method = 'GET'; - my $query_params = {}; + my $_method = 'GET'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); + my $_header_accept = $self->{api_client} + ->select_header_accept( 'application/xml', 'application/json' ); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); # query params - if ( exists $args{'status'}) { - $query_params->{'status'} = $self->{api_client}->to_query_value($args{'status'}); + if ( exists $args{'status'} ) { + $query_params->{'status'} = + $self->{api_client}->to_query_value( $args{'status'} ); } my $_body_data; + # authentication setting, if any my $auth_settings = [qw(petstore_auth )]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('ARRAY[Pet]', $response); + my $_response_object = + $self->{api_client}->deserialize( 'ARRAY[Pet]', $response ); return $_response_object; } @@ -252,64 +273,73 @@ sub find_pets_by_status { # find_pets_by_tags # # Finds Pets by tags -# +# # @param ARRAY[string] $tags Tags to filter by (required) { my $params = { - 'tags' => { - data_type => 'ARRAY[string]', - description => 'Tags to filter by', - required => '1', - }, + 'tags' => { + data_type => 'ARRAY[string]', + description => 'Tags to filter by', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'find_pets_by_tags' } = { - summary => 'Finds Pets by tags', - params => $params, + __PACKAGE__->method_documentation->{'find_pets_by_tags'} = { + summary => 'Finds Pets by tags', + params => $params, returns => 'ARRAY[Pet]', - }; + }; } + # @return ARRAY[Pet] # sub find_pets_by_tags { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'tags' is set - unless (exists $args{'tags'}) { - croak("Missing the required parameter 'tags' when calling find_pets_by_tags"); + unless ( exists $args{'tags'} ) { + croak( +"Missing the required parameter 'tags' when calling find_pets_by_tags" + ); } # parse inputs my $_resource_path = '/pet/findByTags'; - my $_method = 'GET'; - my $query_params = {}; + my $_method = 'GET'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); + my $_header_accept = $self->{api_client} + ->select_header_accept( 'application/xml', 'application/json' ); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); # query params - if ( exists $args{'tags'}) { - $query_params->{'tags'} = $self->{api_client}->to_query_value($args{'tags'}); + if ( exists $args{'tags'} ) { + $query_params->{'tags'} = + $self->{api_client}->to_query_value( $args{'tags'} ); } my $_body_data; + # authentication setting, if any my $auth_settings = [qw(petstore_auth )]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('ARRAY[Pet]', $response); + my $_response_object = + $self->{api_client}->deserialize( 'ARRAY[Pet]', $response ); return $_response_object; } @@ -317,66 +347,73 @@ sub find_pets_by_tags { # get_pet_by_id # # Find pet by ID -# +# # @param int $pet_id ID of pet to return (required) { my $params = { - 'pet_id' => { - data_type => 'int', - description => 'ID of pet to return', - required => '1', - }, + 'pet_id' => { + data_type => 'int', + description => 'ID of pet to return', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'get_pet_by_id' } = { - summary => 'Find pet by ID', - params => $params, + __PACKAGE__->method_documentation->{'get_pet_by_id'} = { + summary => 'Find pet by ID', + params => $params, returns => 'Pet', - }; + }; } + # @return Pet # sub get_pet_by_id { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'pet_id' is set - unless (exists $args{'pet_id'}) { - croak("Missing the required parameter 'pet_id' when calling get_pet_by_id"); + unless ( exists $args{'pet_id'} ) { + croak( + "Missing the required parameter 'pet_id' when calling get_pet_by_id" + ); } # parse inputs my $_resource_path = '/pet/{petId}'; - my $_method = 'GET'; - my $query_params = {}; + my $_method = 'GET'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); + my $_header_accept = $self->{api_client} + ->select_header_accept( 'application/xml', 'application/json' ); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); # path params - if ( exists $args{'pet_id'}) { + if ( exists $args{'pet_id'} ) { my $_base_variable = "{" . "petId" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'pet_id'}); + my $_base_value = $self->{api_client}->to_path_value( $args{'pet_id'} ); $_resource_path =~ s/$_base_variable/$_base_value/g; } my $_body_data; + # authentication setting, if any my $auth_settings = [qw(api_key )]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('Pet', $response); + my $_response_object = $self->{api_client}->deserialize( 'Pet', $response ); return $_response_object; } @@ -384,50 +421,53 @@ sub get_pet_by_id { # update_pet # # Update an existing pet -# +# # @param Pet $pet Pet object that needs to be added to the store (required) { my $params = { - 'pet' => { - data_type => 'Pet', - description => 'Pet object that needs to be added to the store', - required => '1', - }, + 'pet' => { + data_type => 'Pet', + description => 'Pet object that needs to be added to the store', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'update_pet' } = { - summary => 'Update an existing pet', - params => $params, + __PACKAGE__->method_documentation->{'update_pet'} = { + summary => 'Update an existing pet', + params => $params, returns => undef, - }; + }; } + # @return void # sub update_pet { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'pet' is set - unless (exists $args{'pet'}) { - croak("Missing the required parameter 'pet' when calling update_pet"); + unless ( exists $args{'pet'} ) { + croak("Missing the required parameter 'pet' when calling update_pet"); } # parse inputs my $_resource_path = '/pet'; - my $_method = 'PUT'; - my $query_params = {}; + my $_method = 'PUT'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/json', 'application/xml'); + $header_params->{'Content-Type'} = $self->{api_client} + ->select_header_content_type( 'application/json', 'application/xml' ); my $_body_data; + # body params - if ( exists $args{'pet'}) { + if ( exists $args{'pet'} ) { $_body_data = $args{'pet'}; } @@ -435,9 +475,10 @@ sub update_pet { my $auth_settings = [qw(petstore_auth )]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -445,84 +486,92 @@ sub update_pet { # update_pet_with_form # # Updates a pet in the store with form data -# +# # @param int $pet_id ID of pet that needs to be updated (required) # @param string $name Updated name of the pet (optional) # @param string $status Updated status of the pet (optional) { my $params = { - 'pet_id' => { - data_type => 'int', - description => 'ID of pet that needs to be updated', - required => '1', - }, - 'name' => { - data_type => 'string', - description => 'Updated name of the pet', - required => '0', - }, - 'status' => { - data_type => 'string', - description => 'Updated status of the pet', - required => '0', - }, + 'pet_id' => { + data_type => 'int', + description => 'ID of pet that needs to be updated', + required => '1', + }, + 'name' => { + data_type => 'string', + description => 'Updated name of the pet', + required => '0', + }, + 'status' => { + data_type => 'string', + description => 'Updated status of the pet', + required => '0', + }, }; - __PACKAGE__->method_documentation->{ 'update_pet_with_form' } = { - summary => 'Updates a pet in the store with form data', - params => $params, + __PACKAGE__->method_documentation->{'update_pet_with_form'} = { + summary => 'Updates a pet in the store with form data', + params => $params, returns => undef, - }; + }; } + # @return void # sub update_pet_with_form { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'pet_id' is set - unless (exists $args{'pet_id'}) { - croak("Missing the required parameter 'pet_id' when calling update_pet_with_form"); + unless ( exists $args{'pet_id'} ) { + croak( +"Missing the required parameter 'pet_id' when calling update_pet_with_form" + ); } # parse inputs my $_resource_path = '/pet/{petId}'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('application/x-www-form-urlencoded'); + $header_params->{'Content-Type'} = $self->{api_client} + ->select_header_content_type('application/x-www-form-urlencoded'); # path params - if ( exists $args{'pet_id'}) { + if ( exists $args{'pet_id'} ) { my $_base_variable = "{" . "petId" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'pet_id'}); + my $_base_value = $self->{api_client}->to_path_value( $args{'pet_id'} ); $_resource_path =~ s/$_base_variable/$_base_value/g; } # form params if ( exists $args{'name'} ) { - $form_params->{'name'} = $self->{api_client}->to_form_value($args{'name'}); + $form_params->{'name'} = + $self->{api_client}->to_form_value( $args{'name'} ); } - + # form params if ( exists $args{'status'} ) { - $form_params->{'status'} = $self->{api_client}->to_form_value($args{'status'}); + $form_params->{'status'} = + $self->{api_client}->to_form_value( $args{'status'} ); } - + my $_body_data; + # authentication setting, if any my $auth_settings = [qw(petstore_auth )]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -530,89 +579,204 @@ sub update_pet_with_form { # upload_file # # uploads an image -# +# # @param int $pet_id ID of pet to update (required) # @param string $additional_metadata Additional data to pass to server (optional) # @param string $file file to upload (optional) { my $params = { - 'pet_id' => { - data_type => 'int', - description => 'ID of pet to update', - required => '1', - }, - 'additional_metadata' => { - data_type => 'string', - description => 'Additional data to pass to server', - required => '0', - }, - 'file' => { - data_type => 'string', - description => 'file to upload', - required => '0', - }, + 'pet_id' => { + data_type => 'int', + description => 'ID of pet to update', + required => '1', + }, + 'additional_metadata' => { + data_type => 'string', + description => 'Additional data to pass to server', + required => '0', + }, + 'file' => { + data_type => 'string', + description => 'file to upload', + required => '0', + }, }; - __PACKAGE__->method_documentation->{ 'upload_file' } = { - summary => 'uploads an image', - params => $params, + __PACKAGE__->method_documentation->{'upload_file'} = { + summary => 'uploads an image', + params => $params, returns => 'ApiResponse', - }; + }; } + # @return ApiResponse # sub upload_file { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'pet_id' is set - unless (exists $args{'pet_id'}) { - croak("Missing the required parameter 'pet_id' when calling upload_file"); + unless ( exists $args{'pet_id'} ) { + croak( + "Missing the required parameter 'pet_id' when calling upload_file"); } # parse inputs my $_resource_path = '/pet/{petId}/uploadImage'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json'); + my $_header_accept = + $self->{api_client}->select_header_accept('application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type('multipart/form-data'); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type('multipart/form-data'); # path params - if ( exists $args{'pet_id'}) { + if ( exists $args{'pet_id'} ) { my $_base_variable = "{" . "petId" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'pet_id'}); + my $_base_value = $self->{api_client}->to_path_value( $args{'pet_id'} ); $_resource_path =~ s/$_base_variable/$_base_value/g; } # form params if ( exists $args{'additional_metadata'} ) { - $form_params->{'additionalMetadata'} = $self->{api_client}->to_form_value($args{'additional_metadata'}); + $form_params->{'additionalMetadata'} = + $self->{api_client}->to_form_value( $args{'additional_metadata'} ); } - + # form params if ( exists $args{'file'} ) { $form_params->{'file'} = [] unless defined $form_params->{'file'}; - push @{$form_params->{'file'}}, $args{'file'}; - } - + push @{ $form_params->{'file'} }, $args{'file'}; + } + my $_body_data; + # authentication setting, if any my $auth_settings = [qw(petstore_auth )]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('ApiResponse', $response); + my $_response_object = + $self->{api_client}->deserialize( 'ApiResponse', $response ); + return $_response_object; +} + +# +# upload_file_with_required_file +# +# uploads an image (required) +# +# @param int $pet_id ID of pet to update (required) +# @param string $required_file file to upload (required) +# @param string $additional_metadata Additional data to pass to server (optional) +{ + my $params = { + 'pet_id' => { + data_type => 'int', + description => 'ID of pet to update', + required => '1', + }, + 'required_file' => { + data_type => 'string', + description => 'file to upload', + required => '1', + }, + 'additional_metadata' => { + data_type => 'string', + description => 'Additional data to pass to server', + required => '0', + }, + }; + __PACKAGE__->method_documentation->{'upload_file_with_required_file'} = { + summary => 'uploads an image (required)', + params => $params, + returns => 'ApiResponse', + }; +} + +# @return ApiResponse +# +sub upload_file_with_required_file { + my ( $self, %args ) = @_; + + # verify the required parameter 'pet_id' is set + unless ( exists $args{'pet_id'} ) { + croak( +"Missing the required parameter 'pet_id' when calling upload_file_with_required_file" + ); + } + + # verify the required parameter 'required_file' is set + unless ( exists $args{'required_file'} ) { + croak( +"Missing the required parameter 'required_file' when calling upload_file_with_required_file" + ); + } + + # parse inputs + my $_resource_path = '/fake/{petId}/uploadImageWithRequiredFile'; + + my $_method = 'POST'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = + $self->{api_client}->select_header_accept('application/json'); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type('multipart/form-data'); + + # path params + if ( exists $args{'pet_id'} ) { + my $_base_variable = "{" . "petId" . "}"; + my $_base_value = $self->{api_client}->to_path_value( $args{'pet_id'} ); + $_resource_path =~ s/$_base_variable/$_base_value/g; + } + + # form params + if ( exists $args{'additional_metadata'} ) { + $form_params->{'additionalMetadata'} = + $self->{api_client}->to_form_value( $args{'additional_metadata'} ); + } + + # form params + if ( exists $args{'required_file'} ) { + $form_params->{'requiredFile'} = [] + unless defined $form_params->{'requiredFile'}; + push @{ $form_params->{'requiredFile'} }, $args{'required_file'}; + } + + my $_body_data; + + # authentication setting, if any + my $auth_settings = [qw(petstore_auth )]; + + # make the API Call + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { + return; + } + my $_response_object = + $self->{api_client}->deserialize( 'ApiResponse', $response ); return $_response_object; } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role.pm index aeaffd41547..aa58fdae4b0 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -26,87 +27,108 @@ use Class::Inspector; use Log::Any qw($log); use WWW::OpenAPIClient::ApiFactory; -has base_url => ( is => 'ro', - required => 0, - isa => 'Str', - documentation => 'Root of the server that requests are sent to', - ); +has base_url => ( + is => 'ro', + required => 0, + isa => 'Str', + documentation => 'Root of the server that requests are sent to', +); -has api_factory => ( is => 'ro', - isa => 'WWW::OpenAPIClient::ApiFactory', - builder => '_build_af', - lazy => 1, - documentation => 'Builds an instance of the endpoint API class', - ); +has api_factory => ( + is => 'ro', + isa => 'WWW::OpenAPIClient::ApiFactory', + builder => '_build_af', + lazy => 1, + documentation => 'Builds an instance of the endpoint API class', +); -has tokens => ( is => 'ro', - isa => 'HashRef', - required => 0, - default => sub { {} }, - documentation => 'The auth tokens required by the application - basic, OAuth and/or API key(s)', - ); +has tokens => ( + is => 'ro', + isa => 'HashRef', + required => 0, + default => sub { {} }, + documentation => +'The auth tokens required by the application - basic, OAuth and/or API key(s)', +); -has _cfg => ( is => 'ro', - isa => 'WWW::OpenAPIClient::Configuration', - default => sub { WWW::OpenAPIClient::Configuration->new() }, - ); +has _cfg => ( + is => 'ro', + isa => 'WWW::OpenAPIClient::Configuration', + default => sub { WWW::OpenAPIClient::Configuration->new() }, +); -has version_info => ( is => 'ro', - isa => 'HashRef', - default => sub { { - app_name => 'OpenAPI Petstore', - app_version => '1.0.0', - generator_class => 'org.openapitools.codegen.languages.PerlClientCodegen', - } }, - documentation => 'Information about the application version and the codegen codebase version' - ); +has version_info => ( + is => 'ro', + isa => 'HashRef', + default => sub { + { + app_name => 'OpenAPI Petstore', + app_version => '1.0.0', + generator_class => + 'org.openapitools.codegen.languages.PerlClientCodegen', + } + }, + documentation => +'Information about the application version and the codegen codebase version' +); sub BUILD { - my $self = shift; + my $self = shift; - $self->_cfg->accept_tokens( $self->tokens ) if keys %{$self->tokens}; + $self->_cfg->accept_tokens( $self->tokens ) if keys %{ $self->tokens }; - # ignore these symbols imported into API namespaces - my %outsiders = map {$_ => 1} qw( croak ); + # ignore these symbols imported into API namespaces + my %outsiders = map { $_ => 1 } qw( croak ); - my %delegates; + my %delegates; - # collect the methods callable on each API - foreach my $api_name ($self->api_factory->apis_available) { - my $api_class = $self->api_factory->classname_for($api_name); - my $methods = Class::Inspector->methods($api_class, 'expanded'); # not Moose, so use CI instead - my @local_methods = grep {! /^_/} grep {! $outsiders{$_}} map {$_->[2]} grep {$_->[1] eq $api_class} @$methods; - push( @{$delegates{$_}}, {api_name => $api_name, api_class => $api_class} ) for @local_methods; - } + # collect the methods callable on each API + foreach my $api_name ( $self->api_factory->apis_available ) { + my $api_class = $self->api_factory->classname_for($api_name); + my $methods = Class::Inspector->methods( $api_class, 'expanded' ) + ; # not Moose, so use CI instead + my @local_methods = + grep { !/^_/ } + grep { !$outsiders{$_} } + map { $_->[2] } grep { $_->[1] eq $api_class } @$methods; + push( + @{ $delegates{$_} }, + { api_name => $api_name, api_class => $api_class } + ) for @local_methods; + } - # remove clashes - foreach my $method (keys %delegates) { - if ( @{$delegates{$method}} > 1 ) { - my ($apis) = delete $delegates{$method}; - } - } + # remove clashes + foreach my $method ( keys %delegates ) { + if ( @{ $delegates{$method} } > 1 ) { + my ($apis) = delete $delegates{$method}; + } + } # build the flattened API - foreach my $api_name ($self->api_factory->apis_available) { + foreach my $api_name ( $self->api_factory->apis_available ) { my $att_name = sprintf "%s_api", lc($api_name); my $api_class = $self->api_factory->classname_for($api_name); - my @delegated = grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates; - $log->debugf("Adding API: '%s' handles %s", $att_name, join ', ', @delegated); - $self->meta->add_attribute( $att_name => ( - is => 'ro', - isa => $api_class, - default => sub {$self->api_factory->get_api($api_name)}, - lazy => 1, - handles => \@delegated, - ) ); + my @delegated = + grep { $delegates{$_}->[0]->{api_name} eq $api_name } keys %delegates; + $log->debugf( "Adding API: '%s' handles %s", + $att_name, join ', ', @delegated ); + $self->meta->add_attribute( + $att_name => ( + is => 'ro', + isa => $api_class, + default => sub { $self->api_factory->get_api($api_name) }, + lazy => 1, + handles => \@delegated, + ) + ); } } sub _build_af { - my $self = shift; - my %args; - $args{base_url} = $self->base_url if $self->base_url; - return WWW::OpenAPIClient::ApiFactory->new(%args); + my $self = shift; + my %args; + $args{base_url} = $self->base_url if $self->base_url; + return WWW::OpenAPIClient::ApiFactory->new(%args); } =head1 NAME diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role/AutoDoc.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role/AutoDoc.pm index 03bcc0b9eee..a9c82e1644a 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role/AutoDoc.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/Role/AutoDoc.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -23,56 +24,57 @@ use List::MoreUtils qw(uniq); use Moose::Role; sub autodoc { - my ($self, $how) = @_; - - die "Unknown format '$how'" unless $how =~ /^(pod|wide|narrow)$/; - - $self->_printisa($how); - $self->_printmethods($how); - $self->_printattrs($how); - print "\n"; + my ( $self, $how ) = @_; + + die "Unknown format '$how'" unless $how =~ /^(pod|wide|narrow)$/; + + $self->_printisa($how); + $self->_printmethods($how); + $self->_printattrs($how); + print "\n"; } sub _printisa { - my ($self, $how) = @_; - my $meta = $self->meta; - - my $myclass = ref $self; - - my $super = join ', ', $meta->superclasses; - my @roles = $meta->calculate_all_roles; - #shift(@roles) if @roles > 1; # if > 1, the first is a composite, the rest are the roles + my ( $self, $how ) = @_; + my $meta = $self->meta; - my $isa = join ', ', grep {$_ ne $myclass} $meta->linearized_isa; - my $sub = join ', ', $meta->subclasses; - my $dsub = join ', ', $meta->direct_subclasses; - - my $app_name = $self->version_info->{app_name}; - my $app_version = $self->version_info->{app_version}; - my $generated_date = $self->version_info->{generated_date}; + my $myclass = ref $self; + + my $super = join ', ', $meta->superclasses; + my @roles = $meta->calculate_all_roles; + +#shift(@roles) if @roles > 1; # if > 1, the first is a composite, the rest are the roles + + my $isa = join ', ', grep { $_ ne $myclass } $meta->linearized_isa; + my $sub = join ', ', $meta->subclasses; + my $dsub = join ', ', $meta->direct_subclasses; + + my $app_name = $self->version_info->{app_name}; + my $app_version = $self->version_info->{app_version}; + my $generated_date = $self->version_info->{generated_date}; my $generator_class = $self->version_info->{generator_class}; $~ = $how eq 'pod' ? 'INHERIT_POD' : 'INHERIT'; write; - - my ($rolepkg, $role_reqs); - - foreach my $role (@roles) { - $rolepkg = $role->{package} || next; # some are anonymous, or something - next if $rolepkg eq 'WWW::OpenAPIClient::Role::AutoDoc'; - $role_reqs = join ', ', keys %{$role->{required_methods}}; - $role_reqs ||= ''; - $~ = $how eq 'pod' ? 'ROLES_POD' : 'ROLES'; - write; - } - - if ($how eq 'pod') { - $~ = 'ROLES_POD_CLOSE'; - write; - } - -# ----- format specs ----- - format INHERIT = + + my ( $rolepkg, $role_reqs ); + + foreach my $role (@roles) { + $rolepkg = $role->{package} || next; # some are anonymous, or something + next if $rolepkg eq 'WWW::OpenAPIClient::Role::AutoDoc'; + $role_reqs = join ', ', keys %{ $role->{required_methods} }; + $role_reqs ||= ''; + $~ = $how eq 'pod' ? 'ROLES_POD' : 'ROLES'; + write; + } + + if ( $how eq 'pod' ) { + $~ = 'ROLES_POD_CLOSE'; + write; + } + + # ----- format specs ----- + format INHERIT = @* - $myclass @@ -91,7 +93,7 @@ $myclass $generator_class . - format ROLES = + format ROLES = Composes: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~ $rolepkg requires: ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~ @@ -100,7 +102,7 @@ $myclass $role_reqs . - format INHERIT_POD = + format INHERIT_POD = =head1 NAME @* @@ -151,7 +153,7 @@ $myclass . - format ROLES_POD = + format ROLES_POD = =head2 C<@*> $rolepkg @@ -161,104 +163,108 @@ Requires: $role_reqs . - format ROLES_POD_CLOSE = + format ROLES_POD_CLOSE = . -# ----- / format specs ----- + + # ----- / format specs ----- } sub _printmethods { - my ($self, $how) = @_; - - if ($how eq 'narrow') { - print <_printmethod($_, $how) for uniq sort $self->meta->get_all_method_names; #$self->meta->get_method_list, - - if ($how eq 'pod') { - $~ = 'METHOD_POD_CLOSE'; - write; - } + } + elsif ( $how eq 'wide' ) { + $~ = 'METHODHEAD'; + write; + } + elsif ( $how eq 'pod' ) { + $~ = 'METHODHEAD_POD'; + write; + } + else { + die "Don't know how to print '$how'"; + } + $self->_printmethod( $_, $how ) + for uniq + sort $self->meta->get_all_method_names; #$self->meta->get_method_list, + + if ( $how eq 'pod' ) { + $~ = 'METHOD_POD_CLOSE'; + write; + } } sub _printmethod { - my ($self, $methodname, $how) = @_; - return if $methodname =~ /^_/; - return if $self->meta->has_attribute($methodname); - my %internal = map {$_ => 1} qw(BUILD BUILDARGS meta can new DEMOLISHALL DESTROY - DOES isa BUILDALL does VERSION dump - ); - return if $internal{$methodname}; - my $method = $self->meta->get_method($methodname) or return; # symbols imported into namespaces i.e. not known by Moose - - return if $method->original_package_name eq __PACKAGE__; - - my $delegate_to = ''; - my $via = ''; - my $on = ''; - my $doc = ''; - my $original_pkg = $method->original_package_name; - if ($method->can('associated_attribute')) { - $delegate_to = $method->delegate_to_method; - my $aa = $method->associated_attribute; - $on = $aa->{isa}; - $via = $aa->{name}; - $original_pkg = $on; - $doc = $original_pkg->method_documentation->{$delegate_to}->{summary}; - } - else { - $doc = $method->documentation; - } - - if ($how eq 'narrow') { - $~ = 'METHOD_NARROW'; - write; - } - elsif ($how eq 'pod' and $delegate_to) { - $~ = 'METHOD_POD_DELEGATED'; - write; - } - elsif ($how eq 'pod') { - $~ = 'METHOD_POD'; - write; - } - else { - $~ = 'METHOD'; - write; - } - -# ----- format specs ----- - format METHODHEAD = + my ( $self, $methodname, $how ) = @_; + return if $methodname =~ /^_/; + return if $self->meta->has_attribute($methodname); + my %internal = map { $_ => 1 } + qw(BUILD BUILDARGS meta can new DEMOLISHALL DESTROY + DOES isa BUILDALL does VERSION dump + ); + return if $internal{$methodname}; + my $method = $self->meta->get_method($methodname) + or return; # symbols imported into namespaces i.e. not known by Moose + + return if $method->original_package_name eq __PACKAGE__; + + my $delegate_to = ''; + my $via = ''; + my $on = ''; + my $doc = ''; + my $original_pkg = $method->original_package_name; + if ( $method->can('associated_attribute') ) { + $delegate_to = $method->delegate_to_method; + my $aa = $method->associated_attribute; + $on = $aa->{isa}; + $via = $aa->{name}; + $original_pkg = $on; + $doc = $original_pkg->method_documentation->{$delegate_to}->{summary}; + } + else { + $doc = $method->documentation; + } + + if ( $how eq 'narrow' ) { + $~ = 'METHOD_NARROW'; + write; + } + elsif ( $how eq 'pod' and $delegate_to ) { + $~ = 'METHOD_POD_DELEGATED'; + write; + } + elsif ( $how eq 'pod' ) { + $~ = 'METHOD_POD'; + write; + } + else { + $~ = 'METHOD'; + write; + } + + # ----- format specs ----- + format METHODHEAD = METHODS ------- Name delegates to on via =========================================================================================================================================================================== . - format METHOD = + format METHOD = @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<... @<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<... @<<<<<<<<<<<<<<<<... $methodname, $delegate_to, $on, $via . - format METHOD_NARROW = + format METHOD_NARROW = @* $methodname original pkg: @* @@ -272,13 +278,13 @@ $methodname . - format METHODHEAD_POD = + format METHODHEAD_POD = =head1 METHODS . - - format METHOD_POD = + + format METHOD_POD = =head2 C<@*()> $methodname @@ -288,7 +294,7 @@ $methodname . - format METHOD_POD_DELEGATED = + format METHOD_POD_DELEGATED = =head2 C<@*()> $methodname @@ -307,90 +313,96 @@ $methodname $via, $delegate_to . - format METHOD_POD_CLOSE = + format METHOD_POD_CLOSE = . -# ----- / format specs ----- + + # ----- / format specs ----- } sub _printattrs { - my ($self, $how) = @_; - - if ($how eq 'narrow') { - print <_printattr($_, $how) for sort $self->meta->get_attribute_list; - - if ($how eq 'pod') { - $~ = 'ATTR_POD_CLOSE'; - write; - } + } + elsif ( $how eq 'wide' ) { + $~ = 'ATTRHEAD'; + write; + } + elsif ( $how eq 'pod' ) { + $~ = 'ATTRHEAD_POD'; + write; + } + else { + die "Don't know how to print attributes '$how'"; + } + + $self->_printattr( $_, $how ) for sort $self->meta->get_attribute_list; + + if ( $how eq 'pod' ) { + $~ = 'ATTR_POD_CLOSE'; + write; + } } sub _printattr { - my ($self, $attrname, $how) = @_; - return if $attrname =~ /^_/; - my $attr = $self->meta->get_attribute($attrname) or die "No attr for $attrname"; - - my $is; - $is = 'rw' if $attr->get_read_method && $attr->get_write_method; - $is = 'ro' if $attr->get_read_method && ! $attr->get_write_method; - $is = 'wo' if $attr->get_write_method && ! $attr->get_read_method; - $is = '--' if ! $attr->get_write_method && ! $attr->get_read_method; - $is or die "No \$is for $attrname"; - - my $tc = $attr->type_constraint || ''; - my $from = $attr->associated_class->name || ''; - my $reqd = $attr->is_required ? 'yes' : 'no'; - my $lazy = $attr->is_lazy ? 'yes' : 'no'; - my $has_doc = $attr->has_documentation ? 'yes' : 'no'; # *_api attributes will never have doc, but other attributes might have - my $doc = $attr->documentation || ''; - my $handles = join ', ', sort @{$attr->handles || []}; - $handles ||= ''; - - if ($how eq 'narrow') { - $~ = 'ATTR_NARROW'; - } - elsif ($how eq 'pod') { - $~ = 'ATTR_POD'; - } - else { - $~ = 'ATTR'; - } + my ( $self, $attrname, $how ) = @_; + return if $attrname =~ /^_/; + my $attr = $self->meta->get_attribute($attrname) + or die "No attr for $attrname"; - write; + my $is; + $is = 'rw' if $attr->get_read_method && $attr->get_write_method; + $is = 'ro' if $attr->get_read_method && !$attr->get_write_method; + $is = 'wo' if $attr->get_write_method && !$attr->get_read_method; + $is = '--' if !$attr->get_write_method && !$attr->get_read_method; + $is or die "No \$is for $attrname"; -# ----- format specs ----- - format ATTRHEAD = + my $tc = $attr->type_constraint || ''; + my $from = $attr->associated_class->name || ''; + my $reqd = $attr->is_required ? 'yes' : 'no'; + my $lazy = $attr->is_lazy ? 'yes' : 'no'; + my $has_doc = + $attr->has_documentation + ? 'yes' + : 'no' + ; # *_api attributes will never have doc, but other attributes might have + my $doc = $attr->documentation || ''; + my $handles = join ', ', sort @{ $attr->handles || [] }; + $handles ||= ''; + + if ( $how eq 'narrow' ) { + $~ = 'ATTR_NARROW'; + } + elsif ( $how eq 'pod' ) { + $~ = 'ATTR_POD'; + } + else { + $~ = 'ATTR'; + } + + write; + + # ----- format specs ----- + format ATTRHEAD = ATTRIBUTES ---------- Name is isa reqd lazy doc handles ============================================================================================================== . - format ATTR = + format ATTR = @<<<<<<<<<<<<<<<<< @< @<<<<<<<<<<<<<<<<<<<<<<<< @<<< @<<< @<< ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< $attrname, $is, $tc, $reqd, $lazy, $has_doc, $handles ^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ~~ $handles . - format ATTR_NARROW = + format ATTR_NARROW = @* $attrname is: @* @@ -409,11 +421,11 @@ $attrname $handles . - format ATTRHEAD_POD = + format ATTRHEAD_POD = =head1 ATTRIBUTES . - format ATTR_POD = + format ATTR_POD = =head2 C<@*> $attrname @@ -434,13 +446,12 @@ $attrname $handles . - format ATTR_POD_CLOSE = + format ATTR_POD_CLOSE = . -# ----- / format specs ----- + + # ----- / format specs ----- } - - 1; diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/StoreApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/StoreApi.pm index 3ffb3283251..e38450e14df 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/StoreApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/StoreApi.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -22,7 +23,7 @@ package WWW::OpenAPIClient::StoreApi; require 5.6.0; use strict; use warnings; -use utf8; +use utf8; use Exporter; use Carp qw( croak ); use Log::Any qw($log); @@ -31,15 +32,16 @@ use WWW::OpenAPIClient::ApiClient; use base "Class::Data::Inheritable"; -__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); sub new { my $class = shift; my $api_client; - if ($_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { + if ( $_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { $api_client = $_[0]; - } else { + } + else { $api_client = WWW::OpenAPIClient::ApiClient->new(@_); } @@ -47,67 +49,73 @@ sub new { } - # # delete_order # # Delete purchase order by ID -# +# # @param string $order_id ID of the order that needs to be deleted (required) { my $params = { - 'order_id' => { - data_type => 'string', - description => 'ID of the order that needs to be deleted', - required => '1', - }, + 'order_id' => { + data_type => 'string', + description => 'ID of the order that needs to be deleted', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'delete_order' } = { - summary => 'Delete purchase order by ID', - params => $params, + __PACKAGE__->method_documentation->{'delete_order'} = { + summary => 'Delete purchase order by ID', + params => $params, returns => undef, - }; + }; } + # @return void # sub delete_order { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'order_id' is set - unless (exists $args{'order_id'}) { - croak("Missing the required parameter 'order_id' when calling delete_order"); + unless ( exists $args{'order_id'} ) { + croak( +"Missing the required parameter 'order_id' when calling delete_order" + ); } # parse inputs my $_resource_path = '/store/order/{order_id}'; - my $_method = 'DELETE'; - my $query_params = {}; + my $_method = 'DELETE'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); # path params - if ( exists $args{'order_id'}) { + if ( exists $args{'order_id'} ) { my $_base_variable = "{" . "order_id" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'order_id'}); + my $_base_value = + $self->{api_client}->to_path_value( $args{'order_id'} ); $_resource_path =~ s/$_base_variable/$_base_value/g; } my $_body_data; + # authentication setting, if any my $auth_settings = [qw()]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -115,48 +123,53 @@ sub delete_order { # get_inventory # # Returns pet inventories by status -# +# { - my $params = { - }; - __PACKAGE__->method_documentation->{ 'get_inventory' } = { - summary => 'Returns pet inventories by status', - params => $params, + my $params = {}; + __PACKAGE__->method_documentation->{'get_inventory'} = { + summary => 'Returns pet inventories by status', + params => $params, returns => 'HASH[string,int]', - }; + }; } + # @return HASH[string,int] # sub get_inventory { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # parse inputs my $_resource_path = '/store/inventory'; - my $_method = 'GET'; - my $query_params = {}; + my $_method = 'GET'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/json'); + my $_header_accept = + $self->{api_client}->select_header_accept('application/json'); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); my $_body_data; + # authentication setting, if any my $auth_settings = [qw(api_key )]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('HASH[string,int]', $response); + my $_response_object = + $self->{api_client}->deserialize( 'HASH[string,int]', $response ); return $_response_object; } @@ -164,66 +177,75 @@ sub get_inventory { # get_order_by_id # # Find purchase order by ID -# +# # @param int $order_id ID of pet that needs to be fetched (required) { my $params = { - 'order_id' => { - data_type => 'int', - description => 'ID of pet that needs to be fetched', - required => '1', - }, + 'order_id' => { + data_type => 'int', + description => 'ID of pet that needs to be fetched', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'get_order_by_id' } = { - summary => 'Find purchase order by ID', - params => $params, + __PACKAGE__->method_documentation->{'get_order_by_id'} = { + summary => 'Find purchase order by ID', + params => $params, returns => 'Order', - }; + }; } + # @return Order # sub get_order_by_id { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'order_id' is set - unless (exists $args{'order_id'}) { - croak("Missing the required parameter 'order_id' when calling get_order_by_id"); + unless ( exists $args{'order_id'} ) { + croak( +"Missing the required parameter 'order_id' when calling get_order_by_id" + ); } # parse inputs my $_resource_path = '/store/order/{order_id}'; - my $_method = 'GET'; - my $query_params = {}; + my $_method = 'GET'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); + my $_header_accept = $self->{api_client} + ->select_header_accept( 'application/xml', 'application/json' ); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); # path params - if ( exists $args{'order_id'}) { + if ( exists $args{'order_id'} ) { my $_base_variable = "{" . "order_id" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'order_id'}); + my $_base_value = + $self->{api_client}->to_path_value( $args{'order_id'} ); $_resource_path =~ s/$_base_variable/$_base_value/g; } my $_body_data; + # authentication setting, if any my $auth_settings = [qw()]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('Order', $response); + my $_response_object = + $self->{api_client}->deserialize( 'Order', $response ); return $_response_object; } @@ -231,50 +253,55 @@ sub get_order_by_id { # place_order # # Place an order for a pet -# +# # @param Order $order order placed for purchasing the pet (required) { my $params = { - 'order' => { - data_type => 'Order', - description => 'order placed for purchasing the pet', - required => '1', - }, + 'order' => { + data_type => 'Order', + description => 'order placed for purchasing the pet', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'place_order' } = { - summary => 'Place an order for a pet', - params => $params, + __PACKAGE__->method_documentation->{'place_order'} = { + summary => 'Place an order for a pet', + params => $params, returns => 'Order', - }; + }; } + # @return Order # sub place_order { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'order' is set - unless (exists $args{'order'}) { - croak("Missing the required parameter 'order' when calling place_order"); + unless ( exists $args{'order'} ) { + croak( + "Missing the required parameter 'order' when calling place_order"); } # parse inputs my $_resource_path = '/store/order'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); + my $_header_accept = $self->{api_client} + ->select_header_accept( 'application/xml', 'application/json' ); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); my $_body_data; + # body params - if ( exists $args{'order'}) { + if ( exists $args{'order'} ) { $_body_data = $args{'order'}; } @@ -282,13 +309,15 @@ sub place_order { my $auth_settings = [qw()]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('Order', $response); + my $_response_object = + $self->{api_client}->deserialize( 'Order', $response ); return $_response_object; } diff --git a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/UserApi.pm b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/UserApi.pm index c9aa7fe6d8b..cbcc5df92e3 100644 --- a/samples/client/petstore/perl/lib/WWW/OpenAPIClient/UserApi.pm +++ b/samples/client/petstore/perl/lib/WWW/OpenAPIClient/UserApi.pm @@ -1,3 +1,4 @@ + =begin comment OpenAPI Petstore @@ -22,7 +23,7 @@ package WWW::OpenAPIClient::UserApi; require 5.6.0; use strict; use warnings; -use utf8; +use utf8; use Exporter; use Carp qw( croak ); use Log::Any qw($log); @@ -31,15 +32,16 @@ use WWW::OpenAPIClient::ApiClient; use base "Class::Data::Inheritable"; -__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata( 'method_documentation' => {} ); sub new { my $class = shift; my $api_client; - if ($_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { + if ( $_[0] && ref $_[0] && ref $_[0] eq 'WWW::OpenAPIClient::ApiClient' ) { $api_client = $_[0]; - } else { + } + else { $api_client = WWW::OpenAPIClient::ApiClient->new(@_); } @@ -47,55 +49,57 @@ sub new { } - # # create_user # # Create user -# +# # @param User $user Created user object (required) { my $params = { - 'user' => { - data_type => 'User', - description => 'Created user object', - required => '1', - }, + 'user' => { + data_type => 'User', + description => 'Created user object', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'create_user' } = { - summary => 'Create user', - params => $params, + __PACKAGE__->method_documentation->{'create_user'} = { + summary => 'Create user', + params => $params, returns => undef, - }; + }; } + # @return void # sub create_user { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'user' is set - unless (exists $args{'user'}) { - croak("Missing the required parameter 'user' when calling create_user"); + unless ( exists $args{'user'} ) { + croak("Missing the required parameter 'user' when calling create_user"); } # parse inputs my $_resource_path = '/user'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); my $_body_data; + # body params - if ( exists $args{'user'}) { + if ( exists $args{'user'} ) { $_body_data = $args{'user'}; } @@ -103,9 +107,10 @@ sub create_user { my $auth_settings = [qw()]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -113,50 +118,55 @@ sub create_user { # create_users_with_array_input # # Creates list of users with given input array -# +# # @param ARRAY[User] $user List of user object (required) { my $params = { - 'user' => { - data_type => 'ARRAY[User]', - description => 'List of user object', - required => '1', - }, + 'user' => { + data_type => 'ARRAY[User]', + description => 'List of user object', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'create_users_with_array_input' } = { - summary => 'Creates list of users with given input array', - params => $params, + __PACKAGE__->method_documentation->{'create_users_with_array_input'} = { + summary => 'Creates list of users with given input array', + params => $params, returns => undef, - }; + }; } + # @return void # sub create_users_with_array_input { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'user' is set - unless (exists $args{'user'}) { - croak("Missing the required parameter 'user' when calling create_users_with_array_input"); + unless ( exists $args{'user'} ) { + croak( +"Missing the required parameter 'user' when calling create_users_with_array_input" + ); } # parse inputs my $_resource_path = '/user/createWithArray'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); my $_body_data; + # body params - if ( exists $args{'user'}) { + if ( exists $args{'user'} ) { $_body_data = $args{'user'}; } @@ -164,9 +174,10 @@ sub create_users_with_array_input { my $auth_settings = [qw()]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -174,50 +185,55 @@ sub create_users_with_array_input { # create_users_with_list_input # # Creates list of users with given input array -# +# # @param ARRAY[User] $user List of user object (required) { my $params = { - 'user' => { - data_type => 'ARRAY[User]', - description => 'List of user object', - required => '1', - }, + 'user' => { + data_type => 'ARRAY[User]', + description => 'List of user object', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'create_users_with_list_input' } = { - summary => 'Creates list of users with given input array', - params => $params, + __PACKAGE__->method_documentation->{'create_users_with_list_input'} = { + summary => 'Creates list of users with given input array', + params => $params, returns => undef, - }; + }; } + # @return void # sub create_users_with_list_input { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'user' is set - unless (exists $args{'user'}) { - croak("Missing the required parameter 'user' when calling create_users_with_list_input"); + unless ( exists $args{'user'} ) { + croak( +"Missing the required parameter 'user' when calling create_users_with_list_input" + ); } # parse inputs my $_resource_path = '/user/createWithList'; - my $_method = 'POST'; - my $query_params = {}; + my $_method = 'POST'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); my $_body_data; + # body params - if ( exists $args{'user'}) { + if ( exists $args{'user'} ) { $_body_data = $args{'user'}; } @@ -225,9 +241,10 @@ sub create_users_with_list_input { my $auth_settings = [qw()]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -235,62 +252,69 @@ sub create_users_with_list_input { # delete_user # # Delete user -# +# # @param string $username The name that needs to be deleted (required) { my $params = { - 'username' => { - data_type => 'string', - description => 'The name that needs to be deleted', - required => '1', - }, + 'username' => { + data_type => 'string', + description => 'The name that needs to be deleted', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'delete_user' } = { - summary => 'Delete user', - params => $params, + __PACKAGE__->method_documentation->{'delete_user'} = { + summary => 'Delete user', + params => $params, returns => undef, - }; + }; } + # @return void # sub delete_user { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'username' is set - unless (exists $args{'username'}) { - croak("Missing the required parameter 'username' when calling delete_user"); + unless ( exists $args{'username'} ) { + croak( + "Missing the required parameter 'username' when calling delete_user" + ); } # parse inputs my $_resource_path = '/user/{username}'; - my $_method = 'DELETE'; - my $query_params = {}; + my $_method = 'DELETE'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); # path params - if ( exists $args{'username'}) { + if ( exists $args{'username'} ) { my $_base_variable = "{" . "username" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'username'}); + my $_base_value = + $self->{api_client}->to_path_value( $args{'username'} ); $_resource_path =~ s/$_base_variable/$_base_value/g; } my $_body_data; + # authentication setting, if any my $auth_settings = [qw()]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -298,66 +322,76 @@ sub delete_user { # get_user_by_name # # Get user by user name -# +# # @param string $username The name that needs to be fetched. Use user1 for testing. (required) { my $params = { - 'username' => { - data_type => 'string', - description => 'The name that needs to be fetched. Use user1 for testing.', - required => '1', - }, + 'username' => { + data_type => 'string', + description => + 'The name that needs to be fetched. Use user1 for testing.', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'get_user_by_name' } = { - summary => 'Get user by user name', - params => $params, + __PACKAGE__->method_documentation->{'get_user_by_name'} = { + summary => 'Get user by user name', + params => $params, returns => 'User', - }; + }; } + # @return User # sub get_user_by_name { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'username' is set - unless (exists $args{'username'}) { - croak("Missing the required parameter 'username' when calling get_user_by_name"); + unless ( exists $args{'username'} ) { + croak( +"Missing the required parameter 'username' when calling get_user_by_name" + ); } # parse inputs my $_resource_path = '/user/{username}'; - my $_method = 'GET'; - my $query_params = {}; + my $_method = 'GET'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); + my $_header_accept = $self->{api_client} + ->select_header_accept( 'application/xml', 'application/json' ); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); # path params - if ( exists $args{'username'}) { + if ( exists $args{'username'} ) { my $_base_variable = "{" . "username" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'username'}); + my $_base_value = + $self->{api_client}->to_path_value( $args{'username'} ); $_resource_path =~ s/$_base_variable/$_base_value/g; } my $_body_data; + # authentication setting, if any my $auth_settings = [qw()]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('User', $response); + my $_response_object = + $self->{api_client}->deserialize( 'User', $response ); return $_response_object; } @@ -365,80 +399,92 @@ sub get_user_by_name { # login_user # # Logs user into the system -# +# # @param string $username The user name for login (required) # @param string $password The password for login in clear text (required) { my $params = { - 'username' => { - data_type => 'string', - description => 'The user name for login', - required => '1', - }, - 'password' => { - data_type => 'string', - description => 'The password for login in clear text', - required => '1', - }, + 'username' => { + data_type => 'string', + description => 'The user name for login', + required => '1', + }, + 'password' => { + data_type => 'string', + description => 'The password for login in clear text', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'login_user' } = { - summary => 'Logs user into the system', - params => $params, + __PACKAGE__->method_documentation->{'login_user'} = { + summary => 'Logs user into the system', + params => $params, returns => 'string', - }; + }; } + # @return string # sub login_user { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'username' is set - unless (exists $args{'username'}) { - croak("Missing the required parameter 'username' when calling login_user"); + unless ( exists $args{'username'} ) { + croak( + "Missing the required parameter 'username' when calling login_user" + ); } # verify the required parameter 'password' is set - unless (exists $args{'password'}) { - croak("Missing the required parameter 'password' when calling login_user"); + unless ( exists $args{'password'} ) { + croak( + "Missing the required parameter 'password' when calling login_user" + ); } # parse inputs my $_resource_path = '/user/login'; - my $_method = 'GET'; - my $query_params = {}; + my $_method = 'GET'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header - my $_header_accept = $self->{api_client}->select_header_accept('application/xml', 'application/json'); + my $_header_accept = $self->{api_client} + ->select_header_accept( 'application/xml', 'application/json' ); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); # query params - if ( exists $args{'username'}) { - $query_params->{'username'} = $self->{api_client}->to_query_value($args{'username'}); + if ( exists $args{'username'} ) { + $query_params->{'username'} = + $self->{api_client}->to_query_value( $args{'username'} ); } # query params - if ( exists $args{'password'}) { - $query_params->{'password'} = $self->{api_client}->to_query_value($args{'password'}); + if ( exists $args{'password'} ) { + $query_params->{'password'} = + $self->{api_client}->to_query_value( $args{'password'} ); } my $_body_data; + # authentication setting, if any my $auth_settings = [qw()]; # make the API Call - my $response = $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); - if (!$response) { + my $response = $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); + if ( !$response ) { return; } - my $_response_object = $self->{api_client}->deserialize('string', $response); + my $_response_object = + $self->{api_client}->deserialize( 'string', $response ); return $_response_object; } @@ -446,44 +492,47 @@ sub login_user { # logout_user # # Logs out current logged in user session -# +# { - my $params = { - }; - __PACKAGE__->method_documentation->{ 'logout_user' } = { - summary => 'Logs out current logged in user session', - params => $params, + my $params = {}; + __PACKAGE__->method_documentation->{'logout_user'} = { + summary => 'Logs out current logged in user session', + params => $params, returns => undef, - }; + }; } + # @return void # sub logout_user { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # parse inputs my $_resource_path = '/user/logout'; - my $_method = 'GET'; - my $query_params = {}; + my $_method = 'GET'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); my $_body_data; + # authentication setting, if any my $auth_settings = [qw()]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } @@ -491,68 +540,74 @@ sub logout_user { # update_user # # Updated user -# +# # @param string $username name that need to be deleted (required) # @param User $user Updated user object (required) { my $params = { - 'username' => { - data_type => 'string', - description => 'name that need to be deleted', - required => '1', - }, - 'user' => { - data_type => 'User', - description => 'Updated user object', - required => '1', - }, + 'username' => { + data_type => 'string', + description => 'name that need to be deleted', + required => '1', + }, + 'user' => { + data_type => 'User', + description => 'Updated user object', + required => '1', + }, }; - __PACKAGE__->method_documentation->{ 'update_user' } = { - summary => 'Updated user', - params => $params, + __PACKAGE__->method_documentation->{'update_user'} = { + summary => 'Updated user', + params => $params, returns => undef, - }; + }; } + # @return void # sub update_user { - my ($self, %args) = @_; + my ( $self, %args ) = @_; # verify the required parameter 'username' is set - unless (exists $args{'username'}) { - croak("Missing the required parameter 'username' when calling update_user"); + unless ( exists $args{'username'} ) { + croak( + "Missing the required parameter 'username' when calling update_user" + ); } # verify the required parameter 'user' is set - unless (exists $args{'user'}) { - croak("Missing the required parameter 'user' when calling update_user"); + unless ( exists $args{'user'} ) { + croak("Missing the required parameter 'user' when calling update_user"); } # parse inputs my $_resource_path = '/user/{username}'; - my $_method = 'PUT'; - my $query_params = {}; + my $_method = 'PUT'; + my $query_params = {}; my $header_params = {}; - my $form_params = {}; + my $form_params = {}; # 'Accept' and 'Content-Type' header my $_header_accept = $self->{api_client}->select_header_accept(); if ($_header_accept) { $header_params->{'Accept'} = $_header_accept; } - $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + $header_params->{'Content-Type'} = + $self->{api_client}->select_header_content_type(); # path params - if ( exists $args{'username'}) { + if ( exists $args{'username'} ) { my $_base_variable = "{" . "username" . "}"; - my $_base_value = $self->{api_client}->to_path_value($args{'username'}); + my $_base_value = + $self->{api_client}->to_path_value( $args{'username'} ); $_resource_path =~ s/$_base_variable/$_base_value/g; } my $_body_data; + # body params - if ( exists $args{'user'}) { + if ( exists $args{'user'} ) { $_body_data = $args{'user'}; } @@ -560,9 +615,10 @@ sub update_user { my $auth_settings = [qw()]; # make the API Call - $self->{api_client}->call_api($_resource_path, $_method, - $query_params, $form_params, - $header_params, $_body_data, $auth_settings); + $self->{api_client}->call_api( + $_resource_path, $_method, $query_params, $form_params, + $header_params, $_body_data, $auth_settings + ); return; } diff --git a/samples/client/petstore/perl/t/FileSchemaTestClassTest.t b/samples/client/petstore/perl/t/FileSchemaTestClassTest.t new file mode 100644 index 00000000000..b7a2a6d282e --- /dev/null +++ b/samples/client/petstore/perl/t/FileSchemaTestClassTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::FileSchemaTestClass'); + +my $instance = WWW::OpenAPIClient::Object::FileSchemaTestClass->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::FileSchemaTestClass'); + diff --git a/samples/client/petstore/perl/t/FileTest.t b/samples/client/petstore/perl/t/FileTest.t new file mode 100644 index 00000000000..99f8eca953f --- /dev/null +++ b/samples/client/petstore/perl/t/FileTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::File'); + +my $instance = WWW::OpenAPIClient::Object::File->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::File'); + diff --git a/samples/client/petstore/perl/t/StringBooleanMapTest.t b/samples/client/petstore/perl/t/StringBooleanMapTest.t new file mode 100644 index 00000000000..ffcac0b77a0 --- /dev/null +++ b/samples/client/petstore/perl/t/StringBooleanMapTest.t @@ -0,0 +1,33 @@ +=begin comment + +OpenAPI Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 + +Generated by: https://openapi-generator.tech + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the OpenAPI Generator +# Please update the test cases below to test the model. +# Ref: https://openapi-generator.tech +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::OpenAPIClient::Object::StringBooleanMap'); + +my $instance = WWW::OpenAPIClient::Object::StringBooleanMap->new(); + +isa_ok($instance, 'WWW::OpenAPIClient::Object::StringBooleanMap'); + diff --git a/samples/client/petstore/perl/test.pl b/samples/client/petstore/perl/test.pl index b1690b09973..3f00dc9fb67 100755 --- a/samples/client/petstore/perl/test.pl +++ b/samples/client/petstore/perl/test.pl @@ -17,8 +17,8 @@ use DateTime; my $api = WWW::OpenAPIClient::PetApi->new( http_user_agent => 'Perl-Swagger-Test', - api_key => { api_key => 'ZZZZZZZZZZZZZZ' }, - api_key_prefix => { api_key => 'Bearer' }, + api_key => { api_key => 'ZZZZZZZZZZZZZZ' }, + api_key_prefix => { api_key => 'Bearer' }, username => 'username', password => 'password', @@ -34,27 +34,45 @@ my $api = WWW::OpenAPIClient::PetApi->new( my $pet_id = 10008; -my $category = WWW::OpenAPIClient::Object::Category->new('id' => '2', 'name' => 'perl'); -my $tag = WWW::OpenAPIClient::Object::Tag->new('id' => '1', 'name' => 'just kidding'); -my $pet = WWW::OpenAPIClient::Object::Pet->new('id' => $pet_id, 'name' => 'perl test', - "photoUrls" => ['123', 'oop'], 'tags' => [$tag], 'status' => 'pending', 'category' => $category); +my $category = + WWW::OpenAPIClient::Object::Category->new( 'id' => '2', 'name' => 'perl' ); +my $tag = + WWW::OpenAPIClient::Object::Tag->new( 'id' => '1', 'name' => 'just kidding' ); +my $pet = WWW::OpenAPIClient::Object::Pet->new( + 'id' => $pet_id, + 'name' => 'perl test', + "photoUrls" => [ '123', 'oop' ], + 'tags' => [$tag], + 'status' => 'pending', + 'category' => $category +); -print "\npet(object)=".Dumper $pet; +print "\npet(object)=" . Dumper $pet; my $json = JSON->new->convert_blessed; my $new_pet = WWW::OpenAPIClient::Object::Pet->new(); -$new_pet = $new_pet->from_hash($pet->to_hash); -print "new_pet(hash):".Dumper($new_pet->to_hash); +$new_pet = $new_pet->from_hash( $pet->to_hash ); +print "new_pet(hash):" . Dumper( $new_pet->to_hash ); print "\nTest Petstore endpoints\n"; -print "\nupload_file:".Dumper $api->upload_file(pet_id => $pet_id, additional_metadata => 'testabc', file => './test.pl'); -print "\nadd_pet:".Dumper $api->add_pet(body => $pet); -print "\nget_pet_by_id:".Dumper $api->get_pet_by_id(pet_id => $pet_id); -print "\nupdate_pet_with_form:".Dumper $api->update_pet_with_form(pet_id => $pet_id, name => 'test_name', status => 'test status'); -print "\ndelete_pet:".Dumper $api->delete_pet(pet_id => $pet_id); +print "\nupload_file:" + . Dumper $api->upload_file( + pet_id => $pet_id, + additional_metadata => 'testabc', + file => './test.pl' + ); +print "\nadd_pet:" . Dumper $api->add_pet( body => $pet ); +print "\nget_pet_by_id:" . Dumper $api->get_pet_by_id( pet_id => $pet_id ); +print "\nupdate_pet_with_form:" + . Dumper $api->update_pet_with_form( + pet_id => $pet_id, + name => 'test_name', + status => 'test status' + ); +print "\ndelete_pet:" . Dumper $api->delete_pet( pet_id => $pet_id ); my $store_api = WWW::OpenAPIClient::StoreApi->new(); -print "\nget_inventory:".Dumper $store_api->get_inventory(); +print "\nget_inventory:" . Dumper $store_api->get_inventory(); my $pet_json = <deserialize:".Dumper($api->{api_client}->deserialize("HASH[string,Pet]", $pet_json)); +print "\napi_client->deserialize:" + . Dumper( $api->{api_client}->deserialize( "HASH[string,Pet]", $pet_json ) ); diff --git a/samples/client/petstore/perl/tests/04_role.t b/samples/client/petstore/perl/tests/04_role.t index 2e074dfdc21..6cd994dd5b3 100644 --- a/samples/client/petstore/perl/tests/04_role.t +++ b/samples/client/petstore/perl/tests/04_role.t @@ -50,7 +50,7 @@ is $get_pet->tags->[0]->id, '11', 'stored and retrieved: got the proper tag id'; # API method docs is_deeply( [sort keys %{$api->pet_api->method_documentation}], - [ 'add_pet', 'delete_pet', 'find_pets_by_status', 'find_pets_by_tags', 'get_pet_by_id', 'update_pet', 'update_pet_with_form', 'upload_file'], + [ 'add_pet', 'delete_pet', 'find_pets_by_status', 'find_pets_by_tags', 'get_pet_by_id', 'update_pet', 'update_pet_with_form', 'upload_file', 'upload_file_with_required_file'], "Pet API method_documentation has the correct keys"); is $api->pet_api->method_documentation->{get_pet_by_id}->{params}->{pet_id}->{description}, 'ID of pet to return', 'get_pet_by_id parameter pet_id description is correct'; diff --git a/samples/client/petstore/php/OpenAPIClient-php/.php_cs b/samples/client/petstore/php/OpenAPIClient-php/.php_cs index 6b8e23c818a..4fbe53ec5ff 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/.php_cs +++ b/samples/client/petstore/php/OpenAPIClient-php/.php_cs @@ -1,18 +1,23 @@ level(Symfony\CS\FixerInterface::PSR2_LEVEL) +return PhpCsFixer\Config::create() ->setUsingCache(true) - ->fixers( - [ - 'ordered_use', - 'phpdoc_order', - 'short_array_syntax', - 'strict', - 'strict_param' - ] - ) - ->finder( - Symfony\CS\Finder\DefaultFinder::create() - ->in(__DIR__) + ->setRules([ + '@PSR2' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('test') + ->exclude('tests') + ->in(__DIR__) ); diff --git a/samples/client/petstore/php/OpenAPIClient-php/composer.json b/samples/client/petstore/php/OpenAPIClient-php/composer.json index 65d3c935fb8..45b3c697261 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/composer.json +++ b/samples/client/petstore/php/OpenAPIClient-php/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "php": ">=5.5", + "php": ">=5.6", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", @@ -27,7 +27,7 @@ "require-dev": { "phpunit/phpunit": "^4.8", "squizlabs/php_codesniffer": "~2.6", - "friendsofphp/php-cs-fixer": "~1.12" + "friendsofphp/php-cs-fixer": "~2.12" }, "autoload": { "psr-4": { "OpenAPI\\Client\\" : "lib/" } diff --git a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/MapTest.md b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/MapTest.md index a6b378ac1fe..e2a51f7ddcd 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/docs/Model/MapTest.md +++ b/samples/client/petstore/php/OpenAPIClient-php/docs/Model/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **map_map_of_string** | [**map[string,map[string,string]]**](map.md) | | [optional] **map_of_enum_string** | **map[string,string]** | | [optional] **direct_map** | **map[string,bool]** | | [optional] -**indirect_map** | [**\OpenAPI\Client\Model\StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirect_map** | **map[string,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/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index dd0f4d4a801..62319b80069 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php @@ -154,9 +154,6 @@ class AnotherFakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Client' !== 'string') { - $content = json_decode($content); - } } return [ @@ -172,9 +169,6 @@ class AnotherFakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -242,9 +236,6 @@ class AnotherFakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -316,10 +307,10 @@ class AnotherFakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { 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 3c8fa0f5e77..bc3c5a80f64 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeApi.php @@ -150,9 +150,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('bool' !== 'string') { - $content = json_decode($content); - } } return [ @@ -168,9 +165,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -238,9 +232,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -306,10 +297,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -416,9 +407,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\OuterComposite' !== 'string') { - $content = json_decode($content); - } } return [ @@ -434,9 +422,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -504,9 +489,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -572,10 +554,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -682,9 +664,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('float' !== 'string') { - $content = json_decode($content); - } } return [ @@ -700,9 +679,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -770,9 +746,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -838,10 +811,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -948,9 +921,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== 'string') { - $content = json_decode($content); - } } return [ @@ -966,9 +936,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1036,9 +1003,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1104,10 +1068,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1319,10 +1283,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1549,10 +1513,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1663,9 +1627,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Client' !== 'string') { - $content = json_decode($content); - } } return [ @@ -1681,9 +1642,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1751,9 +1709,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1825,10 +1780,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -2228,10 +2183,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -2515,10 +2470,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -2734,10 +2689,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -2969,10 +2924,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { 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 fca125f3193..44eb33aa4e6 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/FakeClassnameTags123Api.php @@ -154,9 +154,6 @@ class FakeClassnameTags123Api $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Client' !== 'string') { - $content = json_decode($content); - } } return [ @@ -172,9 +169,6 @@ class FakeClassnameTags123Api $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -242,9 +236,6 @@ class FakeClassnameTags123Api $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -316,10 +307,10 @@ class FakeClassnameTags123Api // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { 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 548da849850..98e126ae2ef 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/PetApi.php @@ -259,10 +259,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -496,10 +496,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -614,9 +614,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Pet[]' !== 'string') { - $content = json_decode($content); - } } return [ @@ -632,9 +629,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -702,9 +696,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -780,10 +771,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -898,9 +889,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Pet[]' !== 'string') { - $content = json_decode($content); - } } return [ @@ -916,9 +904,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -986,9 +971,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1064,10 +1046,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1182,9 +1164,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Pet' !== 'string') { - $content = json_decode($content); - } } return [ @@ -1200,9 +1179,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1270,9 +1246,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1349,10 +1322,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1573,10 +1546,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1819,10 +1792,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1941,9 +1914,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') { - $content = json_decode($content); - } } return [ @@ -1959,9 +1929,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -2033,9 +2000,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -2123,10 +2087,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -2245,9 +2209,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') { - $content = json_decode($content); - } } return [ @@ -2263,9 +2224,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -2337,9 +2295,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -2433,10 +2388,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { 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 16c3a30e835..9d0c0979162 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/StoreApi.php @@ -264,10 +264,10 @@ class StoreApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -376,9 +376,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('map[string,int]' !== 'string') { - $content = json_decode($content); - } } return [ @@ -394,9 +391,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -462,9 +456,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -526,10 +517,10 @@ class StoreApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -645,9 +636,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Order' !== 'string') { - $content = json_decode($content); - } } return [ @@ -663,9 +651,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -733,9 +718,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -819,10 +801,10 @@ class StoreApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -933,9 +915,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Order' !== 'string') { - $content = json_decode($content); - } } return [ @@ -951,9 +930,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1021,9 +997,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1095,10 +1068,10 @@ class StoreApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { 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 43eceece4fe..42f0095c9c5 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Api/UserApi.php @@ -259,10 +259,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -478,10 +478,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -697,10 +697,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -921,10 +921,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1035,9 +1035,6 @@ class UserApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\User' !== 'string') { - $content = json_decode($content); - } } return [ @@ -1053,9 +1050,6 @@ class UserApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1123,9 +1117,6 @@ class UserApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1202,10 +1193,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1318,9 +1309,6 @@ class UserApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== 'string') { - $content = json_decode($content); - } } return [ @@ -1336,9 +1324,6 @@ class UserApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1408,9 +1393,6 @@ class UserApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1494,10 +1476,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1699,10 +1681,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1937,10 +1919,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php index dd0c12aecdf..74db144c025 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php @@ -186,7 +186,7 @@ class Animal implements ModelInterface, ArrayAccess $this->container['color'] = isset($data['color']) ? $data['color'] : 'red'; // Initialize discriminator property with the model name. - $discriminator = array_search('className', self::$attributeMap); + $discriminator = array_search('className', self::$attributeMap, true); $this->container[$discriminator] = static::$openAPIModelName; } diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php index 5cdc40b6a1a..4f24eb7b46f 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php @@ -60,7 +60,7 @@ class MapTest implements ModelInterface, ArrayAccess 'map_map_of_string' => 'map[string,map[string,string]]', 'map_of_enum_string' => 'map[string,string]', 'direct_map' => 'map[string,bool]', - 'indirect_map' => '\OpenAPI\Client\Model\StringBooleanMap' + 'indirect_map' => 'map[string,bool]' ]; /** @@ -321,7 +321,7 @@ class MapTest implements ModelInterface, ArrayAccess /** * Gets indirect_map * - * @return \OpenAPI\Client\Model\StringBooleanMap|null + * @return map[string,bool]|null */ public function getIndirectMap() { @@ -331,7 +331,7 @@ class MapTest implements ModelInterface, ArrayAccess /** * Sets indirect_map * - * @param \OpenAPI\Client\Model\StringBooleanMap|null $indirect_map indirect_map + * @param map[string,bool]|null $indirect_map indirect_map * * @return $this */ diff --git a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index 05f6cb4e6f4..d8bff1321ac 100644 --- a/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -29,6 +29,8 @@ namespace OpenAPI\Client; +use OpenAPI\Client\Model\ModelInterface; + /** * ObjectSerializer Class Doc Comment * @@ -61,19 +63,25 @@ class ObjectSerializer return $data; } elseif (is_object($data)) { $values = []; - $formats = $data::openAPIFormats(); - foreach ($data::openAPITypes() as $property => $openAPIType) { - $getter = $data::getters()[$property]; - $value = $data->$getter(); - if ($value !== null - && !in_array($openAPIType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) - && method_exists($openAPIType, 'getAllowableEnumValues') - && !in_array($value, $openAPIType::getAllowableEnumValues())) { - $imploded = implode("', '", $openAPIType::getAllowableEnumValues()); - throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null + && !in_array($openAPIType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) + && method_exists($openAPIType, 'getAllowableEnumValues') + && !in_array($value, $openAPIType::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $openAPIType::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + if ($value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } } - if ($value !== null) { - $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); } } return (object)$values; @@ -230,6 +238,8 @@ class ObjectSerializer if (null === $data) { return null; } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); $inner = substr($class, 4, -1); $deserialized = []; if (strrpos($inner, ",") !== false) { @@ -241,6 +251,7 @@ class ObjectSerializer } return $deserialized; } elseif (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; $subClass = substr($class, 0, -2); $values = []; foreach ($data as $key => $value) { @@ -284,12 +295,13 @@ class ObjectSerializer return new \SplFileObject($filename, 'r'); } elseif (method_exists($class, 'getAllowableEnumValues')) { - if (!in_array($data, $class::getAllowableEnumValues())) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { $imploded = implode("', '", $class::getAllowableEnumValues()); throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); } return $data; } else { + $data = is_string($data) ? json_decode($data) : $data; // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { diff --git a/samples/client/petstore/python-asyncio/.openapi-generator/VERSION b/samples/client/petstore/python-asyncio/.openapi-generator/VERSION index dde25ef08e8..f4cb97d56ce 100644 --- a/samples/client/petstore/python-asyncio/.openapi-generator/VERSION +++ b/samples/client/petstore/python-asyncio/.openapi-generator/VERSION @@ -1 +1 @@ -3.1.1-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-asyncio/README.md b/samples/client/petstore/python-asyncio/README.md index b76d6153e89..6e6dbf6180a 100644 --- a/samples/client/petstore/python-asyncio/README.md +++ b/samples/client/petstore/python-asyncio/README.md @@ -57,10 +57,10 @@ client = petstore_api.Client() # Client | client model try: # To test special tags - api_response = api_instance.test_special_tags(client) + api_response = api_instance.call_123_test_special_tags(client) pprint(api_response) except ApiException as e: - print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e) + print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) ``` @@ -70,7 +70,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**test_special_tags**](docs/AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | diff --git a/samples/client/petstore/python-asyncio/docs/AnotherFakeApi.md b/samples/client/petstore/python-asyncio/docs/AnotherFakeApi.md index 32d4fa0696c..447ce3edde3 100644 --- a/samples/client/petstore/python-asyncio/docs/AnotherFakeApi.md +++ b/samples/client/petstore/python-asyncio/docs/AnotherFakeApi.md @@ -4,15 +4,15 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**test_special_tags**](AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +[**call_123_test_special_tags**](AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags -# **test_special_tags** -> Client test_special_tags(client) +# **call_123_test_special_tags** +> Client call_123_test_special_tags(client) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Example ```python @@ -28,10 +28,10 @@ client = petstore_api.Client() # Client | client model try: # To test special tags - api_response = api_instance.test_special_tags(client) + api_response = api_instance.call_123_test_special_tags(client) pprint(api_response) except ApiException as e: - print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e) + print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) ``` ### Parameters diff --git a/samples/client/petstore/python-asyncio/docs/FakeApi.md b/samples/client/petstore/python-asyncio/docs/FakeApi.md index 3510abda8b7..57cf9937d36 100644 --- a/samples/client/petstore/python-asyncio/docs/FakeApi.md +++ b/samples/client/petstore/python-asyncio/docs/FakeApi.md @@ -353,6 +353,8 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ### Example + +* Basic Authentication (http_basic_test): ```python from __future__ import print_function import time diff --git a/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md index 34d44991ff9..3180674a077 100644 --- a/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python-asyncio/docs/FakeClassnameTags123Api.md @@ -15,6 +15,8 @@ To test class name in snake case To test class name in snake case ### Example + +* Api Key Authentication (api_key_query): ```python from __future__ import print_function import time diff --git a/samples/client/petstore/python-asyncio/docs/MapTest.md b/samples/client/petstore/python-asyncio/docs/MapTest.md index ee6036eb2f4..a5601691f88 100644 --- a/samples/client/petstore/python-asyncio/docs/MapTest.md +++ b/samples/client/petstore/python-asyncio/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **map_map_of_string** | **dict(str, dict(str, str))** | | [optional] **map_of_enum_string** | **dict(str, str)** | | [optional] **direct_map** | **dict(str, bool)** | | [optional] -**indirect_map** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirect_map** | **dict(str, 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/python-asyncio/docs/PetApi.md b/samples/client/petstore/python-asyncio/docs/PetApi.md index 9b8fd577a52..726db4708d7 100644 --- a/samples/client/petstore/python-asyncio/docs/PetApi.md +++ b/samples/client/petstore/python-asyncio/docs/PetApi.md @@ -21,6 +21,8 @@ Method | HTTP request | Description Add a new pet to the store ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -70,6 +72,8 @@ void (empty response body) Deletes a pet ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -123,6 +127,8 @@ Finds Pets by status Multiple status values can be provided with comma separated strings ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -175,6 +181,8 @@ Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -227,6 +235,8 @@ Find pet by ID Returns a single pet ### Example + +* Api Key Authentication (api_key): ```python from __future__ import print_function import time @@ -279,6 +289,8 @@ Name | Type | Description | Notes Update an existing pet ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -328,6 +340,8 @@ void (empty response body) Updates a pet in the store with form data ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -381,6 +395,8 @@ void (empty response body) uploads an image ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -435,6 +451,8 @@ Name | Type | Description | Notes uploads an image (required) ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time diff --git a/samples/client/petstore/python-asyncio/docs/StoreApi.md b/samples/client/petstore/python-asyncio/docs/StoreApi.md index e4d6a7a8885..ab342460f86 100644 --- a/samples/client/petstore/python-asyncio/docs/StoreApi.md +++ b/samples/client/petstore/python-asyncio/docs/StoreApi.md @@ -65,6 +65,8 @@ Returns pet inventories by status Returns a map of status codes to quantities ### Example + +* Api Key Authentication (api_key): ```python from __future__ import print_function import time diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py index b753906b2e4..782f7fd07b3 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py @@ -32,13 +32,13 @@ class AnotherFakeApi(object): api_client = ApiClient() self.api_client = api_client - def test_special_tags(self, client, **kwargs): # noqa: E501 + def call_123_test_special_tags(self, client, **kwargs): # noqa: E501 """To test special tags # noqa: E501 - To test special tags # noqa: E501 + To test special tags and operation ID starting with number # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.test_special_tags(client, async_req=True) + >>> thread = api.call_123_test_special_tags(client, async_req=True) >>> result = thread.get() :param async_req bool @@ -49,18 +49,18 @@ class AnotherFakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501 + return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 else: - (data) = self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501 + (data) = self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 return data - def test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501 + def call_123_test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501 """To test special tags # noqa: E501 - To test special tags # noqa: E501 + To test special tags and operation ID starting with number # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.test_special_tags_with_http_info(client, async_req=True) + >>> thread = api.call_123_test_special_tags_with_http_info(client, async_req=True) >>> result = thread.get() :param async_req bool @@ -82,14 +82,14 @@ class AnotherFakeApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method test_special_tags" % key + " to method call_123_test_special_tags" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'client' is set if ('client' not in local_var_params or local_var_params['client'] is None): - raise ValueError("Missing the required parameter `client` when calling `test_special_tags`") # noqa: E501 + raise ValueError("Missing the required parameter `client` when calling `call_123_test_special_tags`") # noqa: E501 collection_formats = {} diff --git a/samples/client/petstore/python-asyncio/petstore_api/models/map_test.py b/samples/client/petstore/python-asyncio/petstore_api/models/map_test.py index f2d1042556b..f04bd2cc142 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/models/map_test.py +++ b/samples/client/petstore/python-asyncio/petstore_api/models/map_test.py @@ -34,7 +34,7 @@ class MapTest(object): 'map_map_of_string': 'dict(str, dict(str, str))', 'map_of_enum_string': 'dict(str, str)', 'direct_map': 'dict(str, bool)', - 'indirect_map': 'StringBooleanMap' + 'indirect_map': 'dict(str, bool)' } attribute_map = { @@ -138,7 +138,7 @@ class MapTest(object): :return: The indirect_map of this MapTest. # noqa: E501 - :rtype: StringBooleanMap + :rtype: dict(str, bool) """ return self._indirect_map @@ -148,7 +148,7 @@ class MapTest(object): :param indirect_map: The indirect_map of this MapTest. # noqa: E501 - :type: StringBooleanMap + :type: dict(str, bool) """ self._indirect_map = indirect_map diff --git a/samples/client/petstore/python-asyncio/petstore_api/rest.py b/samples/client/petstore/python-asyncio/petstore_api/rest.py index f0ac582a697..471ea8417e5 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/rest.py +++ b/samples/client/petstore/python-asyncio/petstore_api/rest.py @@ -46,8 +46,6 @@ class RESTClientObject(object): def __init__(self, configuration, pools_size=4, maxsize=4): # maxsize is number of requests to host that are allowed in parallel - # ca_certs vs cert_file vs key_file - # http://stackoverflow.com/a/23957365/2985775 # ca_certs if configuration.ssl_ca_cert: @@ -62,10 +60,13 @@ class RESTClientObject(object): configuration.cert_file, keyfile=configuration.key_file ) + if not configuration.verify_ssl: + ssl_context.check_hostname = False + ssl_context.verify_mode = ssl.CERT_NONE + connector = aiohttp.TCPConnector( limit=maxsize, - ssl_context=ssl_context, - verify_ssl=configuration.verify_ssl + ssl_context=ssl_context ) # https pool manager diff --git a/samples/client/petstore/python-tornado/.openapi-generator/VERSION b/samples/client/petstore/python-tornado/.openapi-generator/VERSION index dde25ef08e8..6d94c9c2e12 100644 --- a/samples/client/petstore/python-tornado/.openapi-generator/VERSION +++ b/samples/client/petstore/python-tornado/.openapi-generator/VERSION @@ -1 +1 @@ -3.1.1-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python-tornado/README.md b/samples/client/petstore/python-tornado/README.md index b76d6153e89..6e6dbf6180a 100644 --- a/samples/client/petstore/python-tornado/README.md +++ b/samples/client/petstore/python-tornado/README.md @@ -57,10 +57,10 @@ client = petstore_api.Client() # Client | client model try: # To test special tags - api_response = api_instance.test_special_tags(client) + api_response = api_instance.call_123_test_special_tags(client) pprint(api_response) except ApiException as e: - print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e) + print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) ``` @@ -70,7 +70,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**test_special_tags**](docs/AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | diff --git a/samples/client/petstore/python-tornado/docs/AnotherFakeApi.md b/samples/client/petstore/python-tornado/docs/AnotherFakeApi.md index 32d4fa0696c..447ce3edde3 100644 --- a/samples/client/petstore/python-tornado/docs/AnotherFakeApi.md +++ b/samples/client/petstore/python-tornado/docs/AnotherFakeApi.md @@ -4,15 +4,15 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**test_special_tags**](AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +[**call_123_test_special_tags**](AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags -# **test_special_tags** -> Client test_special_tags(client) +# **call_123_test_special_tags** +> Client call_123_test_special_tags(client) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Example ```python @@ -28,10 +28,10 @@ client = petstore_api.Client() # Client | client model try: # To test special tags - api_response = api_instance.test_special_tags(client) + api_response = api_instance.call_123_test_special_tags(client) pprint(api_response) except ApiException as e: - print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e) + print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) ``` ### Parameters diff --git a/samples/client/petstore/python-tornado/docs/FakeApi.md b/samples/client/petstore/python-tornado/docs/FakeApi.md index 3510abda8b7..57cf9937d36 100644 --- a/samples/client/petstore/python-tornado/docs/FakeApi.md +++ b/samples/client/petstore/python-tornado/docs/FakeApi.md @@ -353,6 +353,8 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ### Example + +* Basic Authentication (http_basic_test): ```python from __future__ import print_function import time diff --git a/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md index 34d44991ff9..3180674a077 100644 --- a/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python-tornado/docs/FakeClassnameTags123Api.md @@ -15,6 +15,8 @@ To test class name in snake case To test class name in snake case ### Example + +* Api Key Authentication (api_key_query): ```python from __future__ import print_function import time diff --git a/samples/client/petstore/python-tornado/docs/MapTest.md b/samples/client/petstore/python-tornado/docs/MapTest.md index ee6036eb2f4..a5601691f88 100644 --- a/samples/client/petstore/python-tornado/docs/MapTest.md +++ b/samples/client/petstore/python-tornado/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **map_map_of_string** | **dict(str, dict(str, str))** | | [optional] **map_of_enum_string** | **dict(str, str)** | | [optional] **direct_map** | **dict(str, bool)** | | [optional] -**indirect_map** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirect_map** | **dict(str, 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/python-tornado/docs/PetApi.md b/samples/client/petstore/python-tornado/docs/PetApi.md index 9b8fd577a52..726db4708d7 100644 --- a/samples/client/petstore/python-tornado/docs/PetApi.md +++ b/samples/client/petstore/python-tornado/docs/PetApi.md @@ -21,6 +21,8 @@ Method | HTTP request | Description Add a new pet to the store ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -70,6 +72,8 @@ void (empty response body) Deletes a pet ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -123,6 +127,8 @@ Finds Pets by status Multiple status values can be provided with comma separated strings ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -175,6 +181,8 @@ Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -227,6 +235,8 @@ Find pet by ID Returns a single pet ### Example + +* Api Key Authentication (api_key): ```python from __future__ import print_function import time @@ -279,6 +289,8 @@ Name | Type | Description | Notes Update an existing pet ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -328,6 +340,8 @@ void (empty response body) Updates a pet in the store with form data ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -381,6 +395,8 @@ void (empty response body) uploads an image ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -435,6 +451,8 @@ Name | Type | Description | Notes uploads an image (required) ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time diff --git a/samples/client/petstore/python-tornado/docs/StoreApi.md b/samples/client/petstore/python-tornado/docs/StoreApi.md index e4d6a7a8885..ab342460f86 100644 --- a/samples/client/petstore/python-tornado/docs/StoreApi.md +++ b/samples/client/petstore/python-tornado/docs/StoreApi.md @@ -65,6 +65,8 @@ Returns pet inventories by status Returns a map of status codes to quantities ### Example + +* Api Key Authentication (api_key): ```python from __future__ import print_function import time diff --git a/samples/client/petstore/python-tornado/petstore_api/api/another_fake_api.py b/samples/client/petstore/python-tornado/petstore_api/api/another_fake_api.py index b753906b2e4..782f7fd07b3 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/another_fake_api.py @@ -32,13 +32,13 @@ class AnotherFakeApi(object): api_client = ApiClient() self.api_client = api_client - def test_special_tags(self, client, **kwargs): # noqa: E501 + def call_123_test_special_tags(self, client, **kwargs): # noqa: E501 """To test special tags # noqa: E501 - To test special tags # noqa: E501 + To test special tags and operation ID starting with number # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.test_special_tags(client, async_req=True) + >>> thread = api.call_123_test_special_tags(client, async_req=True) >>> result = thread.get() :param async_req bool @@ -49,18 +49,18 @@ class AnotherFakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501 + return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 else: - (data) = self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501 + (data) = self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 return data - def test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501 + def call_123_test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501 """To test special tags # noqa: E501 - To test special tags # noqa: E501 + To test special tags and operation ID starting with number # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.test_special_tags_with_http_info(client, async_req=True) + >>> thread = api.call_123_test_special_tags_with_http_info(client, async_req=True) >>> result = thread.get() :param async_req bool @@ -82,14 +82,14 @@ class AnotherFakeApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method test_special_tags" % key + " to method call_123_test_special_tags" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'client' is set if ('client' not in local_var_params or local_var_params['client'] is None): - raise ValueError("Missing the required parameter `client` when calling `test_special_tags`") # noqa: E501 + raise ValueError("Missing the required parameter `client` when calling `call_123_test_special_tags`") # noqa: E501 collection_formats = {} diff --git a/samples/client/petstore/python-tornado/petstore_api/models/map_test.py b/samples/client/petstore/python-tornado/petstore_api/models/map_test.py index f2d1042556b..f04bd2cc142 100644 --- a/samples/client/petstore/python-tornado/petstore_api/models/map_test.py +++ b/samples/client/petstore/python-tornado/petstore_api/models/map_test.py @@ -34,7 +34,7 @@ class MapTest(object): 'map_map_of_string': 'dict(str, dict(str, str))', 'map_of_enum_string': 'dict(str, str)', 'direct_map': 'dict(str, bool)', - 'indirect_map': 'StringBooleanMap' + 'indirect_map': 'dict(str, bool)' } attribute_map = { @@ -138,7 +138,7 @@ class MapTest(object): :return: The indirect_map of this MapTest. # noqa: E501 - :rtype: StringBooleanMap + :rtype: dict(str, bool) """ return self._indirect_map @@ -148,7 +148,7 @@ class MapTest(object): :param indirect_map: The indirect_map of this MapTest. # noqa: E501 - :type: StringBooleanMap + :type: dict(str, bool) """ self._indirect_map = indirect_map diff --git a/samples/client/petstore/python/.openapi-generator/VERSION b/samples/client/petstore/python/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/client/petstore/python/.openapi-generator/VERSION +++ b/samples/client/petstore/python/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/python/README.md b/samples/client/petstore/python/README.md index b76d6153e89..6e6dbf6180a 100644 --- a/samples/client/petstore/python/README.md +++ b/samples/client/petstore/python/README.md @@ -57,10 +57,10 @@ client = petstore_api.Client() # Client | client model try: # To test special tags - api_response = api_instance.test_special_tags(client) + api_response = api_instance.call_123_test_special_tags(client) pprint(api_response) except ApiException as e: - print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e) + print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) ``` @@ -70,7 +70,7 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- -*AnotherFakeApi* | [**test_special_tags**](docs/AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +*AnotherFakeApi* | [**call_123_test_special_tags**](docs/AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags *FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | *FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | *FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | diff --git a/samples/client/petstore/python/docs/AnotherFakeApi.md b/samples/client/petstore/python/docs/AnotherFakeApi.md index 32d4fa0696c..447ce3edde3 100644 --- a/samples/client/petstore/python/docs/AnotherFakeApi.md +++ b/samples/client/petstore/python/docs/AnotherFakeApi.md @@ -4,15 +4,15 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- -[**test_special_tags**](AnotherFakeApi.md#test_special_tags) | **PATCH** /another-fake/dummy | To test special tags +[**call_123_test_special_tags**](AnotherFakeApi.md#call_123_test_special_tags) | **PATCH** /another-fake/dummy | To test special tags -# **test_special_tags** -> Client test_special_tags(client) +# **call_123_test_special_tags** +> Client call_123_test_special_tags(client) To test special tags -To test special tags +To test special tags and operation ID starting with number ### Example ```python @@ -28,10 +28,10 @@ client = petstore_api.Client() # Client | client model try: # To test special tags - api_response = api_instance.test_special_tags(client) + api_response = api_instance.call_123_test_special_tags(client) pprint(api_response) except ApiException as e: - print("Exception when calling AnotherFakeApi->test_special_tags: %s\n" % e) + print("Exception when calling AnotherFakeApi->call_123_test_special_tags: %s\n" % e) ``` ### Parameters diff --git a/samples/client/petstore/python/docs/FakeApi.md b/samples/client/petstore/python/docs/FakeApi.md index 3510abda8b7..57cf9937d36 100644 --- a/samples/client/petstore/python/docs/FakeApi.md +++ b/samples/client/petstore/python/docs/FakeApi.md @@ -353,6 +353,8 @@ Fake endpoint for testing various parameters 假端點 偽のエンドポイン Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ### Example + +* Basic Authentication (http_basic_test): ```python from __future__ import print_function import time diff --git a/samples/client/petstore/python/docs/FakeClassnameTags123Api.md b/samples/client/petstore/python/docs/FakeClassnameTags123Api.md index 34d44991ff9..3180674a077 100644 --- a/samples/client/petstore/python/docs/FakeClassnameTags123Api.md +++ b/samples/client/petstore/python/docs/FakeClassnameTags123Api.md @@ -15,6 +15,8 @@ To test class name in snake case To test class name in snake case ### Example + +* Api Key Authentication (api_key_query): ```python from __future__ import print_function import time diff --git a/samples/client/petstore/python/docs/MapTest.md b/samples/client/petstore/python/docs/MapTest.md index ee6036eb2f4..a5601691f88 100644 --- a/samples/client/petstore/python/docs/MapTest.md +++ b/samples/client/petstore/python/docs/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **map_map_of_string** | **dict(str, dict(str, str))** | | [optional] **map_of_enum_string** | **dict(str, str)** | | [optional] **direct_map** | **dict(str, bool)** | | [optional] -**indirect_map** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirect_map** | **dict(str, 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/python/docs/PetApi.md b/samples/client/petstore/python/docs/PetApi.md index 9b8fd577a52..726db4708d7 100644 --- a/samples/client/petstore/python/docs/PetApi.md +++ b/samples/client/petstore/python/docs/PetApi.md @@ -21,6 +21,8 @@ Method | HTTP request | Description Add a new pet to the store ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -70,6 +72,8 @@ void (empty response body) Deletes a pet ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -123,6 +127,8 @@ Finds Pets by status Multiple status values can be provided with comma separated strings ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -175,6 +181,8 @@ Finds Pets by tags Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -227,6 +235,8 @@ Find pet by ID Returns a single pet ### Example + +* Api Key Authentication (api_key): ```python from __future__ import print_function import time @@ -279,6 +289,8 @@ Name | Type | Description | Notes Update an existing pet ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -328,6 +340,8 @@ void (empty response body) Updates a pet in the store with form data ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -381,6 +395,8 @@ void (empty response body) uploads an image ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time @@ -435,6 +451,8 @@ Name | Type | Description | Notes uploads an image (required) ### Example + +* OAuth Authentication (petstore_auth): ```python from __future__ import print_function import time diff --git a/samples/client/petstore/python/docs/StoreApi.md b/samples/client/petstore/python/docs/StoreApi.md index e4d6a7a8885..ab342460f86 100644 --- a/samples/client/petstore/python/docs/StoreApi.md +++ b/samples/client/petstore/python/docs/StoreApi.md @@ -65,6 +65,8 @@ Returns pet inventories by status Returns a map of status codes to quantities ### Example + +* Api Key Authentication (api_key): ```python from __future__ import print_function import time diff --git a/samples/client/petstore/python/petstore_api/api/another_fake_api.py b/samples/client/petstore/python/petstore_api/api/another_fake_api.py index b753906b2e4..782f7fd07b3 100644 --- a/samples/client/petstore/python/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/another_fake_api.py @@ -32,13 +32,13 @@ class AnotherFakeApi(object): api_client = ApiClient() self.api_client = api_client - def test_special_tags(self, client, **kwargs): # noqa: E501 + def call_123_test_special_tags(self, client, **kwargs): # noqa: E501 """To test special tags # noqa: E501 - To test special tags # noqa: E501 + To test special tags and operation ID starting with number # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.test_special_tags(client, async_req=True) + >>> thread = api.call_123_test_special_tags(client, async_req=True) >>> result = thread.get() :param async_req bool @@ -49,18 +49,18 @@ class AnotherFakeApi(object): """ kwargs['_return_http_data_only'] = True if kwargs.get('async_req'): - return self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501 + return self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 else: - (data) = self.test_special_tags_with_http_info(client, **kwargs) # noqa: E501 + (data) = self.call_123_test_special_tags_with_http_info(client, **kwargs) # noqa: E501 return data - def test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501 + def call_123_test_special_tags_with_http_info(self, client, **kwargs): # noqa: E501 """To test special tags # noqa: E501 - To test special tags # noqa: E501 + To test special tags and operation ID starting with number # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.test_special_tags_with_http_info(client, async_req=True) + >>> thread = api.call_123_test_special_tags_with_http_info(client, async_req=True) >>> result = thread.get() :param async_req bool @@ -82,14 +82,14 @@ class AnotherFakeApi(object): if key not in all_params: raise TypeError( "Got an unexpected keyword argument '%s'" - " to method test_special_tags" % key + " to method call_123_test_special_tags" % key ) local_var_params[key] = val del local_var_params['kwargs'] # verify the required parameter 'client' is set if ('client' not in local_var_params or local_var_params['client'] is None): - raise ValueError("Missing the required parameter `client` when calling `test_special_tags`") # noqa: E501 + raise ValueError("Missing the required parameter `client` when calling `call_123_test_special_tags`") # noqa: E501 collection_formats = {} diff --git a/samples/client/petstore/python/petstore_api/models/map_test.py b/samples/client/petstore/python/petstore_api/models/map_test.py index f2d1042556b..f04bd2cc142 100644 --- a/samples/client/petstore/python/petstore_api/models/map_test.py +++ b/samples/client/petstore/python/petstore_api/models/map_test.py @@ -34,7 +34,7 @@ class MapTest(object): 'map_map_of_string': 'dict(str, dict(str, str))', 'map_of_enum_string': 'dict(str, str)', 'direct_map': 'dict(str, bool)', - 'indirect_map': 'StringBooleanMap' + 'indirect_map': 'dict(str, bool)' } attribute_map = { @@ -138,7 +138,7 @@ class MapTest(object): :return: The indirect_map of this MapTest. # noqa: E501 - :rtype: StringBooleanMap + :rtype: dict(str, bool) """ return self._indirect_map @@ -148,7 +148,7 @@ class MapTest(object): :param indirect_map: The indirect_map of this MapTest. # noqa: E501 - :type: StringBooleanMap + :type: dict(str, bool) """ self._indirect_map = indirect_map diff --git a/samples/client/petstore/ruby/Gemfile b/samples/client/petstore/ruby/Gemfile index d255a3ab238..01ba313fe12 100644 --- a/samples/client/petstore/ruby/Gemfile +++ b/samples/client/petstore/ruby/Gemfile @@ -4,4 +4,5 @@ gemspec group :development, :test do gem 'rake', '~> 12.0.0' + gem 'pry-byebug' end diff --git a/samples/client/petstore/ruby/Gemfile.lock b/samples/client/petstore/ruby/Gemfile.lock index 1dc6956be6c..0a4edb9a91b 100644 --- a/samples/client/petstore/ruby/Gemfile.lock +++ b/samples/client/petstore/ruby/Gemfile.lock @@ -17,29 +17,38 @@ GEM sys-uname autotest-growl (0.2.16) autotest-rails-pure (4.1.2) + byebug (10.0.2) + coderay (1.1.2) crack (0.4.3) safe_yaml (~> 1.0.0) diff-lcs (1.3) ethon (0.11.0) ffi (>= 1.3.0) - ffi (1.9.23) + ffi (1.9.25) hashdiff (0.3.7) json (2.1.0) - public_suffix (3.0.2) + method_source (0.9.0) + pry (0.11.3) + coderay (~> 1.1.0) + method_source (~> 0.9.0) + pry-byebug (3.6.0) + byebug (~> 10.0) + pry (~> 0.10) + public_suffix (3.0.3) rake (12.0.0) - rspec (3.7.0) - rspec-core (~> 3.7.0) - rspec-expectations (~> 3.7.0) - rspec-mocks (~> 3.7.0) - rspec-core (3.7.1) - rspec-support (~> 3.7.0) - rspec-expectations (3.7.0) + rspec (3.8.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-mocks (3.7.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-support (3.7.1) + rspec-support (~> 3.8.0) + rspec-support (3.8.0) safe_yaml (1.0.4) sys-uname (1.0.3) ffi (>= 1.0.0) @@ -60,7 +69,11 @@ DEPENDENCIES autotest-growl (~> 0.2, >= 0.2.16) autotest-rails-pure (~> 4.1, >= 4.1.2) petstore! + pry-byebug rake (~> 12.0.0) rspec (~> 3.6, >= 3.6.0) vcr (~> 3.0, >= 3.0.1) webmock (~> 1.24, >= 1.24.3) + +BUNDLED WITH + 1.16.1 diff --git a/samples/client/petstore/ruby/docs/MapTest.md b/samples/client/petstore/ruby/docs/MapTest.md index e7359118889..54e16e1933e 100644 --- a/samples/client/petstore/ruby/docs/MapTest.md +++ b/samples/client/petstore/ruby/docs/MapTest.md @@ -6,6 +6,6 @@ Name | Type | Description | Notes **map_map_of_string** | **Hash<String, Hash<String, String>>** | | [optional] **map_of_enum_string** | **Hash<String, String>** | | [optional] **direct_map** | **Hash<String, BOOLEAN>** | | [optional] -**indirect_map** | [**StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirect_map** | **Hash<String, BOOLEAN>** | | [optional] diff --git a/samples/client/petstore/ruby/lib/petstore/models/map_test.rb b/samples/client/petstore/ruby/lib/petstore/models/map_test.rb index f546c9dc320..6d3f5f5f8eb 100644 --- a/samples/client/petstore/ruby/lib/petstore/models/map_test.rb +++ b/samples/client/petstore/ruby/lib/petstore/models/map_test.rb @@ -60,7 +60,7 @@ module Petstore :'map_map_of_string' => :'Hash>', :'map_of_enum_string' => :'Hash', :'direct_map' => :'Hash', - :'indirect_map' => :'StringBooleanMap' + :'indirect_map' => :'Hash' } end @@ -91,7 +91,9 @@ module Petstore end if attributes.has_key?(:'indirect_map') - self.indirect_map = attributes[:'indirect_map'] + if (value = attributes[:'indirect_map']).is_a?(Hash) + self.indirect_map = value + end end end diff --git a/samples/client/petstore/ruby/petstore_profiling.rb b/samples/client/petstore/ruby/petstore_profiling.rb index 485bd40c0c7..5a6029fa3bd 100644 --- a/samples/client/petstore/ruby/petstore_profiling.rb +++ b/samples/client/petstore/ruby/petstore_profiling.rb @@ -24,7 +24,7 @@ class PetstoreProfiling pet.status = "available" pet.photo_urls = ["http://profiler.com"] # new tag - tag= Petstore::Tag.new + tag = Petstore::Tag.new tag.id = new_pet_id # use the same id as pet tag.name = "profile tag 1" # new category diff --git a/samples/client/petstore/ruby/spec/api_client_spec.rb b/samples/client/petstore/ruby/spec/api_client_spec.rb index 15468683bc3..ec2939f8393 100644 --- a/samples/client/petstore/ruby/spec/api_client_spec.rb +++ b/samples/client/petstore/ruby/spec/api_client_spec.rb @@ -65,13 +65,13 @@ describe Petstore::ApiClient do header_params = {} query_params = {} api_client.update_params_for_auth! header_params, query_params, auth_names - expect(header_params).to eq({'api_key' => 'PREFIX special-key'}) + expect(header_params).to eq('api_key' => 'PREFIX special-key') expect(query_params).to eq({}) header_params = {} query_params = {} api_client2.update_params_for_auth! header_params, query_params, auth_names - expect(header_params).to eq({'api_key' => 'PREFIX2 special-key2'}) + expect(header_params).to eq('api_key' => 'PREFIX2 special-key2') expect(query_params).to eq({}) end @@ -87,7 +87,7 @@ describe Petstore::ApiClient do query_params = {} auth_names = ['api_key', 'unknown'] api_client.update_params_for_auth! header_params, query_params, auth_names - expect(header_params).to eq({'api_key' => 'special-key'}) + expect(header_params).to eq('api_key' => 'special-key') expect(query_params).to eq({}) end end @@ -114,7 +114,7 @@ describe Petstore::ApiClient do describe "#deserialize" do it "handles Array" do api_client = Petstore::ApiClient.new - headers = {'Content-Type' => 'application/json'} + headers = { 'Content-Type' => 'application/json' } response = double('response', headers: headers, body: '[12, 34]') data = api_client.deserialize(response, 'Array') expect(data).to be_a(Array) @@ -123,7 +123,7 @@ describe Petstore::ApiClient do it "handles Array>" do api_client = Petstore::ApiClient.new - headers = {'Content-Type' => 'application/json'} + headers = { 'Content-Type' => 'application/json' } response = double('response', headers: headers, body: '[[12, 34], [56]]') data = api_client.deserialize(response, 'Array>') expect(data).to be_a(Array) @@ -132,16 +132,16 @@ describe Petstore::ApiClient do it "handles Hash" do api_client = Petstore::ApiClient.new - headers = {'Content-Type' => 'application/json'} + headers = { 'Content-Type' => 'application/json' } response = double('response', headers: headers, body: '{"message": "Hello"}') data = api_client.deserialize(response, 'Hash') expect(data).to be_a(Hash) - expect(data).to eq({:message => 'Hello'}) + expect(data).to eq(:message => 'Hello') end it "handles Hash" do api_client = Petstore::ApiClient.new - headers = {'Content-Type' => 'application/json'} + headers = { 'Content-Type' => 'application/json' } response = double('response', headers: headers, body: '{"pet": {"id": 1}}') data = api_client.deserialize(response, 'Hash') expect(data).to be_a(Hash) @@ -153,7 +153,7 @@ describe Petstore::ApiClient do it "handles Hash>" do api_client = Petstore::ApiClient.new - headers = {'Content-Type' => 'application/json'} + headers = { 'Content-Type' => 'application/json' } response = double('response', headers: headers, body: '{"data": {"pet": {"id": 1}}}') result = api_client.deserialize(response, 'Hash>') expect(result).to be_a(Hash) @@ -176,7 +176,7 @@ describe Petstore::ApiClient do pet.status = nil pet.photo_urls = nil pet.tags = [] - expected = {id: 1, name: '', tags: []} + expected = { id: 1, name: '', tags: [] } expect(api_client.object_to_hash(pet)).to eq(expected) end end diff --git a/samples/client/petstore/ruby/spec/base_object_spec.rb b/samples/client/petstore/ruby/spec/base_object_spec.rb index ad3b4eb74f7..4043dcb6b97 100644 --- a/samples/client/petstore/ruby/spec/base_object_spec.rb +++ b/samples/client/petstore/ruby/spec/base_object_spec.rb @@ -32,7 +32,7 @@ end describe 'BaseObject' do describe 'boolean values' do - let(:obj) { Petstore::Cat.new({declawed: false}) } + let(:obj) { Petstore::Cat.new(declawed: false) } it 'should have values set' do expect(obj.declawed).not_to be_nil @@ -44,12 +44,12 @@ describe 'BaseObject' do let(:obj) { ArrayMapObject.new } let(:data) do - {int_arr: [123, 456], - pet_arr: [{name: 'Kitty'}], - int_map: {'int' => 123}, - pet_map: {'pet' => {name: 'Kitty'}}, - int_arr_map: {'int_arr' => [123, 456]}, - pet_arr_map: {'pet_arr' => [{name: 'Kitty'}]}, + { int_arr: [123, 456], + pet_arr: [{ name: 'Kitty' }], + int_map: { 'int' => 123 }, + pet_map: { 'pet' => { name: 'Kitty' } }, + int_arr_map: { 'int_arr' => [123, 456] }, + pet_arr_map: { 'pet_arr' => [{ name: 'Kitty' }] }, boolean_true_arr: [true, "true", "TruE", 1, "y", "yes", "1", "t", "T"], boolean_false_arr: [false, "", 0, "0", "f", nil, "null", "\ntrue\n"], } @@ -68,7 +68,7 @@ describe 'BaseObject' do expect(pet.name).to eq('Kitty') expect(obj.int_map).to be_instance_of(Hash) - expect(obj.int_map).to eq({'int' => 123}) + expect(obj.int_map).to eq('int' => 123) expect(obj.pet_map).to be_instance_of(Hash) pet = obj.pet_map['pet'] @@ -101,8 +101,8 @@ describe 'BaseObject' do it 'works for #to_hash' do obj.build_from_hash(data) expect_data = data.dup - expect_data[:boolean_true_arr].map! {true} - expect_data[:boolean_false_arr].map! {false} + expect_data[:boolean_true_arr].map! { true } + expect_data[:boolean_false_arr].map! { false } expect(obj.to_hash).to eq(expect_data) end end diff --git a/samples/client/petstore/ruby/spec/pet_spec.rb b/samples/client/petstore/ruby/spec/pet_spec.rb index 728d0e5345a..ec3af401cbe 100644 --- a/samples/client/petstore/ruby/spec/pet_spec.rb +++ b/samples/client/petstore/ruby/spec/pet_spec.rb @@ -19,9 +19,9 @@ describe "Pet" do describe "pet methods" do it "should construct a new pet object" do - tag1 = Petstore::Tag.new({'id' => 1, 'name'=> 'tag1'}) - tag2 = Petstore::Tag.new({'id' => 2, 'name'=> 'tag2'}) - category1 = Petstore::Category.new({:id => 1, :name => 'category unknown'}) + tag1 = Petstore::Tag.new('id' => 1, 'name' => 'tag1') + tag2 = Petstore::Tag.new('id' => 2, 'name' => 'tag2') + category1 = Petstore::Category.new(:id => 1, :name => 'category unknown') # initalize using both string and symbol key pet_hash = { :id => @pet_id, diff --git a/samples/client/petstore/ruby/spec/spec_helper.rb b/samples/client/petstore/ruby/spec/spec_helper.rb index 11794c9ebcf..953ff788a87 100644 --- a/samples/client/petstore/ruby/spec/spec_helper.rb +++ b/samples/client/petstore/ruby/spec/spec_helper.rb @@ -114,7 +114,7 @@ def prepare_pet(pet_api) pet = Petstore::Pet.new('id' => pet_id, 'name' => "RUBY UNIT TESTING", 'photo_urls' => 'photo url', 'category' => category, 'tags' => [tag], 'status' => 'pending') pet_api.add_pet(pet) - return pet_id + pet_id end # create a random order, return its id @@ -127,7 +127,7 @@ def prepare_store(store_api) "status" => "placed", "complete" => false) store_api.place_order(order) - return order_id + order_id end # A random string to tack onto stuff to ensure we're not seeing @@ -141,7 +141,7 @@ end # helper method to deserialize json string back to object def deserialize_json(s, type) - headers = {'Content-Type' => 'application/json'} + headers = { 'Content-Type' => 'application/json' } response = double('response', headers: headers, body: s) API_CLIENT.deserialize(response, type) end diff --git a/samples/client/petstore/scala-akka/.openapi-generator/VERSION b/samples/client/petstore/scala-akka/.openapi-generator/VERSION index 096bf47efe3..f4cb97d56ce 100644 --- a/samples/client/petstore/scala-akka/.openapi-generator/VERSION +++ b/samples/client/petstore/scala-akka/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/scala-akka/pom.xml b/samples/client/petstore/scala-akka/pom.xml index 20bf1d9209f..264dad8d1a5 100644 --- a/samples/client/petstore/scala-akka/pom.xml +++ b/samples/client/petstore/scala-akka/pom.xml @@ -240,4 +240,4 @@ - + \ No newline at end of file diff --git a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/ApiResponse.scala b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/ApiResponse.scala index ce8e3b4942b..81370edb740 100644 --- a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/ApiResponse.scala +++ b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/ApiResponse.scala @@ -16,9 +16,9 @@ import org.joda.time.DateTime import java.util.UUID case class ApiResponse ( - code: Option[Int], - `type`: Option[String], - message: Option[String] + code: Option[Int] = None, + `type`: Option[String] = None, + message: Option[String] = None ) extends ApiModel diff --git a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Category.scala b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Category.scala index 84a70a3cf6b..8d609a55522 100644 --- a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Category.scala +++ b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Category.scala @@ -16,8 +16,8 @@ import org.joda.time.DateTime import java.util.UUID case class Category ( - id: Option[Long], - name: Option[String] + id: Option[Long] = None, + name: Option[String] = None ) extends ApiModel diff --git a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Order.scala b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Order.scala index 6094089b493..fe4daa9c359 100644 --- a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Order.scala +++ b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Order.scala @@ -16,13 +16,13 @@ import org.joda.time.DateTime import java.util.UUID case class Order ( - id: Option[Long], - petId: Option[Long], - quantity: Option[Int], - shipDate: Option[DateTime], + id: Option[Long] = None, + petId: Option[Long] = None, + quantity: Option[Int] = None, + shipDate: Option[DateTime] = None, /* Order Status */ - status: Option[OrderEnums.Status], - complete: Option[Boolean] + status: Option[OrderEnums.Status] = None, + complete: Option[Boolean] = None ) extends ApiModel object OrderEnums { diff --git a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Pet.scala b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Pet.scala index 6d4918a776a..e5df29f2467 100644 --- a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Pet.scala +++ b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Pet.scala @@ -16,13 +16,13 @@ import org.joda.time.DateTime import java.util.UUID case class Pet ( - id: Option[Long], - category: Option[Category], + id: Option[Long] = None, + category: Option[Category] = None, name: String, photoUrls: Seq[String], - tags: Option[Seq[Tag]], + tags: Option[Seq[Tag]] = None, /* pet status in the store */ - status: Option[PetEnums.Status] + status: Option[PetEnums.Status] = None ) extends ApiModel object PetEnums { diff --git a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Tag.scala b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Tag.scala index 5ed6d6ab614..e46602f84f4 100644 --- a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Tag.scala +++ b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/Tag.scala @@ -16,8 +16,8 @@ import org.joda.time.DateTime import java.util.UUID case class Tag ( - id: Option[Long], - name: Option[String] + id: Option[Long] = None, + name: Option[String] = None ) extends ApiModel diff --git a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/User.scala b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/User.scala index facd053fa45..ef8eb6b4a0d 100644 --- a/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/User.scala +++ b/samples/client/petstore/scala-akka/src/main/scala/org/openapitools/client/model/User.scala @@ -16,15 +16,15 @@ import org.joda.time.DateTime import java.util.UUID case class User ( - id: Option[Long], - username: Option[String], - firstName: Option[String], - lastName: Option[String], - email: Option[String], - password: Option[String], - phone: Option[String], + id: Option[Long] = None, + username: Option[String] = None, + firstName: Option[String] = None, + lastName: Option[String] = None, + email: Option[String] = None, + password: Option[String] = None, + phone: Option[String] = None, /* User Status */ - userStatus: Option[Int] + userStatus: Option[Int] = None ) extends ApiModel diff --git a/samples/client/petstore/spring-cloud/pom.xml b/samples/client/petstore/spring-cloud/pom.xml index 81bb2bc1bce..a96055f2c93 100644 --- a/samples/client/petstore/spring-cloud/pom.xml +++ b/samples/client/petstore/spring-cloud/pom.xml @@ -14,7 +14,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.4.RELEASE + 2.0.5.RELEASE src/main/java @@ -25,7 +25,7 @@ org.springframework.cloud spring-cloud-starter-parent - Dalston.SR1 + Finchley.SR1 pom import @@ -40,28 +40,16 @@
org.springframework.cloud - spring-cloud-starter-feign + spring-cloud-starter-openfeign org.springframework.cloud - spring-cloud-security + spring-cloud-starter-oauth2 - - org.springframework.security.oauth - spring-security-oauth2 - - com.fasterxml.jackson.datatype jackson-datatype-jsr310 - - - javax.validation - validation-api - 1.1.0.Final - provided - org.springframework.boot spring-boot-starter-test 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 d038718513c..6e282bb98cf 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 @@ -72,7 +72,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = "application/json", method = RequestMethod.GET) - 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); + com.netflix.hystrix.HystrixCommand>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList<>()") List status); @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 = { @@ -87,7 +87,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = "application/json", method = RequestMethod.GET) - com.netflix.hystrix.HystrixCommand>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags); + com.netflix.hystrix.HystrixCommand>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList<>()") List tags); @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -130,7 +130,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = "application/x-www-form-urlencoded", method = RequestMethod.POST) - 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" , defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet" , defaultValue="null") @RequestParam(value="status", required=false) String status); + 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); @ApiOperation(value = "uploads an image", nickname = "uploadFile", notes = "", response = ModelApiResponse.class, authorizations = { @@ -145,6 +145,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" , defaultValue="null") @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 detail") @RequestParam("file") MultipartFile file); } diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/PetApiClient.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/PetApiClient.java index 2fe3fdeb1b7..ac33f943323 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/PetApiClient.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/PetApiClient.java @@ -1,6 +1,6 @@ package org.openapitools.api; -import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.cloud.openfeign.FeignClient; import org.openapitools.configuration.ClientConfiguration; @FeignClient(name="${openAPIPetstore.name:openAPIPetstore}", url="${openAPIPetstore.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class) diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApiClient.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApiClient.java index 98d02b641ce..0943d581356 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApiClient.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/StoreApiClient.java @@ -1,6 +1,6 @@ package org.openapitools.api; -import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.cloud.openfeign.FeignClient; import org.openapitools.configuration.ClientConfiguration; @FeignClient(name="${openAPIPetstore.name:openAPIPetstore}", url="${openAPIPetstore.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class) diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApiClient.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApiClient.java index 13f59fb2b69..1933bd82d3a 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApiClient.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/api/UserApiClient.java @@ -1,6 +1,6 @@ package org.openapitools.api; -import org.springframework.cloud.netflix.feign.FeignClient; +import org.springframework.cloud.openfeign.FeignClient; import org.openapitools.configuration.ClientConfiguration; @FeignClient(name="${openAPIPetstore.name:openAPIPetstore}", url="${openAPIPetstore.url:http://petstore.swagger.io/v2}", configuration = ClientConfiguration.class) diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Category.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Category.java index 5bb76f279ca..dae4ea2181e 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Category.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Category.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/ModelApiResponse.java index 8d0a74f41c2..4cb343936df 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -15,13 +15,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Order.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Order.java index c47ad26e066..df461be5774 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Order.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Order.java @@ -17,16 +17,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -62,7 +62,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Pet.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Pet.java index b57bc59b49f..26e9e4e319f 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Pet.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Pet.java @@ -20,13 +20,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") @Valid @@ -70,7 +70,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Tag.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Tag.java index 8037351b93d..f47a452ecdd 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Tag.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/Tag.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/User.java b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/User.java index 62511f3ae06..7d558a10277 100644 --- a/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/User.java +++ b/samples/client/petstore/spring-cloud/src/main/java/org/openapitools/model/User.java @@ -15,28 +15,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/Application.java b/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/Application.java index 5ca1b2ba5e7..3bebf8f409c 100644 --- a/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/Application.java +++ b/samples/client/petstore/spring-cloud/src/test/java/org/openapitools/Application.java @@ -3,7 +3,7 @@ package org.openapitools; import feign.Logger; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.cloud.netflix.feign.EnableFeignClients; +import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Bean; @SpringBootApplication diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/ApiUtil.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/ApiUtil.java index c5f5cc143a1..3ecc0972d94 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/ApiUtil.java +++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/api/ApiUtil.java @@ -8,8 +8,10 @@ import java.io.IOException; public class ApiUtil { public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { try { - req.getNativeResponse(HttpServletResponse.class).addHeader("Content-Type", contentType); - req.getNativeResponse(HttpServletResponse.class).getOutputStream().print(example); + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); } catch (IOException e) { throw new RuntimeException(e); } 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 0213de02576..0dc0848d4dc 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 @@ -82,7 +82,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = "application/json", method = RequestMethod.GET) - default 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) { + default ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList<>()") List status) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -112,7 +112,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = "application/json", method = RequestMethod.GET) - default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { + default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList<>()") List tags) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -188,7 +188,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = "application/x-www-form-urlencoded", method = RequestMethod.POST) - default 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status) { + default 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); } @@ -206,7 +206,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", defaultValue="null") @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 detail") @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/model/Category.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Category.java index 5bb76f279ca..dae4ea2181e 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Category.java +++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Category.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/ModelApiResponse.java index 8d0a74f41c2..4cb343936df 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -15,13 +15,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Order.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Order.java index c47ad26e066..df461be5774 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Order.java +++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Order.java @@ -17,16 +17,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -62,7 +62,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Pet.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Pet.java index b57bc59b49f..26e9e4e319f 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Pet.java +++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Pet.java @@ -20,13 +20,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") @Valid @@ -70,7 +70,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Tag.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Tag.java index 8037351b93d..f47a452ecdd 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Tag.java +++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Tag.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/User.java b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/User.java index 62511f3ae06..7d558a10277 100644 --- a/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/User.java +++ b/samples/client/petstore/spring-stubs/src/main/java/org/openapitools/model/User.java @@ -15,28 +15,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/client/petstore/swift/default/.openapi-generator/VERSION b/samples/client/petstore/swift/default/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/client/petstore/swift/default/.openapi-generator/VERSION +++ b/samples/client/petstore/swift/default/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift/promisekit/.openapi-generator/VERSION b/samples/client/petstore/swift/promisekit/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/client/petstore/swift/promisekit/.openapi-generator/VERSION +++ b/samples/client/petstore/swift/promisekit/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift/rxswift/.openapi-generator/VERSION b/samples/client/petstore/swift/rxswift/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/client/petstore/swift/rxswift/.openapi-generator/VERSION +++ b/samples/client/petstore/swift/rxswift/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift3/default/.openapi-generator/VERSION b/samples/client/petstore/swift3/default/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/client/petstore/swift3/default/.openapi-generator/VERSION +++ b/samples/client/petstore/swift3/default/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift3/default/PetstoreClient.podspec b/samples/client/petstore/swift3/default/PetstoreClient.podspec index c8453cdd8e0..1ff9b50b5e0 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient.podspec +++ b/samples/client/petstore/swift3/default/PetstoreClient.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.version = '0.0.1' - s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.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' diff --git a/samples/client/petstore/swift3/objcCompatible/.openapi-generator/VERSION b/samples/client/petstore/swift3/objcCompatible/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/client/petstore/swift3/objcCompatible/.openapi-generator/VERSION +++ b/samples/client/petstore/swift3/objcCompatible/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift3/objcCompatible/PetstoreClient.podspec b/samples/client/petstore/swift3/objcCompatible/PetstoreClient.podspec index c8453cdd8e0..1ff9b50b5e0 100644 --- a/samples/client/petstore/swift3/objcCompatible/PetstoreClient.podspec +++ b/samples/client/petstore/swift3/objcCompatible/PetstoreClient.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.version = '0.0.1' - s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.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' diff --git a/samples/client/petstore/swift3/promisekit/.openapi-generator/VERSION b/samples/client/petstore/swift3/promisekit/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/client/petstore/swift3/promisekit/.openapi-generator/VERSION +++ b/samples/client/petstore/swift3/promisekit/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient.podspec b/samples/client/petstore/swift3/promisekit/PetstoreClient.podspec index 34ca76681f8..9b69b145db2 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient.podspec +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.version = '0.0.1' - s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.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' diff --git a/samples/client/petstore/swift3/rxswift/.openapi-generator/VERSION b/samples/client/petstore/swift3/rxswift/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/client/petstore/swift3/rxswift/.openapi-generator/VERSION +++ b/samples/client/petstore/swift3/rxswift/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient.podspec b/samples/client/petstore/swift3/rxswift/PetstoreClient.podspec index 83e2df162eb..e556f44d3d4 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient.podspec +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.version = '0.0.1' - s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.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' diff --git a/samples/client/petstore/swift3/unwraprequired/.openapi-generator/VERSION b/samples/client/petstore/swift3/unwraprequired/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/client/petstore/swift3/unwraprequired/.openapi-generator/VERSION +++ b/samples/client/petstore/swift3/unwraprequired/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift3/unwraprequired/PetstoreClient.podspec b/samples/client/petstore/swift3/unwraprequired/PetstoreClient.podspec index c8453cdd8e0..1ff9b50b5e0 100644 --- a/samples/client/petstore/swift3/unwraprequired/PetstoreClient.podspec +++ b/samples/client/petstore/swift3/unwraprequired/PetstoreClient.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.version = '0.0.1' - s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.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' diff --git a/samples/client/petstore/swift4/default/.openapi-generator/VERSION b/samples/client/petstore/swift4/default/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/client/petstore/swift4/default/.openapi-generator/VERSION +++ b/samples/client/petstore/swift4/default/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/default/PetstoreClient.podspec b/samples/client/petstore/swift4/default/PetstoreClient.podspec index c8453cdd8e0..1ff9b50b5e0 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient.podspec +++ b/samples/client/petstore/swift4/default/PetstoreClient.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.version = '0.0.1' - s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.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' diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift index 3c7b53f8149..5c99a37d584 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIHelper.swift @@ -7,8 +7,8 @@ import Foundation public struct APIHelper { - public static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { - let destination = source.reduce(into: [String: Any]()) { (result, item) in + 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 } @@ -20,22 +20,22 @@ public struct APIHelper { return destination } - public static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { - return source.reduce(into: [String: String]()) { (result, item) in + 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 { - result[item.key] = collection.filter({ $0 != nil }).map{ "\($0!)" }.joined(separator: ",") + 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]? { + 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 + return source.reduce(into: [String: Any](), { result, item in switch item.value { case let x as Bool: result[item.key] = x.description @@ -45,11 +45,10 @@ public struct APIHelper { }) } - - public static func mapValuesToQueryItems(_ source: [String:Any?]) -> [URLQueryItem]? { - let destination = source.filter({ $0.value != nil}).reduce(into: [URLQueryItem]()) { (result, item) in + 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 { - let value = collection.filter({ $0 != nil }).map({"\($0!)"}).joined(separator: ",") + 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)")) @@ -62,4 +61,3 @@ public struct APIHelper { return destination } } - 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 8cae3aacfe5..e07b556f393 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs.swift @@ -9,22 +9,22 @@ import Foundation open class PetstoreClientAPI { open static var basePath = "http://petstore.swagger.io:80/v2" open static var credential: URLCredential? - open static var customHeaders: [String:String] = [:] + open static var customHeaders: [String: String] = [:] open static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() } open class RequestBuilder { var credential: URLCredential? - var headers: [String:String] - public let parameters: [String:Any]? + 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) -> ())? + public var onProgressReady: ((Progress) -> Void)? - required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { + public required init(method: String, URLString: String, parameters: [String: Any]?, isBody: Bool, headers: [String: String] = [:]) { self.method = method self.URLString = URLString self.parameters = parameters @@ -34,13 +34,13 @@ open class RequestBuilder { addHeaders(PetstoreClientAPI.customHeaders) } - open func addHeaders(_ aHeaders:[String:String]) { + open func addHeaders(_ aHeaders: [String: String]) { for (header, value) in aHeaders { headers[header] = value } } - open func execute(_ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { } + open func execute(_: @escaping (_ response: Response?, _ error: Error?) -> Void) {} public func addHeader(name: String, value: String) -> Self { if !value.isEmpty { @@ -50,12 +50,12 @@ open class RequestBuilder { } open func addCredential() -> Self { - self.credential = PetstoreClientAPI.credential + credential = PetstoreClientAPI.credential return self } } public protocol RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type - func getBuilder() -> RequestBuilder.Type + func getBuilder() -> RequestBuilder.Type } 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 a31864437b1..34a378977c8 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 @@ -5,31 +5,28 @@ // https://openapi-generator.tech // -import Foundation import Alamofire - - +import Foundation open class AnotherFakeAPI { /** To test special tags - - - parameter client: (body) client model + + - parameter client: (body) client model - parameter completion: completion handler to receive the data and the error objects */ - open class func call123testSpecialTags(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func call123testSpecialTags(client: Client, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { call123testSpecialTagsWithRequestBuilder(client: client).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 client: (body) client model - - returns: RequestBuilder + - parameter client: (body) client model + - returns: RequestBuilder */ open class func call123testSpecialTagsWithRequestBuilder(client: Client) -> RequestBuilder { let path = "/another-fake/dummy" @@ -42,5 +39,4 @@ open class AnotherFakeAPI { return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) } - } 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 00f689db519..6ee99636ce7 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 @@ -5,10 +5,8 @@ // https://openapi-generator.tech // -import Foundation import Alamofire - - +import Foundation open class FakeAPI { /** @@ -16,18 +14,17 @@ 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)) { + 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) } } - /** - POST /fake/outer/boolean - Test serialization of outer boolean types - parameter body: (body) Input boolean as post body (optional) - - returns: RequestBuilder + - returns: RequestBuilder */ open class func fakeOuterBooleanSerializeWithRequestBuilder(body: Bool? = nil) -> RequestBuilder { let path = "/fake/outer/boolean" @@ -46,18 +43,17 @@ open class FakeAPI { - parameter outerComposite: (body) Input composite as post body (optional) - parameter completion: completion handler to receive the data and the error objects */ - open class func fakeOuterCompositeSerialize(outerComposite: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { + open class func fakeOuterCompositeSerialize(outerComposite: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?, _ error: Error?) -> Void)) { fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: outerComposite).execute { (response, error) -> Void in completion(response?.body, error) } } - /** - POST /fake/outer/composite - Test serialization of object with outer number type - parameter outerComposite: (body) Input composite as post body (optional) - - returns: RequestBuilder + - returns: RequestBuilder */ open class func fakeOuterCompositeSerializeWithRequestBuilder(outerComposite: OuterComposite? = nil) -> RequestBuilder { let path = "/fake/outer/composite" @@ -76,18 +72,17 @@ open class FakeAPI { - 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)) { + 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) } } - /** - POST /fake/outer/number - Test serialization of outer number types - parameter body: (body) Input number as post body (optional) - - returns: RequestBuilder + - returns: RequestBuilder */ open class func fakeOuterNumberSerializeWithRequestBuilder(body: Double? = nil) -> RequestBuilder { let path = "/fake/outer/number" @@ -106,18 +101,17 @@ open class FakeAPI { - 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)) { + 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) } } - /** - POST /fake/outer/string - Test serialization of outer string types - parameter body: (body) Input string as post body (optional) - - returns: RequestBuilder + - returns: RequestBuilder */ open class func fakeOuterStringSerializeWithRequestBuilder(body: String? = nil) -> RequestBuilder { let path = "/fake/outer/string" @@ -133,11 +127,11 @@ open class FakeAPI { /** - - parameter fileSchemaTestClass: (body) + - parameter fileSchemaTestClass: (body) - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { - testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: fileSchemaTestClass).execute { (response, error) -> Void in + open class func testBodyWithFileSchema(fileSchemaTestClass: FileSchemaTestClass, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: fileSchemaTestClass).execute { (_, error) -> Void in if error == nil { completion((), error) } else { @@ -146,12 +140,11 @@ open class FakeAPI { } } - /** - PUT /fake/body-with-file-schema - For this test, the body for this request much reference a schema named `File`. - - parameter fileSchemaTestClass: (body) - - returns: RequestBuilder + - parameter fileSchemaTestClass: (body) + - returns: RequestBuilder */ open class func testBodyWithFileSchemaWithRequestBuilder(fileSchemaTestClass: FileSchemaTestClass) -> RequestBuilder { let path = "/fake/body-with-file-schema" @@ -167,12 +160,12 @@ open class FakeAPI { /** - - parameter query: (query) - - parameter user: (body) + - parameter query: (query) + - parameter user: (body) - parameter completion: completion handler to receive the data and the error objects */ - open class func testBodyWithQueryParams(query: String, user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { - testBodyWithQueryParamsWithRequestBuilder(query: query, user: user).execute { (response, error) -> Void in + open class func testBodyWithQueryParams(query: String, user: User, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testBodyWithQueryParamsWithRequestBuilder(query: query, user: user).execute { (_, error) -> Void in if error == nil { completion((), error) } else { @@ -181,12 +174,11 @@ open class FakeAPI { } } - /** - PUT /fake/body-with-query-params - - parameter query: (query) - - parameter user: (body) - - returns: RequestBuilder + - parameter query: (query) + - parameter user: (body) + - returns: RequestBuilder */ open class func testBodyWithQueryParamsWithRequestBuilder(query: String, user: User) -> RequestBuilder { let path = "/fake/body-with-query-params" @@ -195,7 +187,7 @@ open class FakeAPI { var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "query": query + "query": query, ]) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -205,23 +197,22 @@ open class FakeAPI { /** To test \"client\" model - - - parameter client: (body) client model + + - parameter client: (body) client model - parameter completion: completion handler to receive the data and the error objects */ - open class func testClientModel(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClientModel(client: Client, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClientModelWithRequestBuilder(client: client).execute { (response, error) -> Void in completion(response?.body, error) } } - /** To test \"client\" model - PATCH /fake - To test \"client\" model - - parameter client: (body) client model - - returns: RequestBuilder + - parameter client: (body) client model + - returns: RequestBuilder */ open class func testClientModelWithRequestBuilder(client: Client) -> RequestBuilder { let path = "/fake" @@ -236,12 +227,12 @@ open class FakeAPI { } /** - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - - - parameter number: (form) None - - parameter double: (form) None - - parameter patternWithoutDelimiter: (form) None - - parameter byte: (form) None + 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) @@ -254,8 +245,8 @@ open class FakeAPI { - 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 { (response, error) -> Void in + 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 { @@ -264,18 +255,17 @@ open class FakeAPI { } } - /** - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 - POST /fake - - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 + - 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 + - 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) @@ -286,12 +276,12 @@ open class FakeAPI { - parameter dateTime: (form) None (optional) - parameter password: (form) None (optional) - parameter callback: (form) None (optional) - - returns: RequestBuilder + - 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?] = [ + let formParams: [String: Any?] = [ "integer": integer?.encodeToJSON(), "int32": int32?.encodeToJSON(), "int64": int64?.encodeToJSON(), @@ -305,12 +295,12 @@ open class FakeAPI { "date": date?.encodeToJSON(), "dateTime": dateTime?.encodeToJSON(), "password": password, - "callback": callback + "callback": callback, ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -387,19 +377,19 @@ 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 .$) + - 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 { (response, error) -> Void in + 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 { @@ -408,42 +398,41 @@ open class FakeAPI { } } - /** 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 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") - - returns: RequestBuilder + - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional, default to .$) + - 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?] = [ + let formParams: [String: Any?] = [ "enum_form_string_array": enumFormStringArray, - "enum_form_string": enumFormString?.rawValue + "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 + "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 + "enum_header_string": enumHeaderString?.rawValue, ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -454,12 +443,12 @@ open class FakeAPI { /** test inline additionalProperties - - - parameter requestBody: (body) request body + + - parameter requestBody: (body) request body - parameter completion: completion handler to receive the data and the error objects */ - open class func testInlineAdditionalProperties(requestBody: [String:String], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { - testInlineAdditionalPropertiesWithRequestBuilder(requestBody: requestBody).execute { (response, error) -> Void in + open class func testInlineAdditionalProperties(requestBody: [String: String], completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + testInlineAdditionalPropertiesWithRequestBuilder(requestBody: requestBody).execute { (_, error) -> Void in if error == nil { completion((), error) } else { @@ -468,14 +457,13 @@ open class FakeAPI { } } - /** test inline additionalProperties - POST /fake/inline-additionalProperties - - parameter requestBody: (body) request body - - returns: RequestBuilder + - parameter requestBody: (body) request body + - returns: RequestBuilder */ - open class func testInlineAdditionalPropertiesWithRequestBuilder(requestBody: [String:String]) -> RequestBuilder { + open class func testInlineAdditionalPropertiesWithRequestBuilder(requestBody: [String: String]) -> RequestBuilder { let path = "/fake/inline-additionalProperties" let URLString = PetstoreClientAPI.basePath + path let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: requestBody) @@ -489,13 +477,13 @@ open class FakeAPI { /** test json serialization of form data - - - parameter param: (form) field1 - - parameter param2: (form) field2 + + - 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 { (response, error) -> Void in + 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 { @@ -504,30 +492,28 @@ open class FakeAPI { } } - /** test json serialization of form data - GET /fake/jsonFormData - - parameter param: (form) field1 - - parameter param2: (form) field2 - - returns: RequestBuilder + - 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?] = [ + let formParams: [String: Any?] = [ "param": param, - "param2": param2 + "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/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/FakeClassnameTags123API.swift index 8bb79ddd28f..43fb8dec518 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 @@ -5,34 +5,31 @@ // https://openapi-generator.tech // -import Foundation import Alamofire - - +import Foundation open class FakeClassnameTags123API { /** To test class name in snake case - - - parameter client: (body) client model + + - parameter client: (body) client model - parameter completion: completion handler to receive the data and the error objects */ - open class func testClassname(client: Client, completion: @escaping ((_ data: Client?,_ error: Error?) -> Void)) { + open class func testClassname(client: Client, completion: @escaping ((_ data: Client?, _ error: Error?) -> Void)) { testClassnameWithRequestBuilder(client: client).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 client: (body) client model - - returns: RequestBuilder + - type: apiKey api_key_query (QUERY) + - name: api_key_query + - parameter client: (body) client model + - returns: RequestBuilder */ open class func testClassnameWithRequestBuilder(client: Client) -> RequestBuilder { let path = "/fake_classname_test" @@ -45,5 +42,4 @@ open class FakeClassnameTags123API { return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) } - } 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 266ac7c402b..b975c79c1b6 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 @@ -5,20 +5,18 @@ // https://openapi-generator.tech // -import Foundation import Alamofire - - +import Foundation open class PetAPI { /** Add a new pet to the store - - - parameter pet: (body) Pet object that needs to be added to the store + + - parameter pet: (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(pet: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { - addPetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in + open class func addPet(pet: Pet, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + addPetWithRequestBuilder(pet: pet).execute { (_, error) -> Void in if error == nil { completion((), error) } else { @@ -27,15 +25,14 @@ open class PetAPI { } } - /** Add a new pet to the store - POST /pet - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter pet: (body) Pet object that needs to be added to the store - - returns: RequestBuilder + - type: oauth2 + - name: petstore_auth + - parameter pet: (body) Pet object that needs to be added to the store + - returns: RequestBuilder */ open class func addPetWithRequestBuilder(pet: Pet) -> RequestBuilder { let path = "/pet" @@ -51,13 +48,13 @@ open class PetAPI { /** Deletes a pet - - - parameter petId: (path) Pet id to delete + + - 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 { (response, error) -> Void in + 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 { @@ -66,16 +63,15 @@ open class PetAPI { } } - /** Deletes a pet - DELETE /pet/{petId} - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) Pet id to delete + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) Pet id to delete - parameter apiKey: (header) (optional) - - returns: RequestBuilder + - returns: RequestBuilder */ open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder { var path = "/pet/{petId}" @@ -83,11 +79,11 @@ open class PetAPI { 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 parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let nillableHeaders: [String: Any?] = [ - "api_key": apiKey + "api_key": apiKey, ] let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) @@ -100,42 +96,41 @@ open class PetAPI { * enum for parameter status */ public enum Status_findPetsByStatus: String { - case available = "available" - case pending = "pending" - case sold = "sold" + case available + case pending + case sold } /** Finds Pets by status - - - parameter status: (query) Status values that need to be considered for filter + + - 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)) { + 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 - 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]> + - 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 - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "status": status + "status": status, ]) let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -145,35 +140,34 @@ open class PetAPI { /** Finds Pets by tags - - - parameter tags: (query) Tags to filter by + + - 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)) { + 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 - 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]> + - 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 - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "tags": tags + "tags": tags, ]) let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -183,26 +177,25 @@ open class PetAPI { /** Find pet by ID - - - parameter petId: (path) ID of pet to return + + - 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)) { + 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 - 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 + - 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}" @@ -210,8 +203,8 @@ open class PetAPI { 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 parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -221,12 +214,12 @@ open class PetAPI { /** Update an existing pet - - - parameter pet: (body) Pet object that needs to be added to the store + + - parameter pet: (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(pet: Pet, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { - updatePetWithRequestBuilder(pet: pet).execute { (response, error) -> Void in + open class func updatePet(pet: Pet, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + updatePetWithRequestBuilder(pet: pet).execute { (_, error) -> Void in if error == nil { completion((), error) } else { @@ -235,15 +228,14 @@ open class PetAPI { } } - /** Update an existing pet - PUT /pet - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter pet: (body) Pet object that needs to be added to the store - - returns: RequestBuilder + - type: oauth2 + - name: petstore_auth + - parameter pet: (body) Pet object that needs to be added to the store + - returns: RequestBuilder */ open class func updatePetWithRequestBuilder(pet: Pet) -> RequestBuilder { let path = "/pet" @@ -259,14 +251,14 @@ open class PetAPI { /** Updates a pet in the store with form data - - - parameter petId: (path) ID of pet that needs to be updated + + - 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 { (response, error) -> Void in + 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 { @@ -275,17 +267,16 @@ open class PetAPI { } } - /** 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 + - 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 + - returns: RequestBuilder */ open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder { var path = "/pet/{petId}" @@ -293,14 +284,14 @@ open class PetAPI { 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?] = [ + let formParams: [String: Any?] = [ "name": name, - "status": status + "status": status, ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -310,29 +301,28 @@ open class PetAPI { /** uploads an image - - - parameter petId: (path) ID of pet to update + + - 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)) { + 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 - POST /pet/{petId}/uploadImage - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update + - 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 + - returns: RequestBuilder */ open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder { var path = "/pet/{petId}/uploadImage" @@ -340,14 +330,14 @@ open class PetAPI { 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?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata, - "file": file + "file": file, ] let nonNullParameters = APIHelper.rejectNil(formParams) let parameters = APIHelper.convertBoolToString(nonNullParameters) - + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -357,29 +347,28 @@ open class PetAPI { /** uploads an image (required) - - - parameter petId: (path) ID of pet to update - - parameter requiredFile: (form) file to upload + + - 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)) { + 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) - POST /fake/{petId}/uploadImageWithRequiredFile - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter requiredFile: (form) file to upload + - 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 + - returns: RequestBuilder */ open class func uploadFileWithRequiredFileWithRequestBuilder(petId: Int64, requiredFile: URL, additionalMetadata: String? = nil) -> RequestBuilder { var path = "/fake/{petId}/uploadImageWithRequiredFile" @@ -387,19 +376,18 @@ open class PetAPI { 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?] = [ + let formParams: [String: Any?] = [ "additionalMetadata": additionalMetadata, - "requiredFile": requiredFile + "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/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/APIs/StoreAPI.swift index 920eff9816b..8e749634af3 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 @@ -5,20 +5,18 @@ // https://openapi-generator.tech // -import Foundation import Alamofire - - +import Foundation open class StoreAPI { /** Delete purchase order by ID - - - parameter orderId: (path) ID of the order that needs to be deleted + + - 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 { (response, error) -> Void in + 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 { @@ -27,13 +25,12 @@ open class StoreAPI { } } - /** 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 + - 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}" @@ -41,8 +38,8 @@ open class StoreAPI { 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 parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -52,56 +49,54 @@ open class StoreAPI { /** 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)) { + 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 - GET /store/inventory - Returns a map of status codes to quantities - API Key: - - type: apiKey api_key - - name: api_key - - returns: RequestBuilder<[String:Int]> + - type: apiKey api_key + - name: api_key + - returns: RequestBuilder<[String:Int]> */ - open class func getInventoryWithRequestBuilder() -> 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 parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) - let requestBuilder: RequestBuilder<[String:Int]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + 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 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)) { + 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 - 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 + - 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}" @@ -109,8 +104,8 @@ open class StoreAPI { 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 parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -120,22 +115,21 @@ open class StoreAPI { /** Place an order for a pet - - - parameter order: (body) order placed for purchasing the pet + + - parameter order: (body) order placed for purchasing the pet - parameter completion: completion handler to receive the data and the error objects */ - open class func placeOrder(order: Order, completion: @escaping ((_ data: Order?,_ error: Error?) -> Void)) { + open class func placeOrder(order: Order, completion: @escaping ((_ data: Order?, _ error: Error?) -> Void)) { placeOrderWithRequestBuilder(order: order).execute { (response, error) -> Void in completion(response?.body, error) } } - /** Place an order for a pet - POST /store/order - - parameter order: (body) order placed for purchasing the pet - - returns: RequestBuilder + - parameter order: (body) order placed for purchasing the pet + - returns: RequestBuilder */ open class func placeOrderWithRequestBuilder(order: Order) -> RequestBuilder { let path = "/store/order" @@ -148,5 +142,4 @@ open class StoreAPI { return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) } - } 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 e9457fc88a6..7a629ee75a2 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 @@ -5,20 +5,18 @@ // https://openapi-generator.tech // -import Foundation import Alamofire - - +import Foundation open class UserAPI { /** Create user - - - parameter user: (body) Created user object + + - parameter user: (body) Created user object - parameter completion: completion handler to receive the data and the error objects */ - open class func createUser(user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { - createUserWithRequestBuilder(user: user).execute { (response, error) -> Void in + open class func createUser(user: User, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + createUserWithRequestBuilder(user: user).execute { (_, error) -> Void in if error == nil { completion((), error) } else { @@ -27,13 +25,12 @@ open class UserAPI { } } - /** Create user - POST /user - This can only be done by the logged in user. - - parameter user: (body) Created user object - - returns: RequestBuilder + - parameter user: (body) Created user object + - returns: RequestBuilder */ open class func createUserWithRequestBuilder(user: User) -> RequestBuilder { let path = "/user" @@ -49,12 +46,12 @@ open class UserAPI { /** Creates list of users with given input array - - - parameter user: (body) List of user object + + - parameter user: (body) List of user object - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithArrayInput(user: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { - createUsersWithArrayInputWithRequestBuilder(user: user).execute { (response, error) -> Void in + open class func createUsersWithArrayInput(user: [User], completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + createUsersWithArrayInputWithRequestBuilder(user: user).execute { (_, error) -> Void in if error == nil { completion((), error) } else { @@ -63,12 +60,11 @@ open class UserAPI { } } - /** Creates list of users with given input array - POST /user/createWithArray - - parameter user: (body) List of user object - - returns: RequestBuilder + - parameter user: (body) List of user object + - returns: RequestBuilder */ open class func createUsersWithArrayInputWithRequestBuilder(user: [User]) -> RequestBuilder { let path = "/user/createWithArray" @@ -84,12 +80,12 @@ open class UserAPI { /** Creates list of users with given input array - - - parameter user: (body) List of user object + + - parameter user: (body) List of user object - parameter completion: completion handler to receive the data and the error objects */ - open class func createUsersWithListInput(user: [User], completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { - createUsersWithListInputWithRequestBuilder(user: user).execute { (response, error) -> Void in + open class func createUsersWithListInput(user: [User], completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + createUsersWithListInputWithRequestBuilder(user: user).execute { (_, error) -> Void in if error == nil { completion((), error) } else { @@ -98,12 +94,11 @@ open class UserAPI { } } - /** Creates list of users with given input array - POST /user/createWithList - - parameter user: (body) List of user object - - returns: RequestBuilder + - parameter user: (body) List of user object + - returns: RequestBuilder */ open class func createUsersWithListInputWithRequestBuilder(user: [User]) -> RequestBuilder { let path = "/user/createWithList" @@ -119,12 +114,12 @@ open class UserAPI { /** Delete user - - - parameter username: (path) The name that needs to be deleted + + - 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 { (response, error) -> Void in + 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 { @@ -133,13 +128,12 @@ open class UserAPI { } } - /** 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 + - parameter username: (path) The name that needs to be deleted + - returns: RequestBuilder */ open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder { var path = "/user/{username}" @@ -147,8 +141,8 @@ open class UserAPI { 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 parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -158,22 +152,21 @@ open class UserAPI { /** Get user by user name - - - parameter username: (path) The name that needs to be fetched. Use user1 for testing. + + - 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)) { + 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 - GET /user/{username} - - parameter username: (path) The name that needs to be fetched. Use user1 for testing. - - returns: RequestBuilder + - 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}" @@ -181,8 +174,8 @@ open class UserAPI { 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 parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -192,35 +185,34 @@ open class UserAPI { /** Logs user into the system - - - parameter username: (query) The user name for login - - parameter password: (query) The password for login in clear text + + - 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)) { + 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 - 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 + - 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 - + let parameters: [String: Any]? = nil + var url = URLComponents(string: URLString) url?.queryItems = APIHelper.mapValuesToQueryItems([ - "username": username, - "password": password + "username": username, + "password": password, ]) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() @@ -230,11 +222,11 @@ open class UserAPI { /** 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 { (response, error) -> Void in + open class func logoutUser(completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + logoutUserWithRequestBuilder().execute { (_, error) -> Void in if error == nil { completion((), error) } else { @@ -243,17 +235,16 @@ open class UserAPI { } } - /** Logs out current logged in user session - GET /user/logout - - returns: RequestBuilder + - returns: RequestBuilder */ open class func logoutUserWithRequestBuilder() -> RequestBuilder { let path = "/user/logout" let URLString = PetstoreClientAPI.basePath + path - let parameters: [String:Any]? = nil - + let parameters: [String: Any]? = nil + let url = URLComponents(string: URLString) let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getNonDecodableBuilder() @@ -263,13 +254,13 @@ open class UserAPI { /** Updated user - - - parameter username: (path) name that need to be deleted - - parameter user: (body) Updated user object + + - parameter username: (path) name that need to be deleted + - parameter user: (body) Updated user object - parameter completion: completion handler to receive the data and the error objects */ - open class func updateUser(username: String, user: User, completion: @escaping ((_ data: Void?,_ error: Error?) -> Void)) { - updateUserWithRequestBuilder(username: username, user: user).execute { (response, error) -> Void in + open class func updateUser(username: String, user: User, completion: @escaping ((_ data: Void?, _ error: Error?) -> Void)) { + updateUserWithRequestBuilder(username: username, user: user).execute { (_, error) -> Void in if error == nil { completion((), error) } else { @@ -278,14 +269,13 @@ open class UserAPI { } } - /** 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 user: (body) Updated user object - - returns: RequestBuilder + - parameter username: (path) name that need to be deleted + - parameter user: (body) Updated user object + - returns: RequestBuilder */ open class func updateUserWithRequestBuilder(username: String, user: User) -> RequestBuilder { var path = "/user/{username}" @@ -301,5 +291,4 @@ open class UserAPI { return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) } - } 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 2ade78f5a61..9ac32d699a1 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -4,53 +4,52 @@ // https://openapi-generator.tech // -import Foundation import Alamofire +import Foundation class AlamofireRequestBuilderFactory: RequestBuilderFactory { func getNonDecodableBuilder() -> RequestBuilder.Type { return AlamofireRequestBuilder.self } - func getBuilder() -> RequestBuilder.Type { + 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 + ) - 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? - public subscript(key: K) -> V? { - get { - var value: V? + queue.sync { + value = self.dictionary[key] + } - queue.sync { - value = self.dictionary[key] - } - - return value - } - set { - queue.sync(flags: DispatchWorkItemFlags.barrier) { - self.dictionary[key] = newValue - } - } - } - } + 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] = [:]) { + public required 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) } @@ -71,7 +70,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? { + open func contentTypeForFormPart(fileURL _: URL) -> String? { return nil } @@ -79,21 +78,21 @@ 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 { + 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 + open override 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 encoding: ParameterEncoding = isBody ? JSONDataEncoding() : URLEncoding() let xMethod = Alamofire.HTTPMethod(rawValue: method) let fileKeys = parameters == nil ? [] : parameters!.filter { $1 is NSURL } - .map { $0.0 } + .map { $0.0 } if fileKeys.count > 0 { manager.upload(multipartFormData: { mpForm in @@ -102,8 +101,7 @@ open class AlamofireRequestBuilder: RequestBuilder { case let fileURL as URL: if let mimeType = self.contentTypeForFormPart(fileURL: fileURL) { mpForm.append(fileURL, withName: k, fileName: fileURL.lastPathComponent, mimeType: mimeType) - } - else { + } else { mpForm.append(fileURL, withName: k) } case let string as String: @@ -114,14 +112,14 @@ open class AlamofireRequestBuilder: RequestBuilder { fatalError("Unprocessable value \(v) with key \(k)") } } - }, to: URLString, method: xMethod!, headers: nil, encodingCompletion: { encodingResult in + }, 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): + case let .failure(encodingError): completion(nil, ErrorResponse.error(415, nil, encodingError)) } }) @@ -132,7 +130,6 @@ open class AlamofireRequestBuilder: RequestBuilder { } processRequest(request: request, managerId, completion) } - } fileprivate func processRequest(request: DataRequest, _ managerId: String, _ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { @@ -148,7 +145,7 @@ open class AlamofireRequestBuilder: RequestBuilder { switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(completionHandler: { stringResponse in cleanupRequest() if stringResponse.result.isFailure { @@ -168,11 +165,10 @@ open class AlamofireRequestBuilder: RequestBuilder { ) }) case is URL.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(completionHandler: { dataResponse in cleanupRequest() do { - guard !dataResponse.result.isFailure else { throw DownloadException.responseFailed } @@ -218,7 +214,7 @@ open class AlamofireRequestBuilder: RequestBuilder { return }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(completionHandler: { voidResponse in cleanupRequest() if voidResponse.result.isFailure { @@ -232,12 +228,13 @@ open class AlamofireRequestBuilder: RequestBuilder { completion( Response( response: voidResponse.response!, - body: nil), + body: nil + ), nil ) }) default: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(completionHandler: { dataResponse in cleanupRequest() if dataResponse.result.isFailure { @@ -261,24 +258,22 @@ open class AlamofireRequestBuilder: RequestBuilder { open func buildHeaders() -> [String: String] { var httpHeaders = SessionManager.defaultHTTPHeaders - for (key, value) in self.headers { + for (key, value) in headers { httpHeaders[key] = value } return httpHeaders } - fileprivate func getFileName(fromContentDisposition contentDisposition : String?) -> String? { - + fileprivate func getFileName(fromContentDisposition contentDisposition: String?) -> String? { guard let contentDisposition = contentDisposition else { return nil } let items = contentDisposition.components(separatedBy: ";") - var filename : String? = nil + var filename: String? for contentItem in items { - let filenameKey = "filename=" guard let range = contentItem.range(of: filenameKey) else { break @@ -286,17 +281,15 @@ open class AlamofireRequestBuilder: RequestBuilder { filename = contentItem return filename? - .replacingCharacters(in: range, with:"") + .replacingCharacters(in: range, with: "") .replacingOccurrences(of: "\"", with: "") .trimmingCharacters(in: .whitespacesAndNewlines) } return filename - } - fileprivate func getPath(from url : URL) throws -> String { - + fileprivate func getPath(from url: URL) throws -> String { guard var path = URLComponents(url: url, resolvingAgainstBaseURL: true)?.path else { throw DownloadException.requestMissingPath } @@ -306,21 +299,18 @@ open class AlamofireRequestBuilder: RequestBuilder { } return path - } - fileprivate func getURL(from urlRequest : URLRequest) throws -> URL { - + fileprivate func getURL(from urlRequest: URLRequest) throws -> URL { guard let url = urlRequest.url else { throw DownloadException.requestMissingURL } return url } - } -fileprivate enum DownloadException : Error { +fileprivate enum DownloadException: Error { case responseDataMissing case responseFailed case requestMissing @@ -335,9 +325,8 @@ public enum AlamofireDecodableRequestBuilderError: Error { case generalError(Error) } -open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder { - - override fileprivate func processRequest(request: DataRequest, _ managerId: String, _ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { +open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilder { + fileprivate override func processRequest(request: DataRequest, _ managerId: String, _ completion: @escaping (_ response: Response?, _ error: Error?) -> Void) { if let credential = self.credential { request.authenticate(usingCredential: credential) } @@ -350,7 +339,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde switch T.self { case is String.Type: - validatedRequest.responseString(completionHandler: { (stringResponse) in + validatedRequest.responseString(completionHandler: { stringResponse in cleanupRequest() if stringResponse.result.isFailure { @@ -370,7 +359,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde ) }) case is Void.Type: - validatedRequest.responseData(completionHandler: { (voidResponse) in + validatedRequest.responseData(completionHandler: { voidResponse in cleanupRequest() if voidResponse.result.isFailure { @@ -384,12 +373,13 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde completion( Response( response: voidResponse.response!, - body: nil), + body: nil + ), nil ) }) case is Data.Type: - validatedRequest.responseData(completionHandler: { (dataResponse) in + validatedRequest.responseData(completionHandler: { dataResponse in cleanupRequest() if dataResponse.result.isFailure { @@ -427,7 +417,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde return } - var responseObj: Response? = nil + var responseObj: Response? let decodeResult: (decodableObj: T?, error: Error?) = CodableHelper.decode(T.self, from: data) if decodeResult.error == nil { @@ -438,5 +428,4 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde }) } } - } diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 2d50e463ae1..7585573b8a9 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -10,10 +10,9 @@ import Foundation public typealias EncodeResult = (data: Data?, error: Error?) open class CodableHelper { - open static var dateformatter: DateFormatter? - open class func decode(_ type: T.Type, from data: Data) -> (decodableObj: T?, error: Error?) where T : Decodable { + open 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,21 +38,25 @@ open class CodableHelper { return (returnedDecodable, returnedError) } - open class func encode(_ value: T, prettyPrint: Bool = false) -> EncodeResult where T : Encodable { + open class func encode(_ value: T, prettyPrint: Bool = false) -> EncodeResult where T: Encodable { var returnedData: Data? - var returnedError: Error? = nil + var returnedError: Error? let encoder = JSONEncoder() if prettyPrint { encoder.outputFormatting = .prettyPrinted } - 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 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" - encoder.dateEncodingStrategy = .formatted(formatter) + 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 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" + encoder.dateEncodingStrategy = .formatted(formatter) + } do { returnedData = try encoder.encode(value) @@ -63,5 +66,4 @@ open class CodableHelper { return (returnedData, returnedError) } - } diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift index f8180752b67..81fd74f6748 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Configuration.swift @@ -7,9 +7,7 @@ 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. + // 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. open static var dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" - -} \ No newline at end of file +} 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 abe218b4e7a..e2f17a6cb86 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Extensions.swift @@ -4,8 +4,8 @@ // https://openapi-generator.tech // -import Foundation import Alamofire +import Foundation extension Bool: JSONEncodable { func encodeToJSON() -> Any { return self as Any } @@ -45,7 +45,7 @@ private func encodeIfPossible(_ object: T) -> Any { extension Array: JSONEncodable { func encodeToJSON() -> Any { - return self.map(encodeIfPossible) + return map(encodeIfPossible) } } @@ -61,7 +61,7 @@ extension Dictionary: JSONEncodable { extension Data: JSONEncodable { func encodeToJSON() -> Any { - return self.base64EncodedString(options: Data.Base64EncodingOptions()) + return base64EncodedString(options: Data.Base64EncodingOptions()) } } @@ -80,12 +80,11 @@ extension Date: JSONEncodable { extension UUID: JSONEncodable { func encodeToJSON() -> Any { - return self.uuidString + return uuidString } } extension String: CodingKey { - public var stringValue: String { return self } @@ -98,42 +97,38 @@ extension String: CodingKey { return nil } - public init?(intValue: Int) { + public init?(intValue _: Int) { return nil } - } extension KeyedEncodingContainerProtocol { - - public mutating func encodeArray(_ values: [T], forKey key: Self.Key) throws where T : Encodable { + 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 { + 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 { + 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 { + 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 { + public func decodeArray(_: T.Type, forKey key: Self.Key) throws -> [T] where T: Decodable { var tmpArray = [T]() var nestedContainer = try nestedUnkeyedContainer(forKey: key) @@ -145,7 +140,7 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeArrayIfPresent(_ type: T.Type, forKey key: Self.Key) throws -> [T]? where T : Decodable { + public func decodeArrayIfPresent(_: T.Type, forKey key: Self.Key) throws -> [T]? where T: Decodable { var tmpArray: [T]? = nil if contains(key) { @@ -155,8 +150,8 @@ extension KeyedDecodingContainerProtocol { return tmpArray } - public func decodeMap(_ type: T.Type, excludedKeys: Set) throws -> [Self.Key: T] where T : Decodable { - var map: [Self.Key : T] = [:] + public func decodeMap(_: T.Type, excludedKeys: Set) throws -> [Self.Key: T] where T: Decodable { + var map: [Self.Key: T] = [:] for key in allKeys { if !excludedKeys.contains(key) { @@ -167,7 +162,4 @@ extension KeyedDecodingContainerProtocol { return map } - } - - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/JSONEncodableEncoding.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/JSONEncodableEncoding.swift index ca05906d420..9d59bd8b764 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/JSONEncodableEncoding.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/JSONEncodableEncoding.swift @@ -5,11 +5,10 @@ // https://openapi-generator.tech // -import Foundation import Alamofire +import Foundation public struct JSONDataEncoding: ParameterEncoding { - // MARK: Properties private static let jsonDataKey = "jsonData" @@ -42,7 +41,7 @@ public struct JSONDataEncoding: ParameterEncoding { } public static func encodingParameters(jsonData: Data?) -> Parameters? { - var returnedParams: Parameters? = nil + var returnedParams: Parameters? if let jsonData = jsonData, !jsonData.isEmpty { var params = Parameters() params[jsonDataKey] = jsonData @@ -50,5 +49,4 @@ public struct JSONDataEncoding: ParameterEncoding { } return returnedParams } - } diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift index 70449515842..7a9c6a33803 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/JSONEncodingHelper.swift @@ -5,13 +5,12 @@ // https://openapi-generator.tech // -import Foundation import Alamofire +import Foundation open class JSONEncodingHelper { - - open class func encodingParameters(forEncodableObject encodableObj: T?) -> Parameters? { - var params: Parameters? = nil + open class func encodingParameters(forEncodableObject encodableObj: T?) -> Parameters? { + var params: Parameters? // Encode the Encodable object if let encodableObj = encodableObj { @@ -25,7 +24,7 @@ open class JSONEncodingHelper { } open class func encodingParameters(forEncodableObject encodableObj: Any?) -> Parameters? { - var params: Parameters? = nil + var params: Parameters? if let encodableObj = encodableObj { do { @@ -39,5 +38,4 @@ open class JSONEncodingHelper { return params } - } diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models.swift index 42f8186ae4a..9d4101c3cd4 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models.swift @@ -10,7 +10,7 @@ protocol JSONEncodable { func encodeToJSON() -> Any } -public enum ErrorResponse : Error { +public enum ErrorResponse: Error { case error(Int, Data?, Error) } @@ -27,7 +27,7 @@ open class Response { public convenience init(response: HTTPURLResponse, body: T?) { let rawHeader = response.allHeaderFields - var header = [String:String]() + var header = [String: String]() for case let (key, value) as (String, String) in rawHeader { header[key] = value } diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift index 4e018486ad7..7e770e93db1 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AdditionalPropertiesClass.swift @@ -7,23 +7,17 @@ import Foundation - - public struct AdditionalPropertiesClass: Codable { + public var mapProperty: [String: String]? + public var mapOfMapProperty: [String: [String: String]]? - public var mapProperty: [String:String]? - public var mapOfMapProperty: [String:[String:String]]? - - public init(mapProperty: [String:String]?, mapOfMapProperty: [String:[String:String]]?) { + public init(mapProperty: [String: String]?, mapOfMapProperty: [String: [String: String]]?) { self.mapProperty = mapProperty self.mapOfMapProperty = mapOfMapProperty } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case mapProperty = "map_property" case mapOfMapProperty = "map_of_map_property" } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift index 7221a1be099..7512bbb43cf 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Animal.swift @@ -7,10 +7,7 @@ import Foundation - - public struct Animal: Codable { - public var className: String public var color: String? = "red" @@ -18,7 +15,4 @@ public struct Animal: Codable { self.className = className self.color = color } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift index e7bea63f8ed..e09b0e9efdc 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/AnimalFarm.swift @@ -7,5 +7,4 @@ import Foundation - public typealias AnimalFarm = [Animal] diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift index a22e9aaebbb..0b3b089649e 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ApiResponse.swift @@ -7,10 +7,7 @@ import Foundation - - public struct ApiResponse: Codable { - public var code: Int? public var type: String? public var message: String? @@ -20,7 +17,4 @@ public struct ApiResponse: Codable { self.type = type self.message = message } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift index 4e5a5ca1445..e495772674a 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfArrayOfNumberOnly.swift @@ -7,20 +7,14 @@ import Foundation - - public struct ArrayOfArrayOfNumberOnly: Codable { - public var arrayArrayNumber: [[Double]]? public init(arrayArrayNumber: [[Double]]?) { self.arrayArrayNumber = arrayArrayNumber } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case arrayArrayNumber = "ArrayArrayNumber" } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift index 7d059d36833..2621da38aa0 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayOfNumberOnly.swift @@ -7,20 +7,14 @@ import Foundation - - public struct ArrayOfNumberOnly: Codable { - public var arrayNumber: [Double]? public init(arrayNumber: [Double]?) { self.arrayNumber = arrayNumber } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case arrayNumber = "ArrayNumber" } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift index 9c56fed50c2..f185b9dc3e3 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ArrayTest.swift @@ -7,10 +7,7 @@ import Foundation - - public struct ArrayTest: Codable { - public var arrayOfString: [String]? public var arrayArrayOfInteger: [[Int64]]? public var arrayArrayOfModel: [[ReadOnlyFirst]]? @@ -21,12 +18,9 @@ public struct ArrayTest: Codable { self.arrayArrayOfModel = arrayArrayOfModel } - public enum CodingKeys: String, CodingKey { + 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/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift index 98cda23dac9..b56ad455668 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Capitalization.swift @@ -7,10 +7,7 @@ import Foundation - - public struct Capitalization: Codable { - public var smallCamel: String? public var capitalCamel: String? public var smallSnake: String? @@ -28,7 +25,7 @@ public struct Capitalization: Codable { self.ATT_NAME = ATT_NAME } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case smallCamel case capitalCamel = "CapitalCamel" case smallSnake = "small_Snake" @@ -36,7 +33,4 @@ public struct Capitalization: Codable { case sCAETHFlowPoints = "SCA_ETH_Flow_Points" case ATT_NAME } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift index a116d964ea8..df496298f0c 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Cat.swift @@ -7,10 +7,7 @@ import Foundation - - public struct Cat: Codable { - public var className: String public var color: String? = "red" public var declawed: Bool? @@ -20,7 +17,4 @@ public struct Cat: Codable { self.color = color self.declawed = declawed } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift index 77fba95c1d7..7a5bc6d6c1c 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Category.swift @@ -7,10 +7,7 @@ import Foundation - - public struct Category: Codable { - public var _id: Int64? public var name: String? @@ -19,11 +16,8 @@ public struct Category: Codable { self.name = name } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case _id = "id" case name } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift index f673ed127cd..48c4a01e597 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ClassModel.swift @@ -7,17 +7,12 @@ 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/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift index 51390b6c4ea..07d1e7155af 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Client.swift @@ -7,16 +7,10 @@ import Foundation - - public struct Client: Codable { - public var client: String? public init(client: String?) { self.client = client } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift index 239ce74dcc2..e92c098dcc7 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Dog.swift @@ -7,10 +7,7 @@ import Foundation - - public struct Dog: Codable { - public var className: String public var color: String? = "red" public var breed: String? @@ -20,7 +17,4 @@ public struct Dog: Codable { self.color = color self.breed = breed } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift index 8713961520e..975174f10c2 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/EnumArrays.swift @@ -7,18 +7,17 @@ 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" + case fish + case crab } + public var justSymbol: JustSymbol? public var arrayEnum: [ArrayEnum]? @@ -27,11 +26,8 @@ public struct EnumArrays: Codable { self.arrayEnum = arrayEnum } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case justSymbol = "just_symbol" case arrayEnum = "array_enum" } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift index 7280a621fec..3c1dfcac577 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/EnumClass.swift @@ -7,7 +7,6 @@ import Foundation - public enum EnumClass: String, Codable { case abc = "_abc" case efg = "-efg" diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift index 0f546c76a21..e594b59d0f0 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/EnumTest.swift @@ -7,28 +7,29 @@ import Foundation - - public struct EnumTest: Codable { - public enum EnumString: String, Codable { case upper = "UPPER" - case lower = "lower" + case lower case empty = "" } + public enum EnumStringRequired: String, Codable { case upper = "UPPER" - case lower = "lower" + case 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? @@ -43,14 +44,11 @@ public struct EnumTest: Codable { self.outerEnum = outerEnum } - public enum CodingKeys: String, CodingKey { + 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/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift index c8bd1f19589..af7980371e0 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/File.swift @@ -7,18 +7,13 @@ 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/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift index 64d02506802..582bc0c9052 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/FileSchemaTestClass.swift @@ -7,10 +7,7 @@ import Foundation - - public struct FileSchemaTestClass: Codable { - public var file: File? public var files: [File]? @@ -18,7 +15,4 @@ public struct FileSchemaTestClass: Codable { self.file = file self.files = files } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift index faa091b0658..50e1d1d08cc 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/FormatTest.swift @@ -7,10 +7,7 @@ import Foundation - - public struct FormatTest: Codable { - public var integer: Int? public var int32: Int? public var int64: Int64? @@ -40,7 +37,4 @@ public struct FormatTest: Codable { self.uuid = uuid self.password = password } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift index 554aee1081a..f25c8021038 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/HasOnlyReadOnly.swift @@ -7,10 +7,7 @@ import Foundation - - public struct HasOnlyReadOnly: Codable { - public var bar: String? public var foo: String? @@ -18,7 +15,4 @@ public struct HasOnlyReadOnly: Codable { self.bar = bar self.foo = foo } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift index 8997340ff4b..9170bca2710 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/List.swift @@ -7,20 +7,14 @@ import Foundation - - public struct List: Codable { - public var _123list: String? public init(_123list: String?) { self._123list = _123list } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case _123list = "123-list" } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift index 2d3a45d35a0..9fe75f50c48 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/MapTest.swift @@ -7,33 +7,28 @@ import Foundation - - public struct MapTest: Codable { - public enum MapOfEnumString: String, Codable { case upper = "UPPER" - case lower = "lower" + case lower } - public var mapMapOfString: [String:[String:String]]? - public var mapOfEnumString: [String:String]? - public var directMap: [String:Bool]? + + 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?) { + 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 { + 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/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift index 7116108fd7a..cd66f2e2523 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/MixedPropertiesAndAdditionalPropertiesClass.swift @@ -7,20 +7,14 @@ import Foundation - - public struct MixedPropertiesAndAdditionalPropertiesClass: Codable { - public var uuid: UUID? public var dateTime: Date? - public var map: [String:Animal]? + public var map: [String: Animal]? - public init(uuid: UUID?, dateTime: Date?, 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/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift index fc1d0606b7b..71a64598403 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Model200Response.swift @@ -7,11 +7,9 @@ import Foundation - /** Model for testing model name starting with number */ public struct Model200Response: Codable { - public var name: Int? public var _class: String? @@ -20,11 +18,8 @@ public struct Model200Response: Codable { self._class = _class } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case name case _class = "class" } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift index cc165d767d9..2e763d9cec4 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Name.swift @@ -7,11 +7,9 @@ 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? @@ -24,13 +22,10 @@ public struct Name: Codable { self._123number = _123number } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case name case snakeCase = "snake_case" case property case _123number = "123Number" } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift index e6fb206093a..e17f7f837a9 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/NumberOnly.swift @@ -7,20 +7,14 @@ import Foundation - - public struct NumberOnly: Codable { - public var justNumber: Double? public init(justNumber: Double?) { self.justNumber = justNumber } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case justNumber = "JustNumber" } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift index 5cad29458b7..5c0470d50eb 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Order.swift @@ -7,15 +7,13 @@ import Foundation - - public struct Order: Codable { - public enum Status: String, Codable { - case placed = "placed" - case approved = "approved" - case delivered = "delivered" + case placed + case approved + case delivered } + public var _id: Int64? public var petId: Int64? public var quantity: Int? @@ -33,7 +31,7 @@ public struct Order: Codable { self.complete = complete } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case _id = "id" case petId case quantity @@ -41,7 +39,4 @@ public struct Order: Codable { case status case complete } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift index edc4523d9f0..7313180b130 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/OuterComposite.swift @@ -7,10 +7,7 @@ import Foundation - - public struct OuterComposite: Codable { - public var myNumber: Double? public var myString: String? public var myBoolean: Bool? @@ -21,12 +18,9 @@ public struct OuterComposite: Codable { self.myBoolean = myBoolean } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case myNumber = "my_number" case myString = "my_string" case myBoolean = "my_boolean" } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift index bd1643d279e..f96a41a000a 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/OuterEnum.swift @@ -7,9 +7,8 @@ import Foundation - public enum OuterEnum: String, Codable { - case placed = "placed" - case approved = "approved" - case delivered = "delivered" + case placed + case approved + case delivered } diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift index 3773bf53317..a81c4de439a 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Pet.swift @@ -7,15 +7,13 @@ import Foundation - - public struct Pet: Codable { - public enum Status: String, Codable { - case available = "available" - case pending = "pending" - case sold = "sold" + case available + case pending + case sold } + public var _id: Int64? public var category: Category? public var name: String @@ -33,7 +31,7 @@ public struct Pet: Codable { self.status = status } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case _id = "id" case category case name @@ -41,7 +39,4 @@ public struct Pet: Codable { case tags case status } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift index 48b655a5b0a..79e89c2daa6 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/ReadOnlyFirst.swift @@ -7,10 +7,7 @@ import Foundation - - public struct ReadOnlyFirst: Codable { - public var bar: String? public var baz: String? @@ -18,7 +15,4 @@ public struct ReadOnlyFirst: Codable { self.bar = bar self.baz = baz } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift index de4b218999b..1a645d26967 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Return.swift @@ -7,21 +7,16 @@ 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 { + public enum CodingKeys: String, CodingKey { case _return = "return" } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift index 213d896ba98..ff2460d2019 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/SpecialModelName.swift @@ -7,20 +7,14 @@ import Foundation - - public struct SpecialModelName: Codable { - public var specialPropertyName: Int64? public init(specialPropertyName: Int64?) { self.specialPropertyName = specialPropertyName } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case specialPropertyName = "$special[property.name]" } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift index ae15e87d94b..581899343a1 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/StringBooleanMap.swift @@ -7,12 +7,8 @@ import Foundation - - public struct StringBooleanMap: Codable { - - - public var additionalProperties: [String:Bool] = [:] + public var additionalProperties: [String: Bool] = [:] public subscript(key: String) -> Bool? { get { @@ -30,7 +26,6 @@ public struct StringBooleanMap: Codable { // Encodable protocol methods public func encode(to encoder: Encoder) throws { - var container = encoder.container(keyedBy: String.self) try container.encodeMap(additionalProperties) @@ -44,8 +39,4 @@ public struct StringBooleanMap: Codable { var nonAdditionalPropertyKeys = Set() additionalProperties = try container.decodeMap(Bool.self, excludedKeys: nonAdditionalPropertyKeys) } - - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift index 20f50efd3ac..063ee1ddc3c 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/Tag.swift @@ -7,10 +7,7 @@ import Foundation - - public struct Tag: Codable { - public var _id: Int64? public var name: String? @@ -19,11 +16,8 @@ public struct Tag: Codable { self.name = name } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case _id = "id" case name } - - } - diff --git a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift index d9c564d2a1f..aba2f35accc 100644 --- a/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift +++ b/samples/client/petstore/swift4/default/PetstoreClient/Classes/OpenAPIs/Models/User.swift @@ -7,10 +7,7 @@ import Foundation - - public struct User: Codable { - public var _id: Int64? public var username: String? public var firstName: String? @@ -32,7 +29,7 @@ public struct User: Codable { self.userStatus = userStatus } - public enum CodingKeys: String, CodingKey { + public enum CodingKeys: String, CodingKey { case _id = "id" case username case firstName @@ -42,7 +39,4 @@ public struct User: Codable { case phone case userStatus } - - } - diff --git a/samples/client/petstore/swift4/objcCompatible/.openapi-generator/VERSION b/samples/client/petstore/swift4/objcCompatible/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/client/petstore/swift4/objcCompatible/.openapi-generator/VERSION +++ b/samples/client/petstore/swift4/objcCompatible/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient.podspec b/samples/client/petstore/swift4/objcCompatible/PetstoreClient.podspec index c8453cdd8e0..1ff9b50b5e0 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient.podspec +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.version = '0.0.1' - s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.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' 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 00f689db519..7dc52cc3b00 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 @@ -389,13 +389,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 .$) + - 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)) { @@ -414,13 +414,13 @@ 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 .$) + - 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 { 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 280b4e53389..2ade78f5a61 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -17,8 +17,37 @@ class AlamofireRequestBuilderFactory: RequestBuilderFactory { } } +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: [String: Alamofire.SessionManager] = [:] +private var managerStore = SynchronizedDictionary() open class AlamofireRequestBuilder: RequestBuilder { required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { @@ -112,7 +141,7 @@ open class AlamofireRequestBuilder: RequestBuilder { } let cleanupRequest = { - _ = managerStore.removeValue(forKey: managerId) + managerStore[managerId] = nil } let validatedRequest = request.validate() @@ -314,7 +343,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde } let cleanupRequest = { - _ = managerStore.removeValue(forKey: managerId) + managerStore[managerId] = nil } let validatedRequest = request.validate() diff --git a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 2d50e463ae1..bd72d81846d 100644 --- a/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift4/objcCompatible/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -47,13 +47,17 @@ open class CodableHelper { if prettyPrint { encoder.outputFormatting = .prettyPrinted } - 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 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" - encoder.dateEncodingStrategy = .formatted(formatter) + 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 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" + encoder.dateEncodingStrategy = .formatted(formatter) + } do { returnedData = try encoder.encode(value) diff --git a/samples/client/petstore/swift4/promisekit/.openapi-generator/VERSION b/samples/client/petstore/swift4/promisekit/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/client/petstore/swift4/promisekit/.openapi-generator/VERSION +++ b/samples/client/petstore/swift4/promisekit/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient.podspec b/samples/client/petstore/swift4/promisekit/PetstoreClient.podspec index 34ca76681f8..9b69b145db2 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient.podspec +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.version = '0.0.1' - s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.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' diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index b2cc5551ce0..ea2799c3411 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -534,13 +534,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 .$) + - 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)) { @@ -557,13 +557,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 .$) + - 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 { @@ -583,13 +583,13 @@ 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 .$) + - 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 { diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift index 280b4e53389..2ade78f5a61 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -17,8 +17,37 @@ class AlamofireRequestBuilderFactory: RequestBuilderFactory { } } +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: [String: Alamofire.SessionManager] = [:] +private var managerStore = SynchronizedDictionary() open class AlamofireRequestBuilder: RequestBuilder { required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { @@ -112,7 +141,7 @@ open class AlamofireRequestBuilder: RequestBuilder { } let cleanupRequest = { - _ = managerStore.removeValue(forKey: managerId) + managerStore[managerId] = nil } let validatedRequest = request.validate() @@ -314,7 +343,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde } let cleanupRequest = { - _ = managerStore.removeValue(forKey: managerId) + managerStore[managerId] = nil } let validatedRequest = request.validate() diff --git a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 2d50e463ae1..bd72d81846d 100644 --- a/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift4/promisekit/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -47,13 +47,17 @@ open class CodableHelper { if prettyPrint { encoder.outputFormatting = .prettyPrinted } - 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 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" - encoder.dateEncodingStrategy = .formatted(formatter) + 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 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" + encoder.dateEncodingStrategy = .formatted(formatter) + } do { returnedData = try encoder.encode(value) diff --git a/samples/client/petstore/swift4/rxswift/.openapi-generator/VERSION b/samples/client/petstore/swift4/rxswift/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/client/petstore/swift4/rxswift/.openapi-generator/VERSION +++ b/samples/client/petstore/swift4/rxswift/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient.podspec b/samples/client/petstore/swift4/rxswift/PetstoreClient.podspec index 5fd8bc297e7..db166a3290e 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient.podspec +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.version = '0.0.1' - s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.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' diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift index d4253fb51d0..415cdf8c231 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/APIs/FakeAPI.swift @@ -550,13 +550,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 .$) + - 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)) { @@ -573,13 +573,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 .$) + - 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 { @@ -601,13 +601,13 @@ 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 .$) + - 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 { diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift index 280b4e53389..2ade78f5a61 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -17,8 +17,37 @@ class AlamofireRequestBuilderFactory: RequestBuilderFactory { } } +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: [String: Alamofire.SessionManager] = [:] +private var managerStore = SynchronizedDictionary() open class AlamofireRequestBuilder: RequestBuilder { required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { @@ -112,7 +141,7 @@ open class AlamofireRequestBuilder: RequestBuilder { } let cleanupRequest = { - _ = managerStore.removeValue(forKey: managerId) + managerStore[managerId] = nil } let validatedRequest = request.validate() @@ -314,7 +343,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde } let cleanupRequest = { - _ = managerStore.removeValue(forKey: managerId) + managerStore[managerId] = nil } let validatedRequest = request.validate() diff --git a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 2d50e463ae1..bd72d81846d 100644 --- a/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift4/rxswift/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -47,13 +47,17 @@ open class CodableHelper { if prettyPrint { encoder.outputFormatting = .prettyPrinted } - 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 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" - encoder.dateEncodingStrategy = .formatted(formatter) + 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 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" + encoder.dateEncodingStrategy = .formatted(formatter) + } do { returnedData = try encoder.encode(value) diff --git a/samples/client/petstore/swift4/unwrapRequired/.openapi-generator/VERSION b/samples/client/petstore/swift4/unwrapRequired/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/client/petstore/swift4/unwrapRequired/.openapi-generator/VERSION +++ b/samples/client/petstore/swift4/unwrapRequired/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient.podspec b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient.podspec index c8453cdd8e0..1ff9b50b5e0 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient.podspec +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient.podspec @@ -4,7 +4,7 @@ Pod::Spec.new do |s| s.osx.deployment_target = '10.11' s.tvos.deployment_target = '9.0' s.version = '0.0.1' - s.source = { :git => 'git@github.com:openapitools/openapi-generator.git', :tag => 'v1.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' 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 00f689db519..7dc52cc3b00 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 @@ -389,13 +389,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 .$) + - 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)) { @@ -414,13 +414,13 @@ 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 .$) + - 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 { 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 280b4e53389..2ade78f5a61 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/AlamofireImplementations.swift @@ -17,8 +17,37 @@ class AlamofireRequestBuilderFactory: RequestBuilderFactory { } } +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: [String: Alamofire.SessionManager] = [:] +private var managerStore = SynchronizedDictionary() open class AlamofireRequestBuilder: RequestBuilder { required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { @@ -112,7 +141,7 @@ open class AlamofireRequestBuilder: RequestBuilder { } let cleanupRequest = { - _ = managerStore.removeValue(forKey: managerId) + managerStore[managerId] = nil } let validatedRequest = request.validate() @@ -314,7 +343,7 @@ open class AlamofireDecodableRequestBuilder: AlamofireRequestBuilde } let cleanupRequest = { - _ = managerStore.removeValue(forKey: managerId) + managerStore[managerId] = nil } let validatedRequest = request.validate() diff --git a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift index 2d50e463ae1..bd72d81846d 100644 --- a/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift +++ b/samples/client/petstore/swift4/unwrapRequired/PetstoreClient/Classes/OpenAPIs/CodableHelper.swift @@ -47,13 +47,17 @@ open class CodableHelper { if prettyPrint { encoder.outputFormatting = .prettyPrinted } - 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 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" - encoder.dateEncodingStrategy = .formatted(formatter) + 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 = "yyyy-MM-dd'T'HH:mm:ss.SSSXXXXX" + encoder.dateEncodingStrategy = .formatted(formatter) + } do { returnedData = try encoder.encode(value) diff --git a/samples/client/petstore/typescript-angularjs/.openapi-generator/VERSION b/samples/client/petstore/typescript-angularjs/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/client/petstore/typescript-angularjs/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript-angularjs/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-aurelia/default/.openapi-generator/VERSION b/samples/client/petstore/typescript-aurelia/default/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/client/petstore/typescript-aurelia/default/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript-aurelia/default/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/default/.gitignore b/samples/client/petstore/typescript-axios/builds/default/.gitignore new file mode 100644 index 00000000000..35e2fb2b02e --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/default/.gitignore @@ -0,0 +1,3 @@ +wwwroot/*.js +node_modules +typings diff --git a/samples/client/petstore/typescript-axios/builds/default/.openapi-generator-ignore b/samples/client/petstore/typescript-axios/builds/default/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/default/.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/typescript-axios/builds/default/.openapi-generator/VERSION b/samples/client/petstore/typescript-axios/builds/default/.openapi-generator/VERSION new file mode 100644 index 00000000000..c791c986fbb --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/default/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/default/api.ts b/samples/client/petstore/typescript-axios/builds/default/api.ts new file mode 100644 index 00000000000..0bac23ab041 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/default/api.ts @@ -0,0 +1,1962 @@ +// tslint:disable +/// +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as url from "url"; +import { Configuration } from "./configuration"; +import axios, { AxiosPromise } from 'axios'; + +const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} + +/** + * Describes the result of uploading an image resource + * @export + * @interface ApiResponse + */ +export interface ApiResponse { + /** + * + * @type {number} + * @memberof ApiResponse + */ + code?: number; + /** + * + * @type {string} + * @memberof ApiResponse + */ + type?: string; + /** + * + * @type {string} + * @memberof ApiResponse + */ + message?: string; +} + +/** + * A category for a pet + * @export + * @interface Category + */ +export interface Category { + /** + * + * @type {number} + * @memberof Category + */ + id?: number; + /** + * + * @type {string} + * @memberof Category + */ + name?: string; +} + +/** + * An order for a pets from the pet store + * @export + * @interface Order + */ +export interface Order { + /** + * + * @type {number} + * @memberof Order + */ + id?: number; + /** + * + * @type {number} + * @memberof Order + */ + petId?: number; + /** + * + * @type {number} + * @memberof Order + */ + quantity?: number; + /** + * + * @type {Date} + * @memberof Order + */ + shipDate?: Date; + /** + * Order Status + * @type {string} + * @memberof Order + */ + status?: Order.StatusEnum; + /** + * + * @type {boolean} + * @memberof Order + */ + complete?: boolean; +} + +/** + * @export + * @namespace Order + */ +export namespace Order { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' + } +} + +/** + * A pet for sale in the pet store + * @export + * @interface Pet + */ +export interface Pet { + /** + * + * @type {number} + * @memberof Pet + */ + id?: number; + /** + * + * @type {Category} + * @memberof Pet + */ + category?: Category; + /** + * + * @type {string} + * @memberof Pet + */ + name: string; + /** + * + * @type {Array} + * @memberof Pet + */ + photoUrls: Array; + /** + * + * @type {Array} + * @memberof Pet + */ + tags?: Array; + /** + * pet status in the store + * @type {string} + * @memberof Pet + */ + status?: Pet.StatusEnum; +} + +/** + * @export + * @namespace Pet + */ +export namespace Pet { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Available = 'available', + Pending = 'pending', + Sold = 'sold' + } +} + +/** + * A tag for a pet + * @export + * @interface Tag + */ +export interface Tag { + /** + * + * @type {number} + * @memberof Tag + */ + id?: number; + /** + * + * @type {string} + * @memberof Tag + */ + name?: string; +} + +/** + * A User who is purchasing from the pet store + * @export + * @interface User + */ +export interface User { + /** + * + * @type {number} + * @memberof User + */ + id?: number; + /** + * + * @type {string} + * @memberof User + */ + username?: string; + /** + * + * @type {string} + * @memberof User + */ + firstName?: string; + /** + * + * @type {string} + * @memberof User + */ + lastName?: string; + /** + * + * @type {string} + * @memberof User + */ + email?: string; + /** + * + * @type {string} + * @memberof User + */ + password?: string; + /** + * + * @type {string} + * @memberof User + */ + phone?: string; + /** + * User Status + * @type {number} + * @memberof User + */ + userStatus?: number; +} + + +/** + * PetApi - axios parameter creator + * @export + */ +export const PetApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options: any = {}): RequestArgs { + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError('pet','Required parameter pet was null or undefined when calling addPet.'); + } + const localVarPath = `/pet`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); + } + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (apiKey !== undefined && apiKey !== null) { + localVarHeaderParameter['api_key'] = String(apiKey); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options: any = {}): RequestArgs { + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); + } + const localVarPath = `/pet/findByStatus`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (status) { + localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS["csv"]); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options: any = {}): RequestArgs { + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); + } + const localVarPath = `/pet/findByTags`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (tags) { + localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS["csv"]); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); + } + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_key required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + localVarHeaderParameter["api_key"] = localVarApiKeyValue; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options: any = {}): RequestArgs { + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError('pet','Required parameter pet was null or undefined when calling updatePet.'); + } + const localVarPath = `/pet`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'PUT' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); + } + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (name !== undefined) { + localVarFormParams.set('name', name as any); + } + + if (status !== undefined) { + localVarFormParams.set('status', status as any); + } + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); + } + const localVarPath = `/pet/{petId}/uploadImage` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (additionalMetadata !== undefined) { + localVarFormParams.set('additionalMetadata', additionalMetadata as any); + } + + if (file !== undefined) { + localVarFormParams.set('file', file as any); + } + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * PetApi - functional programming interface + * @export + */ +export const PetApiFp = function(configuration?: Configuration) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(pet, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any): (basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(pet, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * PetApi - factory interface + * @export + */ +export const PetApiFactory = function (configuration?: Configuration, basePath?: string) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options?: any) { + return PetApiFp(configuration).addPet(pet, options)(basePath); + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp(configuration).deletePet(petId, apiKey, options)(basePath); + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { + return PetApiFp(configuration).findPetsByStatus(status, options)(basePath); + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any) { + return PetApiFp(configuration).findPetsByTags(tags, options)(basePath); + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any) { + return PetApiFp(configuration).getPetById(petId, options)(basePath); + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options?: any) { + return PetApiFp(configuration).updatePet(pet, options)(basePath); + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(basePath); + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(basePath); + }, + }; +}; + +/** + * PetApi - object-oriented interface + * @export + * @class PetApi + * @extends {BaseAPI} + */ +export class PetApi extends BaseAPI { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public addPet(pet: Pet, options?: any) { + return PetApiFp(this.configuration).addPet(pet, options)(this.basePath); + } + + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.basePath); + } + + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { + return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.basePath); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByTags(tags: Array, options?: any) { + return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.basePath); + } + + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public getPetById(petId: number, options?: any) { + return PetApiFp(this.configuration).getPetById(petId, options)(this.basePath); + } + + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePet(pet: Pet, options?: any) { + return PetApiFp(this.configuration).updatePet(pet, options)(this.basePath); + } + + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.basePath); + } + + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.basePath); + } + +} + +/** + * StoreApi - axios parameter creator + * @export + */ +export const StoreApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options: any = {}): RequestArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); + } + const localVarPath = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options: any = {}): RequestArgs { + const localVarPath = `/store/inventory`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_key required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + localVarHeaderParameter["api_key"] = localVarApiKeyValue; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options: any = {}): RequestArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); + } + const localVarPath = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options: any = {}): RequestArgs { + // verify required parameter 'order' is not null or undefined + if (order === null || order === undefined) { + throw new RequiredError('order','Required parameter order was null or undefined when calling placeOrder.'); + } + const localVarPath = `/store/order`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(order || {}) : (order || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * StoreApi - functional programming interface + * @export + */ +export const StoreApiFp = function(configuration?: Configuration) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any): (basePath?: string) => AxiosPromise<{ [key: string]: number; }> { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(order, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * StoreApi - factory interface + * @export + */ +export const StoreApiFactory = function (configuration?: Configuration, basePath?: string) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any) { + return StoreApiFp(configuration).deleteOrder(orderId, options)(basePath); + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any) { + return StoreApiFp(configuration).getInventory(options)(basePath); + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any) { + return StoreApiFp(configuration).getOrderById(orderId, options)(basePath); + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options?: any) { + return StoreApiFp(configuration).placeOrder(order, options)(basePath); + }, + }; +}; + +/** + * StoreApi - object-oriented interface + * @export + * @class StoreApi + * @extends {BaseAPI} + */ +export class StoreApi extends BaseAPI { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public deleteOrder(orderId: string, options?: any) { + return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.basePath); + } + + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getInventory(options?: any) { + return StoreApiFp(this.configuration).getInventory(options)(this.basePath); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getOrderById(orderId: number, options?: any) { + return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.basePath); + } + + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public placeOrder(order: Order, options?: any) { + return StoreApiFp(this.configuration).placeOrder(order, options)(this.basePath); + } + +} + +/** + * UserApi - axios parameter creator + * @export + */ +export const UserApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options: any = {}): RequestArgs { + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling createUser.'); + } + const localVarPath = `/user`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options: any = {}): RequestArgs { + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithArrayInput.'); + } + const localVarPath = `/user/createWithArray`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Array<User>" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options: any = {}): RequestArgs { + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithListInput.'); + } + const localVarPath = `/user/createWithList`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Array<User>" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); + } + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); + } + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); + } + const localVarPath = `/user/login`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (username !== undefined) { + localVarQueryParameter['username'] = username; + } + + if (password !== undefined) { + localVarQueryParameter['password'] = password; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options: any = {}): RequestArgs { + const localVarPath = `/user/logout`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); + } + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling updateUser.'); + } + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'PUT' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * UserApi - functional programming interface + * @export + */ +export const UserApiFp = function(configuration?: Configuration) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * UserApi - factory interface + * @export + */ +export const UserApiFactory = function (configuration?: Configuration, basePath?: string) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options?: any) { + return UserApiFp(configuration).createUser(user, options)(basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options?: any) { + return UserApiFp(configuration).createUsersWithArrayInput(user, options)(basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options?: any) { + return UserApiFp(configuration).createUsersWithListInput(user, options)(basePath); + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any) { + return UserApiFp(configuration).deleteUser(username, options)(basePath); + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any) { + return UserApiFp(configuration).getUserByName(username, options)(basePath); + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any) { + return UserApiFp(configuration).loginUser(username, password, options)(basePath); + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any) { + return UserApiFp(configuration).logoutUser(options)(basePath); + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options?: any) { + return UserApiFp(configuration).updateUser(username, user, options)(basePath); + }, + }; +}; + +/** + * UserApi - object-oriented interface + * @export + * @class UserApi + * @extends {BaseAPI} + */ +export class UserApi extends BaseAPI { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUser(user: User, options?: any) { + return UserApiFp(this.configuration).createUser(user, options)(this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithArrayInput(user: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithListInput(user: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.basePath); + } + + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public deleteUser(username: string, options?: any) { + return UserApiFp(this.configuration).deleteUser(username, options)(this.basePath); + } + + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public getUserByName(username: string, options?: any) { + return UserApiFp(this.configuration).getUserByName(username, options)(this.basePath); + } + + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public loginUser(username: string, password: string, options?: any) { + return UserApiFp(this.configuration).loginUser(username, password, options)(this.basePath); + } + + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public logoutUser(options?: any) { + return UserApiFp(this.configuration).logoutUser(options)(this.basePath); + } + + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public updateUser(username: string, user: User, options?: any) { + return UserApiFp(this.configuration).updateUser(username, user, options)(this.basePath); + } + +} + diff --git a/samples/client/petstore/typescript-axios/builds/default/configuration.ts b/samples/client/petstore/typescript-axios/builds/default/configuration.ts new file mode 100644 index 00000000000..5fafdac5b93 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/default/configuration.ts @@ -0,0 +1,74 @@ +// tslint:disable +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | ((name: string) => string); + username?: string; + password?: string; + accessToken?: string | ((name: string, scopes?: string[]) => string); + basePath?: string; + baseOptions?: any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | ((name: string) => string); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | ((name: string, scopes?: string[]) => string); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + } +} diff --git a/samples/client/petstore/typescript-axios/builds/default/custom.d.ts b/samples/client/petstore/typescript-axios/builds/default/custom.d.ts new file mode 100644 index 00000000000..32534cb1663 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/default/custom.d.ts @@ -0,0 +1 @@ +declare module 'url'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/default/git_push.sh b/samples/client/petstore/typescript-axios/builds/default/git_push.sh new file mode 100644 index 00000000000..188eeaea7bc --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/default/git_push.sh @@ -0,0 +1,51 @@ +#!/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" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +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://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/petstore/typescript-axios/builds/default/index.ts b/samples/client/petstore/typescript-axios/builds/default/index.ts new file mode 100644 index 00000000000..768b2ffab47 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/default/index.ts @@ -0,0 +1,16 @@ +// tslint:disable +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/.gitignore b/samples/client/petstore/typescript-axios/builds/es6-target/.gitignore new file mode 100644 index 00000000000..35e2fb2b02e --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/es6-target/.gitignore @@ -0,0 +1,3 @@ +wwwroot/*.js +node_modules +typings diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/.openapi-generator-ignore b/samples/client/petstore/typescript-axios/builds/es6-target/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/es6-target/.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/typescript-axios/builds/es6-target/.openapi-generator/VERSION b/samples/client/petstore/typescript-axios/builds/es6-target/.openapi-generator/VERSION new file mode 100644 index 00000000000..c791c986fbb --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/es6-target/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/README.md b/samples/client/petstore/typescript-axios/builds/es6-target/README.md new file mode 100644 index 00000000000..4672431c735 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/es6-target/README.md @@ -0,0 +1,45 @@ +## @swagger/typescript-axios-petstore@1.0.0 + +This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments: + +Environment +* Node.js +* Webpack +* Browserify + +Language level +* ES5 - you must have a Promises/A+ library installed +* ES6 + +Module system +* CommonJS +* ES6 module system + +It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) + +### Building + +To build and compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### Publishing + +First build the package then run ```npm publish``` + +### Consuming + +navigate to the folder of your consuming project and run one of the following commands. + +_published:_ + +``` +npm install @swagger/typescript-axios-petstore@1.0.0 --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/api.ts b/samples/client/petstore/typescript-axios/builds/es6-target/api.ts new file mode 100644 index 00000000000..0bac23ab041 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/es6-target/api.ts @@ -0,0 +1,1962 @@ +// tslint:disable +/// +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as url from "url"; +import { Configuration } from "./configuration"; +import axios, { AxiosPromise } from 'axios'; + +const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} + +/** + * Describes the result of uploading an image resource + * @export + * @interface ApiResponse + */ +export interface ApiResponse { + /** + * + * @type {number} + * @memberof ApiResponse + */ + code?: number; + /** + * + * @type {string} + * @memberof ApiResponse + */ + type?: string; + /** + * + * @type {string} + * @memberof ApiResponse + */ + message?: string; +} + +/** + * A category for a pet + * @export + * @interface Category + */ +export interface Category { + /** + * + * @type {number} + * @memberof Category + */ + id?: number; + /** + * + * @type {string} + * @memberof Category + */ + name?: string; +} + +/** + * An order for a pets from the pet store + * @export + * @interface Order + */ +export interface Order { + /** + * + * @type {number} + * @memberof Order + */ + id?: number; + /** + * + * @type {number} + * @memberof Order + */ + petId?: number; + /** + * + * @type {number} + * @memberof Order + */ + quantity?: number; + /** + * + * @type {Date} + * @memberof Order + */ + shipDate?: Date; + /** + * Order Status + * @type {string} + * @memberof Order + */ + status?: Order.StatusEnum; + /** + * + * @type {boolean} + * @memberof Order + */ + complete?: boolean; +} + +/** + * @export + * @namespace Order + */ +export namespace Order { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' + } +} + +/** + * A pet for sale in the pet store + * @export + * @interface Pet + */ +export interface Pet { + /** + * + * @type {number} + * @memberof Pet + */ + id?: number; + /** + * + * @type {Category} + * @memberof Pet + */ + category?: Category; + /** + * + * @type {string} + * @memberof Pet + */ + name: string; + /** + * + * @type {Array} + * @memberof Pet + */ + photoUrls: Array; + /** + * + * @type {Array} + * @memberof Pet + */ + tags?: Array; + /** + * pet status in the store + * @type {string} + * @memberof Pet + */ + status?: Pet.StatusEnum; +} + +/** + * @export + * @namespace Pet + */ +export namespace Pet { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Available = 'available', + Pending = 'pending', + Sold = 'sold' + } +} + +/** + * A tag for a pet + * @export + * @interface Tag + */ +export interface Tag { + /** + * + * @type {number} + * @memberof Tag + */ + id?: number; + /** + * + * @type {string} + * @memberof Tag + */ + name?: string; +} + +/** + * A User who is purchasing from the pet store + * @export + * @interface User + */ +export interface User { + /** + * + * @type {number} + * @memberof User + */ + id?: number; + /** + * + * @type {string} + * @memberof User + */ + username?: string; + /** + * + * @type {string} + * @memberof User + */ + firstName?: string; + /** + * + * @type {string} + * @memberof User + */ + lastName?: string; + /** + * + * @type {string} + * @memberof User + */ + email?: string; + /** + * + * @type {string} + * @memberof User + */ + password?: string; + /** + * + * @type {string} + * @memberof User + */ + phone?: string; + /** + * User Status + * @type {number} + * @memberof User + */ + userStatus?: number; +} + + +/** + * PetApi - axios parameter creator + * @export + */ +export const PetApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options: any = {}): RequestArgs { + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError('pet','Required parameter pet was null or undefined when calling addPet.'); + } + const localVarPath = `/pet`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); + } + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (apiKey !== undefined && apiKey !== null) { + localVarHeaderParameter['api_key'] = String(apiKey); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options: any = {}): RequestArgs { + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); + } + const localVarPath = `/pet/findByStatus`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (status) { + localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS["csv"]); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options: any = {}): RequestArgs { + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); + } + const localVarPath = `/pet/findByTags`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (tags) { + localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS["csv"]); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); + } + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_key required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + localVarHeaderParameter["api_key"] = localVarApiKeyValue; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options: any = {}): RequestArgs { + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError('pet','Required parameter pet was null or undefined when calling updatePet.'); + } + const localVarPath = `/pet`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'PUT' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); + } + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (name !== undefined) { + localVarFormParams.set('name', name as any); + } + + if (status !== undefined) { + localVarFormParams.set('status', status as any); + } + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); + } + const localVarPath = `/pet/{petId}/uploadImage` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (additionalMetadata !== undefined) { + localVarFormParams.set('additionalMetadata', additionalMetadata as any); + } + + if (file !== undefined) { + localVarFormParams.set('file', file as any); + } + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * PetApi - functional programming interface + * @export + */ +export const PetApiFp = function(configuration?: Configuration) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(pet, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any): (basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(pet, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * PetApi - factory interface + * @export + */ +export const PetApiFactory = function (configuration?: Configuration, basePath?: string) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options?: any) { + return PetApiFp(configuration).addPet(pet, options)(basePath); + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp(configuration).deletePet(petId, apiKey, options)(basePath); + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { + return PetApiFp(configuration).findPetsByStatus(status, options)(basePath); + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any) { + return PetApiFp(configuration).findPetsByTags(tags, options)(basePath); + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any) { + return PetApiFp(configuration).getPetById(petId, options)(basePath); + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options?: any) { + return PetApiFp(configuration).updatePet(pet, options)(basePath); + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(basePath); + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(basePath); + }, + }; +}; + +/** + * PetApi - object-oriented interface + * @export + * @class PetApi + * @extends {BaseAPI} + */ +export class PetApi extends BaseAPI { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public addPet(pet: Pet, options?: any) { + return PetApiFp(this.configuration).addPet(pet, options)(this.basePath); + } + + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.basePath); + } + + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { + return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.basePath); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByTags(tags: Array, options?: any) { + return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.basePath); + } + + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public getPetById(petId: number, options?: any) { + return PetApiFp(this.configuration).getPetById(petId, options)(this.basePath); + } + + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePet(pet: Pet, options?: any) { + return PetApiFp(this.configuration).updatePet(pet, options)(this.basePath); + } + + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.basePath); + } + + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.basePath); + } + +} + +/** + * StoreApi - axios parameter creator + * @export + */ +export const StoreApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options: any = {}): RequestArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); + } + const localVarPath = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options: any = {}): RequestArgs { + const localVarPath = `/store/inventory`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_key required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + localVarHeaderParameter["api_key"] = localVarApiKeyValue; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options: any = {}): RequestArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); + } + const localVarPath = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options: any = {}): RequestArgs { + // verify required parameter 'order' is not null or undefined + if (order === null || order === undefined) { + throw new RequiredError('order','Required parameter order was null or undefined when calling placeOrder.'); + } + const localVarPath = `/store/order`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(order || {}) : (order || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * StoreApi - functional programming interface + * @export + */ +export const StoreApiFp = function(configuration?: Configuration) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any): (basePath?: string) => AxiosPromise<{ [key: string]: number; }> { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(order, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * StoreApi - factory interface + * @export + */ +export const StoreApiFactory = function (configuration?: Configuration, basePath?: string) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any) { + return StoreApiFp(configuration).deleteOrder(orderId, options)(basePath); + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any) { + return StoreApiFp(configuration).getInventory(options)(basePath); + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any) { + return StoreApiFp(configuration).getOrderById(orderId, options)(basePath); + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options?: any) { + return StoreApiFp(configuration).placeOrder(order, options)(basePath); + }, + }; +}; + +/** + * StoreApi - object-oriented interface + * @export + * @class StoreApi + * @extends {BaseAPI} + */ +export class StoreApi extends BaseAPI { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public deleteOrder(orderId: string, options?: any) { + return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.basePath); + } + + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getInventory(options?: any) { + return StoreApiFp(this.configuration).getInventory(options)(this.basePath); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getOrderById(orderId: number, options?: any) { + return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.basePath); + } + + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public placeOrder(order: Order, options?: any) { + return StoreApiFp(this.configuration).placeOrder(order, options)(this.basePath); + } + +} + +/** + * UserApi - axios parameter creator + * @export + */ +export const UserApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options: any = {}): RequestArgs { + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling createUser.'); + } + const localVarPath = `/user`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options: any = {}): RequestArgs { + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithArrayInput.'); + } + const localVarPath = `/user/createWithArray`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Array<User>" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options: any = {}): RequestArgs { + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithListInput.'); + } + const localVarPath = `/user/createWithList`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Array<User>" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); + } + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); + } + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); + } + const localVarPath = `/user/login`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (username !== undefined) { + localVarQueryParameter['username'] = username; + } + + if (password !== undefined) { + localVarQueryParameter['password'] = password; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options: any = {}): RequestArgs { + const localVarPath = `/user/logout`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); + } + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling updateUser.'); + } + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'PUT' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * UserApi - functional programming interface + * @export + */ +export const UserApiFp = function(configuration?: Configuration) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * UserApi - factory interface + * @export + */ +export const UserApiFactory = function (configuration?: Configuration, basePath?: string) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options?: any) { + return UserApiFp(configuration).createUser(user, options)(basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options?: any) { + return UserApiFp(configuration).createUsersWithArrayInput(user, options)(basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options?: any) { + return UserApiFp(configuration).createUsersWithListInput(user, options)(basePath); + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any) { + return UserApiFp(configuration).deleteUser(username, options)(basePath); + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any) { + return UserApiFp(configuration).getUserByName(username, options)(basePath); + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any) { + return UserApiFp(configuration).loginUser(username, password, options)(basePath); + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any) { + return UserApiFp(configuration).logoutUser(options)(basePath); + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options?: any) { + return UserApiFp(configuration).updateUser(username, user, options)(basePath); + }, + }; +}; + +/** + * UserApi - object-oriented interface + * @export + * @class UserApi + * @extends {BaseAPI} + */ +export class UserApi extends BaseAPI { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUser(user: User, options?: any) { + return UserApiFp(this.configuration).createUser(user, options)(this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithArrayInput(user: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithListInput(user: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.basePath); + } + + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public deleteUser(username: string, options?: any) { + return UserApiFp(this.configuration).deleteUser(username, options)(this.basePath); + } + + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public getUserByName(username: string, options?: any) { + return UserApiFp(this.configuration).getUserByName(username, options)(this.basePath); + } + + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public loginUser(username: string, password: string, options?: any) { + return UserApiFp(this.configuration).loginUser(username, password, options)(this.basePath); + } + + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public logoutUser(options?: any) { + return UserApiFp(this.configuration).logoutUser(options)(this.basePath); + } + + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public updateUser(username: string, user: User, options?: any) { + return UserApiFp(this.configuration).updateUser(username, user, options)(this.basePath); + } + +} + diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/configuration.ts b/samples/client/petstore/typescript-axios/builds/es6-target/configuration.ts new file mode 100644 index 00000000000..5fafdac5b93 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/es6-target/configuration.ts @@ -0,0 +1,74 @@ +// tslint:disable +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | ((name: string) => string); + username?: string; + password?: string; + accessToken?: string | ((name: string, scopes?: string[]) => string); + basePath?: string; + baseOptions?: any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | ((name: string) => string); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | ((name: string, scopes?: string[]) => string); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + } +} diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/custom.d.ts b/samples/client/petstore/typescript-axios/builds/es6-target/custom.d.ts new file mode 100644 index 00000000000..32534cb1663 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/es6-target/custom.d.ts @@ -0,0 +1 @@ +declare module 'url'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/git_push.sh b/samples/client/petstore/typescript-axios/builds/es6-target/git_push.sh new file mode 100644 index 00000000000..188eeaea7bc --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/es6-target/git_push.sh @@ -0,0 +1,51 @@ +#!/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" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +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://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/index.ts b/samples/client/petstore/typescript-axios/builds/es6-target/index.ts new file mode 100644 index 00000000000..768b2ffab47 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/es6-target/index.ts @@ -0,0 +1,16 @@ +// tslint:disable +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/package.json b/samples/client/petstore/typescript-axios/builds/es6-target/package.json new file mode 100644 index 00000000000..ff8544274db --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/es6-target/package.json @@ -0,0 +1,32 @@ +{ + "name": "@swagger/typescript-axios-petstore", + "version": "1.0.0", + "description": "OpenAPI client for @swagger/typescript-axios-petstore", + "author": "OpenAPI-Generator Contributors", + "keywords": [ + "axios", + "typescript", + "openapi-client", + "openapi-generator", + "@swagger/typescript-axios-petstore" + ], + "license": "Unlicense", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts" : { + "build": "tsc --outDir dist/", + "prepublishOnly": "npm run build" + }, + "dependencies": { + "axios": "^0.18.0" + }, + "peerDependencies": { + }, + "devDependencies": { + "@types/node": "^8.0.9", + "typescript": "^2.4" + }, + "publishConfig":{ + "registry":"https://skimdb.npmjs.com/registry" + } +} diff --git a/samples/client/petstore/typescript-axios/builds/es6-target/tsconfig.json b/samples/client/petstore/typescript-axios/builds/es6-target/tsconfig.json new file mode 100644 index 00000000000..0eb23e488b2 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/es6-target/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "declaration": true, + "target": "es6", + "module": "commonjs", + "noImplicitAny": true, + "outDir": "dist", + "rootDir": "." }, + "exclude": [ + "dist", + "node_modules" + ] +} diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/.gitignore b/samples/client/petstore/typescript-axios/builds/with-interfaces/.gitignore new file mode 100644 index 00000000000..35e2fb2b02e --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/.gitignore @@ -0,0 +1,3 @@ +wwwroot/*.js +node_modules +typings diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/.openapi-generator-ignore b/samples/client/petstore/typescript-axios/builds/with-interfaces/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/.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/typescript-axios/builds/with-interfaces/.openapi-generator/VERSION b/samples/client/petstore/typescript-axios/builds/with-interfaces/.openapi-generator/VERSION new file mode 100644 index 00000000000..c791c986fbb --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts b/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts new file mode 100644 index 00000000000..e47d90f0e19 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/api.ts @@ -0,0 +1,2191 @@ +// tslint:disable +/// +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as url from "url"; +import { Configuration } from "./configuration"; +import axios, { AxiosPromise } from 'axios'; + +const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} + +/** + * Describes the result of uploading an image resource + * @export + * @interface ApiResponse + */ +export interface ApiResponse { + /** + * + * @type {number} + * @memberof ApiResponse + */ + code?: number; + /** + * + * @type {string} + * @memberof ApiResponse + */ + type?: string; + /** + * + * @type {string} + * @memberof ApiResponse + */ + message?: string; +} + +/** + * A category for a pet + * @export + * @interface Category + */ +export interface Category { + /** + * + * @type {number} + * @memberof Category + */ + id?: number; + /** + * + * @type {string} + * @memberof Category + */ + name?: string; +} + +/** + * An order for a pets from the pet store + * @export + * @interface Order + */ +export interface Order { + /** + * + * @type {number} + * @memberof Order + */ + id?: number; + /** + * + * @type {number} + * @memberof Order + */ + petId?: number; + /** + * + * @type {number} + * @memberof Order + */ + quantity?: number; + /** + * + * @type {Date} + * @memberof Order + */ + shipDate?: Date; + /** + * Order Status + * @type {string} + * @memberof Order + */ + status?: Order.StatusEnum; + /** + * + * @type {boolean} + * @memberof Order + */ + complete?: boolean; +} + +/** + * @export + * @namespace Order + */ +export namespace Order { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' + } +} + +/** + * A pet for sale in the pet store + * @export + * @interface Pet + */ +export interface Pet { + /** + * + * @type {number} + * @memberof Pet + */ + id?: number; + /** + * + * @type {Category} + * @memberof Pet + */ + category?: Category; + /** + * + * @type {string} + * @memberof Pet + */ + name: string; + /** + * + * @type {Array} + * @memberof Pet + */ + photoUrls: Array; + /** + * + * @type {Array} + * @memberof Pet + */ + tags?: Array; + /** + * pet status in the store + * @type {string} + * @memberof Pet + */ + status?: Pet.StatusEnum; +} + +/** + * @export + * @namespace Pet + */ +export namespace Pet { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Available = 'available', + Pending = 'pending', + Sold = 'sold' + } +} + +/** + * A tag for a pet + * @export + * @interface Tag + */ +export interface Tag { + /** + * + * @type {number} + * @memberof Tag + */ + id?: number; + /** + * + * @type {string} + * @memberof Tag + */ + name?: string; +} + +/** + * A User who is purchasing from the pet store + * @export + * @interface User + */ +export interface User { + /** + * + * @type {number} + * @memberof User + */ + id?: number; + /** + * + * @type {string} + * @memberof User + */ + username?: string; + /** + * + * @type {string} + * @memberof User + */ + firstName?: string; + /** + * + * @type {string} + * @memberof User + */ + lastName?: string; + /** + * + * @type {string} + * @memberof User + */ + email?: string; + /** + * + * @type {string} + * @memberof User + */ + password?: string; + /** + * + * @type {string} + * @memberof User + */ + phone?: string; + /** + * User Status + * @type {number} + * @memberof User + */ + userStatus?: number; +} + + +/** + * PetApi - axios parameter creator + * @export + */ +export const PetApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options: any = {}): RequestArgs { + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError('pet','Required parameter pet was null or undefined when calling addPet.'); + } + const localVarPath = `/pet`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); + } + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (apiKey !== undefined && apiKey !== null) { + localVarHeaderParameter['api_key'] = String(apiKey); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options: any = {}): RequestArgs { + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); + } + const localVarPath = `/pet/findByStatus`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (status) { + localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS["csv"]); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options: any = {}): RequestArgs { + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); + } + const localVarPath = `/pet/findByTags`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (tags) { + localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS["csv"]); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); + } + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_key required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + localVarHeaderParameter["api_key"] = localVarApiKeyValue; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options: any = {}): RequestArgs { + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError('pet','Required parameter pet was null or undefined when calling updatePet.'); + } + const localVarPath = `/pet`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'PUT' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); + } + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (name !== undefined) { + localVarFormParams.set('name', name as any); + } + + if (status !== undefined) { + localVarFormParams.set('status', status as any); + } + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); + } + const localVarPath = `/pet/{petId}/uploadImage` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (additionalMetadata !== undefined) { + localVarFormParams.set('additionalMetadata', additionalMetadata as any); + } + + if (file !== undefined) { + localVarFormParams.set('file', file as any); + } + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * PetApi - functional programming interface + * @export + */ +export const PetApiFp = function(configuration?: Configuration) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(pet, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any): (basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(pet, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * PetApi - factory interface + * @export + */ +export const PetApiFactory = function (configuration?: Configuration, basePath?: string) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options?: any) { + return PetApiFp(configuration).addPet(pet, options)(basePath); + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp(configuration).deletePet(petId, apiKey, options)(basePath); + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { + return PetApiFp(configuration).findPetsByStatus(status, options)(basePath); + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any) { + return PetApiFp(configuration).findPetsByTags(tags, options)(basePath); + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any) { + return PetApiFp(configuration).getPetById(petId, options)(basePath); + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options?: any) { + return PetApiFp(configuration).updatePet(pet, options)(basePath); + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(basePath); + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(basePath); + }, + }; +}; + +/** + * PetApi - interface + * @export + * @interface PetApi + */ +export interface PetApiInterface { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApiInterface + */ + addPet(pet: Pet, options?: any): AxiosPromise<{}>; + + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApiInterface + */ + deletePet(petId: number, apiKey?: string, options?: any): AxiosPromise<{}>; + + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApiInterface + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): AxiosPromise>; + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApiInterface + */ + findPetsByTags(tags: Array, options?: any): AxiosPromise>; + + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApiInterface + */ + getPetById(petId: number, options?: any): AxiosPromise; + + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApiInterface + */ + updatePet(pet: Pet, options?: any): AxiosPromise<{}>; + + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApiInterface + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): AxiosPromise<{}>; + + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApiInterface + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): AxiosPromise; + +} + +/** + * PetApi - object-oriented interface + * @export + * @class PetApi + * @extends {BaseAPI} + */ +export class PetApi extends BaseAPI implements PetApiInterface { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public addPet(pet: Pet, options?: any) { + return PetApiFp(this.configuration).addPet(pet, options)(this.basePath); + } + + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.basePath); + } + + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { + return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.basePath); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByTags(tags: Array, options?: any) { + return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.basePath); + } + + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public getPetById(petId: number, options?: any) { + return PetApiFp(this.configuration).getPetById(petId, options)(this.basePath); + } + + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePet(pet: Pet, options?: any) { + return PetApiFp(this.configuration).updatePet(pet, options)(this.basePath); + } + + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.basePath); + } + + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.basePath); + } + +} + +/** + * StoreApi - axios parameter creator + * @export + */ +export const StoreApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options: any = {}): RequestArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); + } + const localVarPath = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options: any = {}): RequestArgs { + const localVarPath = `/store/inventory`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_key required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + localVarHeaderParameter["api_key"] = localVarApiKeyValue; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options: any = {}): RequestArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); + } + const localVarPath = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options: any = {}): RequestArgs { + // verify required parameter 'order' is not null or undefined + if (order === null || order === undefined) { + throw new RequiredError('order','Required parameter order was null or undefined when calling placeOrder.'); + } + const localVarPath = `/store/order`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(order || {}) : (order || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * StoreApi - functional programming interface + * @export + */ +export const StoreApiFp = function(configuration?: Configuration) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any): (basePath?: string) => AxiosPromise<{ [key: string]: number; }> { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(order, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * StoreApi - factory interface + * @export + */ +export const StoreApiFactory = function (configuration?: Configuration, basePath?: string) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any) { + return StoreApiFp(configuration).deleteOrder(orderId, options)(basePath); + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any) { + return StoreApiFp(configuration).getInventory(options)(basePath); + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any) { + return StoreApiFp(configuration).getOrderById(orderId, options)(basePath); + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options?: any) { + return StoreApiFp(configuration).placeOrder(order, options)(basePath); + }, + }; +}; + +/** + * StoreApi - interface + * @export + * @interface StoreApi + */ +export interface StoreApiInterface { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApiInterface + */ + deleteOrder(orderId: string, options?: any): AxiosPromise<{}>; + + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApiInterface + */ + getInventory(options?: any): AxiosPromise<{ [key: string]: number; }>; + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApiInterface + */ + getOrderById(orderId: number, options?: any): AxiosPromise; + + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApiInterface + */ + placeOrder(order: Order, options?: any): AxiosPromise; + +} + +/** + * StoreApi - object-oriented interface + * @export + * @class StoreApi + * @extends {BaseAPI} + */ +export class StoreApi extends BaseAPI implements StoreApiInterface { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public deleteOrder(orderId: string, options?: any) { + return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.basePath); + } + + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getInventory(options?: any) { + return StoreApiFp(this.configuration).getInventory(options)(this.basePath); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getOrderById(orderId: number, options?: any) { + return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.basePath); + } + + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public placeOrder(order: Order, options?: any) { + return StoreApiFp(this.configuration).placeOrder(order, options)(this.basePath); + } + +} + +/** + * UserApi - axios parameter creator + * @export + */ +export const UserApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options: any = {}): RequestArgs { + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling createUser.'); + } + const localVarPath = `/user`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options: any = {}): RequestArgs { + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithArrayInput.'); + } + const localVarPath = `/user/createWithArray`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Array<User>" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options: any = {}): RequestArgs { + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithListInput.'); + } + const localVarPath = `/user/createWithList`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Array<User>" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); + } + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); + } + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); + } + const localVarPath = `/user/login`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (username !== undefined) { + localVarQueryParameter['username'] = username; + } + + if (password !== undefined) { + localVarQueryParameter['password'] = password; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options: any = {}): RequestArgs { + const localVarPath = `/user/logout`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); + } + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling updateUser.'); + } + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'PUT' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * UserApi - functional programming interface + * @export + */ +export const UserApiFp = function(configuration?: Configuration) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * UserApi - factory interface + * @export + */ +export const UserApiFactory = function (configuration?: Configuration, basePath?: string) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options?: any) { + return UserApiFp(configuration).createUser(user, options)(basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options?: any) { + return UserApiFp(configuration).createUsersWithArrayInput(user, options)(basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options?: any) { + return UserApiFp(configuration).createUsersWithListInput(user, options)(basePath); + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any) { + return UserApiFp(configuration).deleteUser(username, options)(basePath); + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any) { + return UserApiFp(configuration).getUserByName(username, options)(basePath); + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any) { + return UserApiFp(configuration).loginUser(username, password, options)(basePath); + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any) { + return UserApiFp(configuration).logoutUser(options)(basePath); + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options?: any) { + return UserApiFp(configuration).updateUser(username, user, options)(basePath); + }, + }; +}; + +/** + * UserApi - interface + * @export + * @interface UserApi + */ +export interface UserApiInterface { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiInterface + */ + createUser(user: User, options?: any): AxiosPromise<{}>; + + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiInterface + */ + createUsersWithArrayInput(user: Array, options?: any): AxiosPromise<{}>; + + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiInterface + */ + createUsersWithListInput(user: Array, options?: any): AxiosPromise<{}>; + + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiInterface + */ + deleteUser(username: string, options?: any): AxiosPromise<{}>; + + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiInterface + */ + getUserByName(username: string, options?: any): AxiosPromise; + + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiInterface + */ + loginUser(username: string, password: string, options?: any): AxiosPromise; + + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiInterface + */ + logoutUser(options?: any): AxiosPromise<{}>; + + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApiInterface + */ + updateUser(username: string, user: User, options?: any): AxiosPromise<{}>; + +} + +/** + * UserApi - object-oriented interface + * @export + * @class UserApi + * @extends {BaseAPI} + */ +export class UserApi extends BaseAPI implements UserApiInterface { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUser(user: User, options?: any) { + return UserApiFp(this.configuration).createUser(user, options)(this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithArrayInput(user: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithListInput(user: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.basePath); + } + + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public deleteUser(username: string, options?: any) { + return UserApiFp(this.configuration).deleteUser(username, options)(this.basePath); + } + + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public getUserByName(username: string, options?: any) { + return UserApiFp(this.configuration).getUserByName(username, options)(this.basePath); + } + + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public loginUser(username: string, password: string, options?: any) { + return UserApiFp(this.configuration).loginUser(username, password, options)(this.basePath); + } + + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public logoutUser(options?: any) { + return UserApiFp(this.configuration).logoutUser(options)(this.basePath); + } + + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public updateUser(username: string, user: User, options?: any) { + return UserApiFp(this.configuration).updateUser(username, user, options)(this.basePath); + } + +} + diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/configuration.ts b/samples/client/petstore/typescript-axios/builds/with-interfaces/configuration.ts new file mode 100644 index 00000000000..5fafdac5b93 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/configuration.ts @@ -0,0 +1,74 @@ +// tslint:disable +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | ((name: string) => string); + username?: string; + password?: string; + accessToken?: string | ((name: string, scopes?: string[]) => string); + basePath?: string; + baseOptions?: any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | ((name: string) => string); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | ((name: string, scopes?: string[]) => string); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + } +} diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/custom.d.ts b/samples/client/petstore/typescript-axios/builds/with-interfaces/custom.d.ts new file mode 100644 index 00000000000..32534cb1663 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/custom.d.ts @@ -0,0 +1 @@ +declare module 'url'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/git_push.sh b/samples/client/petstore/typescript-axios/builds/with-interfaces/git_push.sh new file mode 100644 index 00000000000..188eeaea7bc --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/git_push.sh @@ -0,0 +1,51 @@ +#!/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" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +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://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/petstore/typescript-axios/builds/with-interfaces/index.ts b/samples/client/petstore/typescript-axios/builds/with-interfaces/index.ts new file mode 100644 index 00000000000..768b2ffab47 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-interfaces/index.ts @@ -0,0 +1,16 @@ +// tslint:disable +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/.gitignore b/samples/client/petstore/typescript-axios/builds/with-npm-version/.gitignore new file mode 100644 index 00000000000..35e2fb2b02e --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/.gitignore @@ -0,0 +1,3 @@ +wwwroot/*.js +node_modules +typings diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator-ignore b/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/.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/typescript-axios/builds/with-npm-version/.openapi-generator/VERSION b/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/VERSION new file mode 100644 index 00000000000..c791c986fbb --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.2.3-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/README.md b/samples/client/petstore/typescript-axios/builds/with-npm-version/README.md new file mode 100644 index 00000000000..4672431c735 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/README.md @@ -0,0 +1,45 @@ +## @swagger/typescript-axios-petstore@1.0.0 + +This generator creates TypeScript/JavaScript client that utilizes [axios](https://github.com/axios/axios). The generated Node module can be used in the following environments: + +Environment +* Node.js +* Webpack +* Browserify + +Language level +* ES5 - you must have a Promises/A+ library installed +* ES6 + +Module system +* CommonJS +* ES6 module system + +It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) + +### Building + +To build and compile the typescript sources to javascript use: +``` +npm install +npm run build +``` + +### Publishing + +First build the package then run ```npm publish``` + +### Consuming + +navigate to the folder of your consuming project and run one of the following commands. + +_published:_ + +``` +npm install @swagger/typescript-axios-petstore@1.0.0 --save +``` + +_unPublished (not recommended):_ + +``` +npm install PATH_TO_GENERATED_PACKAGE --save diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts new file mode 100644 index 00000000000..0bac23ab041 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/api.ts @@ -0,0 +1,1962 @@ +// tslint:disable +/// +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +import * as url from "url"; +import { Configuration } from "./configuration"; +import axios, { AxiosPromise } from 'axios'; + +const BASE_PATH = "http://petstore.swagger.io/v2".replace(/\/+$/, ""); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: any; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor(configuration?: Configuration, protected basePath: string = BASE_PATH) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath || this.basePath; + } + } +}; + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + name: "RequiredError" = "RequiredError"; + constructor(public field: string, msg?: string) { + super(msg); + } +} + +/** + * Describes the result of uploading an image resource + * @export + * @interface ApiResponse + */ +export interface ApiResponse { + /** + * + * @type {number} + * @memberof ApiResponse + */ + code?: number; + /** + * + * @type {string} + * @memberof ApiResponse + */ + type?: string; + /** + * + * @type {string} + * @memberof ApiResponse + */ + message?: string; +} + +/** + * A category for a pet + * @export + * @interface Category + */ +export interface Category { + /** + * + * @type {number} + * @memberof Category + */ + id?: number; + /** + * + * @type {string} + * @memberof Category + */ + name?: string; +} + +/** + * An order for a pets from the pet store + * @export + * @interface Order + */ +export interface Order { + /** + * + * @type {number} + * @memberof Order + */ + id?: number; + /** + * + * @type {number} + * @memberof Order + */ + petId?: number; + /** + * + * @type {number} + * @memberof Order + */ + quantity?: number; + /** + * + * @type {Date} + * @memberof Order + */ + shipDate?: Date; + /** + * Order Status + * @type {string} + * @memberof Order + */ + status?: Order.StatusEnum; + /** + * + * @type {boolean} + * @memberof Order + */ + complete?: boolean; +} + +/** + * @export + * @namespace Order + */ +export namespace Order { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Placed = 'placed', + Approved = 'approved', + Delivered = 'delivered' + } +} + +/** + * A pet for sale in the pet store + * @export + * @interface Pet + */ +export interface Pet { + /** + * + * @type {number} + * @memberof Pet + */ + id?: number; + /** + * + * @type {Category} + * @memberof Pet + */ + category?: Category; + /** + * + * @type {string} + * @memberof Pet + */ + name: string; + /** + * + * @type {Array} + * @memberof Pet + */ + photoUrls: Array; + /** + * + * @type {Array} + * @memberof Pet + */ + tags?: Array; + /** + * pet status in the store + * @type {string} + * @memberof Pet + */ + status?: Pet.StatusEnum; +} + +/** + * @export + * @namespace Pet + */ +export namespace Pet { + /** + * @export + * @enum {string} + */ + export enum StatusEnum { + Available = 'available', + Pending = 'pending', + Sold = 'sold' + } +} + +/** + * A tag for a pet + * @export + * @interface Tag + */ +export interface Tag { + /** + * + * @type {number} + * @memberof Tag + */ + id?: number; + /** + * + * @type {string} + * @memberof Tag + */ + name?: string; +} + +/** + * A User who is purchasing from the pet store + * @export + * @interface User + */ +export interface User { + /** + * + * @type {number} + * @memberof User + */ + id?: number; + /** + * + * @type {string} + * @memberof User + */ + username?: string; + /** + * + * @type {string} + * @memberof User + */ + firstName?: string; + /** + * + * @type {string} + * @memberof User + */ + lastName?: string; + /** + * + * @type {string} + * @memberof User + */ + email?: string; + /** + * + * @type {string} + * @memberof User + */ + password?: string; + /** + * + * @type {string} + * @memberof User + */ + phone?: string; + /** + * User Status + * @type {number} + * @memberof User + */ + userStatus?: number; +} + + +/** + * PetApi - axios parameter creator + * @export + */ +export const PetApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options: any = {}): RequestArgs { + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError('pet','Required parameter pet was null or undefined when calling addPet.'); + } + const localVarPath = `/pet`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling deletePet.'); + } + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (apiKey !== undefined && apiKey !== null) { + localVarHeaderParameter['api_key'] = String(apiKey); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options: any = {}): RequestArgs { + // verify required parameter 'status' is not null or undefined + if (status === null || status === undefined) { + throw new RequiredError('status','Required parameter status was null or undefined when calling findPetsByStatus.'); + } + const localVarPath = `/pet/findByStatus`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (status) { + localVarQueryParameter['status'] = status.join(COLLECTION_FORMATS["csv"]); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options: any = {}): RequestArgs { + // verify required parameter 'tags' is not null or undefined + if (tags === null || tags === undefined) { + throw new RequiredError('tags','Required parameter tags was null or undefined when calling findPetsByTags.'); + } + const localVarPath = `/pet/findByTags`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (tags) { + localVarQueryParameter['tags'] = tags.join(COLLECTION_FORMATS["csv"]); + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling getPetById.'); + } + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_key required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + localVarHeaderParameter["api_key"] = localVarApiKeyValue; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options: any = {}): RequestArgs { + // verify required parameter 'pet' is not null or undefined + if (pet === null || pet === undefined) { + throw new RequiredError('pet','Required parameter pet was null or undefined when calling updatePet.'); + } + const localVarPath = `/pet`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'PUT' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Pet" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(pet || {}) : (pet || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling updatePetWithForm.'); + } + const localVarPath = `/pet/{petId}` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (name !== undefined) { + localVarFormParams.set('name', name as any); + } + + if (status !== undefined) { + localVarFormParams.set('status', status as any); + } + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options: any = {}): RequestArgs { + // verify required parameter 'petId' is not null or undefined + if (petId === null || petId === undefined) { + throw new RequiredError('petId','Required parameter petId was null or undefined when calling uploadFile.'); + } + const localVarPath = `/pet/{petId}/uploadImage` + .replace(`{${"petId"}}`, encodeURIComponent(String(petId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + const localVarFormParams = new url.URLSearchParams(); + + // authentication petstore_auth required + // oauth required + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = typeof configuration.accessToken === 'function' + ? configuration.accessToken("petstore_auth", ["write:pets", "read:pets"]) + : configuration.accessToken; + localVarHeaderParameter["Authorization"] = "Bearer " + localVarAccessTokenValue; + } + + if (additionalMetadata !== undefined) { + localVarFormParams.set('additionalMetadata', additionalMetadata as any); + } + + if (file !== undefined) { + localVarFormParams.set('file', file as any); + } + + localVarHeaderParameter['Content-Type'] = 'application/x-www-form-urlencoded'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + localVarRequestOptions.data = localVarFormParams.toString(); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * PetApi - functional programming interface + * @export + */ +export const PetApiFp = function(configuration?: Configuration) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).addPet(pet, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).deletePet(petId, apiKey, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any): (basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByStatus(status, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any): (basePath?: string) => AxiosPromise> { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).findPetsByTags(tags, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).getPetById(petId, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePet(pet, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).updatePetWithForm(petId, name, status, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = PetApiAxiosParamCreator(configuration).uploadFile(petId, additionalMetadata, file, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * PetApi - factory interface + * @export + */ +export const PetApiFactory = function (configuration?: Configuration, basePath?: string) { + return { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + addPet(pet: Pet, options?: any) { + return PetApiFp(configuration).addPet(pet, options)(basePath); + }, + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp(configuration).deletePet(petId, apiKey, options)(basePath); + }, + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { + return PetApiFp(configuration).findPetsByStatus(status, options)(basePath); + }, + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + findPetsByTags(tags: Array, options?: any) { + return PetApiFp(configuration).findPetsByTags(tags, options)(basePath); + }, + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getPetById(petId: number, options?: any) { + return PetApiFp(configuration).getPetById(petId, options)(basePath); + }, + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePet(pet: Pet, options?: any) { + return PetApiFp(configuration).updatePet(pet, options)(basePath); + }, + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp(configuration).updatePetWithForm(petId, name, status, options)(basePath); + }, + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp(configuration).uploadFile(petId, additionalMetadata, file, options)(basePath); + }, + }; +}; + +/** + * PetApi - object-oriented interface + * @export + * @class PetApi + * @extends {BaseAPI} + */ +export class PetApi extends BaseAPI { + /** + * + * @summary Add a new pet to the store + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public addPet(pet: Pet, options?: any) { + return PetApiFp(this.configuration).addPet(pet, options)(this.basePath); + } + + /** + * + * @summary Deletes a pet + * @param {number} petId Pet id to delete + * @param {string} [apiKey] + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public deletePet(petId: number, apiKey?: string, options?: any) { + return PetApiFp(this.configuration).deletePet(petId, apiKey, options)(this.basePath); + } + + /** + * Multiple status values can be provided with comma separated strings + * @summary Finds Pets by status + * @param {Array<'available' | 'pending' | 'sold'>} status Status values that need to be considered for filter + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByStatus(status: Array<'available' | 'pending' | 'sold'>, options?: any) { + return PetApiFp(this.configuration).findPetsByStatus(status, options)(this.basePath); + } + + /** + * Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + * @summary Finds Pets by tags + * @param {Array} tags Tags to filter by + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public findPetsByTags(tags: Array, options?: any) { + return PetApiFp(this.configuration).findPetsByTags(tags, options)(this.basePath); + } + + /** + * Returns a single pet + * @summary Find pet by ID + * @param {number} petId ID of pet to return + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public getPetById(petId: number, options?: any) { + return PetApiFp(this.configuration).getPetById(petId, options)(this.basePath); + } + + /** + * + * @summary Update an existing pet + * @param {Pet} pet Pet object that needs to be added to the store + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePet(pet: Pet, options?: any) { + return PetApiFp(this.configuration).updatePet(pet, options)(this.basePath); + } + + /** + * + * @summary Updates a pet in the store with form data + * @param {number} petId ID of pet that needs to be updated + * @param {string} [name] Updated name of the pet + * @param {string} [status] Updated status of the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public updatePetWithForm(petId: number, name?: string, status?: string, options?: any) { + return PetApiFp(this.configuration).updatePetWithForm(petId, name, status, options)(this.basePath); + } + + /** + * + * @summary uploads an image + * @param {number} petId ID of pet to update + * @param {string} [additionalMetadata] Additional data to pass to server + * @param {any} [file] file to upload + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof PetApi + */ + public uploadFile(petId: number, additionalMetadata?: string, file?: any, options?: any) { + return PetApiFp(this.configuration).uploadFile(petId, additionalMetadata, file, options)(this.basePath); + } + +} + +/** + * StoreApi - axios parameter creator + * @export + */ +export const StoreApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options: any = {}): RequestArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling deleteOrder.'); + } + const localVarPath = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options: any = {}): RequestArgs { + const localVarPath = `/store/inventory`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication api_key required + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = typeof configuration.apiKey === 'function' + ? configuration.apiKey("api_key") + : configuration.apiKey; + localVarHeaderParameter["api_key"] = localVarApiKeyValue; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options: any = {}): RequestArgs { + // verify required parameter 'orderId' is not null or undefined + if (orderId === null || orderId === undefined) { + throw new RequiredError('orderId','Required parameter orderId was null or undefined when calling getOrderById.'); + } + const localVarPath = `/store/order/{orderId}` + .replace(`{${"orderId"}}`, encodeURIComponent(String(orderId))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options: any = {}): RequestArgs { + // verify required parameter 'order' is not null or undefined + if (order === null || order === undefined) { + throw new RequiredError('order','Required parameter order was null or undefined when calling placeOrder.'); + } + const localVarPath = `/store/order`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Order" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(order || {}) : (order || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * StoreApi - functional programming interface + * @export + */ +export const StoreApiFp = function(configuration?: Configuration) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).deleteOrder(orderId, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any): (basePath?: string) => AxiosPromise<{ [key: string]: number; }> { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getInventory(options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).getOrderById(orderId, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = StoreApiAxiosParamCreator(configuration).placeOrder(order, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * StoreApi - factory interface + * @export + */ +export const StoreApiFactory = function (configuration?: Configuration, basePath?: string) { + return { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteOrder(orderId: string, options?: any) { + return StoreApiFp(configuration).deleteOrder(orderId, options)(basePath); + }, + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInventory(options?: any) { + return StoreApiFp(configuration).getInventory(options)(basePath); + }, + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getOrderById(orderId: number, options?: any) { + return StoreApiFp(configuration).getOrderById(orderId, options)(basePath); + }, + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + placeOrder(order: Order, options?: any) { + return StoreApiFp(configuration).placeOrder(order, options)(basePath); + }, + }; +}; + +/** + * StoreApi - object-oriented interface + * @export + * @class StoreApi + * @extends {BaseAPI} + */ +export class StoreApi extends BaseAPI { + /** + * For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + * @summary Delete purchase order by ID + * @param {string} orderId ID of the order that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public deleteOrder(orderId: string, options?: any) { + return StoreApiFp(this.configuration).deleteOrder(orderId, options)(this.basePath); + } + + /** + * Returns a map of status codes to quantities + * @summary Returns pet inventories by status + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getInventory(options?: any) { + return StoreApiFp(this.configuration).getInventory(options)(this.basePath); + } + + /** + * For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + * @summary Find purchase order by ID + * @param {number} orderId ID of pet that needs to be fetched + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public getOrderById(orderId: number, options?: any) { + return StoreApiFp(this.configuration).getOrderById(orderId, options)(this.basePath); + } + + /** + * + * @summary Place an order for a pet + * @param {Order} order order placed for purchasing the pet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof StoreApi + */ + public placeOrder(order: Order, options?: any) { + return StoreApiFp(this.configuration).placeOrder(order, options)(this.basePath); + } + +} + +/** + * UserApi - axios parameter creator + * @export + */ +export const UserApiAxiosParamCreator = function (configuration?: Configuration) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options: any = {}): RequestArgs { + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling createUser.'); + } + const localVarPath = `/user`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options: any = {}): RequestArgs { + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithArrayInput.'); + } + const localVarPath = `/user/createWithArray`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Array<User>" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options: any = {}): RequestArgs { + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling createUsersWithListInput.'); + } + const localVarPath = `/user/createWithList`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'POST' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("Array<User>" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling deleteUser.'); + } + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'DELETE' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling getUserByName.'); + } + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling loginUser.'); + } + // verify required parameter 'password' is not null or undefined + if (password === null || password === undefined) { + throw new RequiredError('password','Required parameter password was null or undefined when calling loginUser.'); + } + const localVarPath = `/user/login`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + if (username !== undefined) { + localVarQueryParameter['username'] = username; + } + + if (password !== undefined) { + localVarQueryParameter['password'] = password; + } + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options: any = {}): RequestArgs { + const localVarPath = `/user/logout`; + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'GET' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options: any = {}): RequestArgs { + // verify required parameter 'username' is not null or undefined + if (username === null || username === undefined) { + throw new RequiredError('username','Required parameter username was null or undefined when calling updateUser.'); + } + // verify required parameter 'user' is not null or undefined + if (user === null || user === undefined) { + throw new RequiredError('user','Required parameter user was null or undefined when calling updateUser.'); + } + const localVarPath = `/user/{username}` + .replace(`{${"username"}}`, encodeURIComponent(String(username))); + const localVarUrlObj = url.parse(localVarPath, true); + let baseOptions; + if (configuration) { + baseOptions = configuration.baseOptions; + } + const localVarRequestOptions = Object.assign({ method: 'PUT' }, baseOptions, options); + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + localVarUrlObj.query = Object.assign({}, localVarUrlObj.query, localVarQueryParameter, options.query); + // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943 + delete localVarUrlObj.search; + localVarRequestOptions.headers = Object.assign({}, localVarHeaderParameter, options.headers); + const needsSerialization = ("User" !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; + localVarRequestOptions.data = needsSerialization ? JSON.stringify(user || {}) : (user || ""); + + return { + url: url.format(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + } +}; + +/** + * UserApi - functional programming interface + * @export + */ +export const UserApiFp = function(configuration?: Configuration) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUser(user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithArrayInput(user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).createUsersWithListInput(user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).deleteUser(username, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).getUserByName(username, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).loginUser(username, password, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).logoutUser(options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options?: any): (basePath?: string) => AxiosPromise { + const localVarAxiosArgs = UserApiAxiosParamCreator(configuration).updateUser(username, user, options); + return (basePath: string = BASE_PATH) => { + const axiosRequestArgs = Object.assign(localVarAxiosArgs.options, {url: basePath + localVarAxiosArgs.url}) + return axios.request(axiosRequestArgs); + }; + }, + } +}; + +/** + * UserApi - factory interface + * @export + */ +export const UserApiFactory = function (configuration?: Configuration, basePath?: string) { + return { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUser(user: User, options?: any) { + return UserApiFp(configuration).createUser(user, options)(basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithArrayInput(user: Array, options?: any) { + return UserApiFp(configuration).createUsersWithArrayInput(user, options)(basePath); + }, + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createUsersWithListInput(user: Array, options?: any) { + return UserApiFp(configuration).createUsersWithListInput(user, options)(basePath); + }, + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteUser(username: string, options?: any) { + return UserApiFp(configuration).deleteUser(username, options)(basePath); + }, + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getUserByName(username: string, options?: any) { + return UserApiFp(configuration).getUserByName(username, options)(basePath); + }, + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + loginUser(username: string, password: string, options?: any) { + return UserApiFp(configuration).loginUser(username, password, options)(basePath); + }, + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + logoutUser(options?: any) { + return UserApiFp(configuration).logoutUser(options)(basePath); + }, + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + updateUser(username: string, user: User, options?: any) { + return UserApiFp(configuration).updateUser(username, user, options)(basePath); + }, + }; +}; + +/** + * UserApi - object-oriented interface + * @export + * @class UserApi + * @extends {BaseAPI} + */ +export class UserApi extends BaseAPI { + /** + * This can only be done by the logged in user. + * @summary Create user + * @param {User} user Created user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUser(user: User, options?: any) { + return UserApiFp(this.configuration).createUser(user, options)(this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithArrayInput(user: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithArrayInput(user, options)(this.basePath); + } + + /** + * + * @summary Creates list of users with given input array + * @param {Array} user List of user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public createUsersWithListInput(user: Array, options?: any) { + return UserApiFp(this.configuration).createUsersWithListInput(user, options)(this.basePath); + } + + /** + * This can only be done by the logged in user. + * @summary Delete user + * @param {string} username The name that needs to be deleted + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public deleteUser(username: string, options?: any) { + return UserApiFp(this.configuration).deleteUser(username, options)(this.basePath); + } + + /** + * + * @summary Get user by user name + * @param {string} username The name that needs to be fetched. Use user1 for testing. + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public getUserByName(username: string, options?: any) { + return UserApiFp(this.configuration).getUserByName(username, options)(this.basePath); + } + + /** + * + * @summary Logs user into the system + * @param {string} username The user name for login + * @param {string} password The password for login in clear text + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public loginUser(username: string, password: string, options?: any) { + return UserApiFp(this.configuration).loginUser(username, password, options)(this.basePath); + } + + /** + * + * @summary Logs out current logged in user session + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public logoutUser(options?: any) { + return UserApiFp(this.configuration).logoutUser(options)(this.basePath); + } + + /** + * This can only be done by the logged in user. + * @summary Updated user + * @param {string} username name that need to be deleted + * @param {User} user Updated user object + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserApi + */ + public updateUser(username: string, user: User, options?: any) { + return UserApiFp(this.configuration).updateUser(username, user, options)(this.basePath); + } + +} + diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/configuration.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version/configuration.ts new file mode 100644 index 00000000000..5fafdac5b93 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/configuration.ts @@ -0,0 +1,74 @@ +// tslint:disable +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export interface ConfigurationParameters { + apiKey?: string | ((name: string) => string); + username?: string; + password?: string; + accessToken?: string | ((name: string, scopes?: string[]) => string); + basePath?: string; + baseOptions?: any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: string | ((name: string) => string); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: string | ((name: string, scopes?: string[]) => string); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + } +} diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/custom.d.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version/custom.d.ts new file mode 100644 index 00000000000..32534cb1663 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/custom.d.ts @@ -0,0 +1 @@ +declare module 'url'; \ No newline at end of file diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/git_push.sh b/samples/client/petstore/typescript-axios/builds/with-npm-version/git_push.sh new file mode 100644 index 00000000000..188eeaea7bc --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/git_push.sh @@ -0,0 +1,51 @@ +#!/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" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 + +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://github.com/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/index.ts b/samples/client/petstore/typescript-axios/builds/with-npm-version/index.ts new file mode 100644 index 00000000000..768b2ffab47 --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/index.ts @@ -0,0 +1,16 @@ +// tslint:disable +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +export * from "./api"; +export * from "./configuration"; diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json b/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json new file mode 100644 index 00000000000..ff8544274db --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/package.json @@ -0,0 +1,32 @@ +{ + "name": "@swagger/typescript-axios-petstore", + "version": "1.0.0", + "description": "OpenAPI client for @swagger/typescript-axios-petstore", + "author": "OpenAPI-Generator Contributors", + "keywords": [ + "axios", + "typescript", + "openapi-client", + "openapi-generator", + "@swagger/typescript-axios-petstore" + ], + "license": "Unlicense", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "scripts" : { + "build": "tsc --outDir dist/", + "prepublishOnly": "npm run build" + }, + "dependencies": { + "axios": "^0.18.0" + }, + "peerDependencies": { + }, + "devDependencies": { + "@types/node": "^8.0.9", + "typescript": "^2.4" + }, + "publishConfig":{ + "registry":"https://skimdb.npmjs.com/registry" + } +} diff --git a/samples/client/petstore/typescript-axios/builds/with-npm-version/tsconfig.json b/samples/client/petstore/typescript-axios/builds/with-npm-version/tsconfig.json new file mode 100644 index 00000000000..50ab7fa3f2f --- /dev/null +++ b/samples/client/petstore/typescript-axios/builds/with-npm-version/tsconfig.json @@ -0,0 +1,18 @@ +{ + "compilerOptions": { + "declaration": true, + "target": "es5", + "module": "commonjs", + "noImplicitAny": true, + "outDir": "dist", + "rootDir": ".", + "lib": [ + "es6", + "dom" + ] + }, + "exclude": [ + "dist", + "node_modules" + ] +} diff --git a/samples/client/petstore/typescript-axios/tests/default/dist/PetApi.js b/samples/client/petstore/typescript-axios/tests/default/dist/PetApi.js new file mode 100644 index 00000000000..4549c1b75a6 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/dist/PetApi.js @@ -0,0 +1,71 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var chai_1 = require("chai"); +var typescript_axios_petstore_1 = require("@swagger/typescript-axios-petstore"); +describe("PetApi", function () { + function runSuite(description, requestOptions) { + describe(description, function () { + var api; + var fixture = createTestFixture(); + beforeEach(function () { + api = new typescript_axios_petstore_1.PetApi(); + }); + it("should add and delete Pet", function () { + return api.addPet(fixture, requestOptions).then(function () { }); + }); + it("should get Pet by ID", function () { + return api + .getPetById(fixture.id, requestOptions) + .then(function (result) { + return chai_1.expect(result.data).to.deep.equal(fixture); + }); + }); + it("should update Pet by ID", function () { + return api + .getPetById(fixture.id, requestOptions) + .then(function (response) { + var result = response.data; + result.name = "newname"; + return api.updatePet(result, requestOptions).then(function () { + return api + .getPetById(fixture.id, requestOptions) + .then(function (response) { + return chai_1.expect(response.data.name).to.deep.equal("newname"); + }); + }); + }); + }); + it("should delete Pet", function () { + return api.deletePet(fixture.id, requestOptions); + }); + it("should not contain deleted Pet", function () { + return api.getPetById(fixture.id, requestOptions).then(function (result) { + return chai_1.expect(result.data).to.not.exist; + }, function (err) { + return chai_1.expect(err).to.exist; + }); + }); + }); + } + runSuite("without custom request options"); + runSuite("with custom request options", { + credentials: "include", + mode: "cors" + }); +}); +function createTestFixture(ts) { + if (ts === void 0) { ts = Date.now(); } + var category = { + id: ts, + name: "category" + ts + }; + var pet = { + id: ts, + name: "pet" + ts, + category: category, + photoUrls: ["http://foo.bar.com/1", "http://foo.bar.com/2"], + status: typescript_axios_petstore_1.Pet.StatusEnum.Available, + tags: [] + }; + return pet; +} diff --git a/samples/client/petstore/typescript-axios/tests/default/dist/PetApiFactory.js b/samples/client/petstore/typescript-axios/tests/default/dist/PetApiFactory.js new file mode 100644 index 00000000000..45c2e265fa7 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/dist/PetApiFactory.js @@ -0,0 +1,87 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var chai_1 = require("chai"); +var typescript_axios_petstore_1 = require("@swagger/typescript-axios-petstore"); +var typescript_axios_petstore_2 = require("@swagger/typescript-axios-petstore"); +var config; +before(function () { + config = new typescript_axios_petstore_2.Configuration(); + config.accessToken = "foobar"; + config.apiKey = function (securityName) { + // for multiple apiKey security + if (securityName === "api_key") { + return "foobar"; + } + return; + }; + config.username = "foo"; + config.password = "bar"; +}); +describe("PetApiFactory", function () { + function runSuite(description, requestOptions) { + describe(description, function () { + var fixture = createTestFixture(); + it("should add and delete Pet", function () { + return typescript_axios_petstore_1.PetApiFactory(config) + .addPet(fixture, requestOptions) + .then(function () { }); + }); + it("should get Pet by ID", function () { + return typescript_axios_petstore_1.PetApiFactory(config) + .getPetById(fixture.id, requestOptions) + .then(function (result) { + return chai_1.expect(result.data).to.deep.equal(fixture); + }); + }); + it("should update Pet by ID", function () { + return typescript_axios_petstore_1.PetApiFactory(config) + .getPetById(fixture.id, requestOptions) + .then(function (result) { + result.data.name = "newname"; + return typescript_axios_petstore_1.PetApiFactory(config) + .updatePet(result.data, requestOptions) + .then(function () { + return typescript_axios_petstore_1.PetApiFactory(config) + .getPetById(fixture.id, requestOptions) + .then(function (result) { + return chai_1.expect(result.data.name).to.deep.equal("newname"); + }); + }); + }); + }); + it("should delete Pet", function () { + return typescript_axios_petstore_1.PetApiFactory(config).deletePet(fixture.id, requestOptions); + }); + it("should not contain deleted Pet", function () { + return typescript_axios_petstore_1.PetApiFactory(config) + .getPetById(fixture.id, requestOptions) + .then(function (result) { + return chai_1.expect(result.data).to.not.exist; + }, function (err) { + return chai_1.expect(err).to.exist; + }); + }); + }); + } + runSuite("without custom request options"); + runSuite("with custom request options", { + credentials: "include", + mode: "cors" + }); +}); +function createTestFixture(ts) { + if (ts === void 0) { ts = Date.now(); } + var category = { + id: ts, + name: "category" + ts + }; + var pet = { + id: ts, + name: "pet" + ts, + category: category, + photoUrls: ["http://foo.bar.com/1", "http://foo.bar.com/2"], + status: typescript_axios_petstore_1.Pet.StatusEnum.Available, + tags: [] + }; + return pet; +} diff --git a/samples/client/petstore/typescript-axios/tests/default/dist/StoreApi.js b/samples/client/petstore/typescript-axios/tests/default/dist/StoreApi.js new file mode 100644 index 00000000000..dfb8d744b5e --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/dist/StoreApi.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var chai_1 = require("chai"); +var typescript_axios_petstore_1 = require("@swagger/typescript-axios-petstore"); +describe("StoreApi", function () { + function runSuite(description, requestOptions) { + describe(description, function () { + var api; + beforeEach(function () { + api = new typescript_axios_petstore_1.StoreApi(); + }); + it("should get inventory", function () { + return api + .getInventory(requestOptions) + .then(function (result) { + chai_1.expect(Object.keys(result)).to.not.be.empty; + }); + }); + }); + } + runSuite("without custom request options"); + runSuite("with custom request options", { + credentials: "include", + mode: "cors" + }); +}); diff --git a/samples/client/petstore/typescript-axios/tests/default/dist/StoreApiFactory.js b/samples/client/petstore/typescript-axios/tests/default/dist/StoreApiFactory.js new file mode 100644 index 00000000000..e53401fe88b --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/dist/StoreApiFactory.js @@ -0,0 +1,37 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +var chai_1 = require("chai"); +var typescript_axios_petstore_1 = require("@swagger/typescript-axios-petstore"); +var typescript_axios_petstore_2 = require("@swagger/typescript-axios-petstore"); +var config; +before(function () { + config = new typescript_axios_petstore_2.Configuration(); + config.accessToken = "foobar"; + config.apiKey = function (securityName) { + // for multiple apiKey security + if (securityName === "api_key") { + return "foobar"; + } + return; + }; + config.username = "foo"; + config.password = "bar"; +}); +describe("StoreApiFactory", function () { + function runSuite(description, requestOptions) { + describe(description, function () { + it("should get inventory", function () { + return typescript_axios_petstore_1.StoreApiFactory(config) + .getInventory(requestOptions) + .then(function (result) { + chai_1.expect(Object.keys(result.data)).to.not.be.empty; + }); + }); + }); + } + runSuite("without custom request options"); + runSuite("with custom request options", { + credentials: "include", + mode: "cors" + }); +}); diff --git a/samples/client/petstore/typescript-axios/tests/default/dist/index.js b/samples/client/petstore/typescript-axios/tests/default/dist/index.js new file mode 100644 index 00000000000..0b29af76274 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/dist/index.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +require("./PetApi"); +require("./StoreApi"); +require("./PetApiFactory"); +require("./StoreApiFactory"); diff --git a/samples/client/petstore/typescript-axios/tests/default/package-lock.json b/samples/client/petstore/typescript-axios/tests/default/package-lock.json new file mode 100644 index 00000000000..468690463c6 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/package-lock.json @@ -0,0 +1,5458 @@ +{ + "name": "typescript-fetch-test", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "@swagger/typescript-axios-petstore": { + "version": "file:../../builds/with-npm-version", + "requires": { + "axios": "^0.18.0" + }, + "dependencies": { + "axios": { + "version": "0.18.0", + "bundled": true, + "requires": { + "follow-redirects": "^1.3.0", + "is-buffer": "^1.1.5" + } + }, + "debug": { + "version": "3.1.0", + "bundled": true, + "requires": { + "ms": "2.0.0" + } + }, + "follow-redirects": { + "version": "1.5.8", + "bundled": true, + "requires": { + "debug": "=3.1.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "bundled": true + }, + "ms": { + "version": "2.0.0", + "bundled": true + } + } + }, + "@types/chai": { + "version": "4.1.4", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.1.4.tgz", + "integrity": "sha512-h6+VEw2Vr3ORiFCyyJmcho2zALnUq9cvdB/IO8Xs9itrJVCenC7o26A6+m7D0ihTTr65eS259H5/Ghl/VjYs6g==", + "dev": true + }, + "@types/mocha": { + "version": "2.2.48", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-2.2.48.tgz", + "integrity": "sha512-nlK/iyETgafGli8Zh9zJVCTicvU3iajSkRwOh3Hhiva598CMqNJ4NcVCGMTGKpGpTYj/9R8RLzS9NAykSSCqGw==", + "dev": true + }, + "@types/node": { + "version": "8.10.29", + "resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.29.tgz", + "integrity": "sha512-zbteaWZ2mdduacm0byELwtRyhYE40aK+pAanQk415gr1eRuu67x7QGOLmn8jz5zI8LDK7d0WI/oT6r5Trz4rzQ==", + "dev": true + }, + "JSONStream": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.4.tgz", + "integrity": "sha512-Y7vfi3I5oMOYIr+WxV8NZxDSwcbNgzdKYsTNInmycOq9bUYwGg9ryu57Wg5NLmCjqdFPNUmpMBo3kSJN9tCbXg==", + "dev": true, + "requires": { + "jsonparse": "^1.2.0", + "through": ">=2.2.7 <3" + } + }, + "abbrev": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", + "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", + "dev": true + }, + "acorn": { + "version": "5.7.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.3.tgz", + "integrity": "sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw==", + "dev": true + }, + "acorn-dynamic-import": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz", + "integrity": "sha512-zVWV8Z8lislJoOKKqdNMOB+s6+XV5WERty8MnKBeFgwA+19XJjJHs2RP5dzM57FftIs+jQnRToLiWazKr6sSWg==", + "dev": true, + "requires": { + "acorn": "^5.0.0" + } + }, + "acorn-node": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/acorn-node/-/acorn-node-1.5.2.tgz", + "integrity": "sha512-krFKvw/d1F17AN3XZbybIUzEY4YEPNiGo05AfP3dBlfVKrMHETKpgjpuZkSF8qDNt9UkQcqj7am8yJLseklCMg==", + "dev": true, + "requires": { + "acorn": "^5.7.1", + "acorn-dynamic-import": "^3.0.0", + "xtend": "^4.0.1" + } + }, + "agent-base": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-2.1.1.tgz", + "integrity": "sha1-1t4Q1a9hMtW9aSQn1G/FOFOQlMc=", + "dev": true, + "requires": { + "extend": "~3.0.0", + "semver": "~5.0.1" + }, + "dependencies": { + "semver": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.0.3.tgz", + "integrity": "sha1-d0Zt5YnNXTyV8TiqeLxWmjy10no=", + "dev": true + } + } + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { + "kind-of": "^3.0.2", + "longest": "^1.0.1", + "repeat-string": "^1.5.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "ansi-align": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-2.0.0.tgz", + "integrity": "sha1-w2rsy6VjuJzrVW82kPCx2eNUf38=", + "dev": true, + "requires": { + "string-width": "^2.0.0" + } + }, + "ansi-escapes": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", + "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "^1.9.0" + } + }, + "any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha1-q8av7tzqUugJzcA3au0845Y10X8=", + "dev": true + }, + "anymatch": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "requires": { + "micromatch": "^2.1.5", + "normalize-path": "^2.0.0" + }, + "dependencies": { + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "requires": { + "arr-flatten": "^1.0.1" + } + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "requires": { + "expand-range": "^1.8.1", + "preserve": "^0.2.0", + "repeat-element": "^1.1.2" + } + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "requires": { + "is-posix-bracket": "^0.1.0" + } + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "requires": { + "arr-diff": "^2.0.0", + "array-unique": "^0.2.1", + "braces": "^1.8.2", + "expand-brackets": "^0.1.4", + "extglob": "^0.3.1", + "filename-regex": "^2.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.1", + "kind-of": "^3.0.2", + "normalize-path": "^2.0.1", + "object.omit": "^2.0.0", + "parse-glob": "^3.0.4", + "regex-cache": "^0.4.2" + } + } + } + }, + "archy": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/archy/-/archy-1.0.0.tgz", + "integrity": "sha1-+cjBN1fMHde8N5rHeyxipcKGjEA=", + "dev": true + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-filter": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/array-filter/-/array-filter-0.0.1.tgz", + "integrity": "sha1-fajPLiZijtcygDWB/SH2fKzS7uw=", + "dev": true + }, + "array-map": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/array-map/-/array-map-0.0.0.tgz", + "integrity": "sha1-iKK6tz0c97zVwbEYoAP2b2ZfpmI=", + "dev": true + }, + "array-reduce": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/array-reduce/-/array-reduce-0.0.0.tgz", + "integrity": "sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys=", + "dev": true + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=" + }, + "asn1.js": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", + "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "assert": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", + "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "dev": true, + "requires": { + "util": "0.10.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", + "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "dev": true + }, + "util": { + "version": "0.10.3", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", + "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", + "dev": true, + "requires": { + "inherits": "2.0.1" + } + } + } + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==" + }, + "assign-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", + "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "dev": true + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true + }, + "asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "dev": true + }, + "atob": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", + "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "dev": true + }, + "axios": { + "version": "0.18.0", + "resolved": "http://registry.npmjs.org/axios/-/axios-0.18.0.tgz", + "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=", + "requires": { + "follow-redirects": "^1.3.0", + "is-buffer": "^1.1.5" + } + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "requires": { + "cache-base": "^1.0.1", + "class-utils": "^0.3.5", + "component-emitter": "^1.2.1", + "define-property": "^1.0.0", + "isobject": "^3.0.1", + "mixin-deep": "^1.2.0", + "pascalcase": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "base64-js": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", + "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", + "dev": true + }, + "big.js": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", + "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", + "dev": true + }, + "binary-extensions": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.11.0.tgz", + "integrity": "sha1-RqoXUftqL5PuXmibsQh9SxTGwgU=", + "dev": true + }, + "bluebird": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.2.tgz", + "integrity": "sha512-dhHTWMI7kMx5whMQntl7Vr9C6BvV10lFXDAasnqnrMYhXVCzzk6IO9Fo2L75jXHT07WrOngL1WDXOp+yYS91Yg==", + "dev": true + }, + "bn.js": { + "version": "4.11.8", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", + "integrity": "sha512-ItfYfPLkWHUjckQCk8xC+LwxgK8NYcXywGigJgSwOP8Y2iyWT4f2vsZnoOXTTbo+o5yXmIUJ4gn5538SO5S3gA==", + "dev": true + }, + "boxen": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/boxen/-/boxen-1.3.0.tgz", + "integrity": "sha512-TNPjfTr432qx7yOjQyaXm3dSR0MH9vXp7eT1BFSl/C51g+EFnOR9hTg1IreahGBmDNCehscshe45f+C1TBZbLw==", + "dev": true, + "requires": { + "ansi-align": "^2.0.0", + "camelcase": "^4.0.0", + "chalk": "^2.0.1", + "cli-boxes": "^1.0.0", + "string-width": "^2.0.0", + "term-size": "^1.2.0", + "widest-line": "^2.0.0" + } + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", + "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "dev": true, + "requires": { + "arr-flatten": "^1.1.0", + "array-unique": "^0.3.2", + "extend-shallow": "^2.0.1", + "fill-range": "^4.0.0", + "isobject": "^3.0.1", + "repeat-element": "^1.1.2", + "snapdragon": "^0.8.1", + "snapdragon-node": "^2.0.1", + "split-string": "^3.0.2", + "to-regex": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", + "dev": true + }, + "browser-pack": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/browser-pack/-/browser-pack-6.1.0.tgz", + "integrity": "sha512-erYug8XoqzU3IfcU8fUgyHqyOXqIE4tUTTQ+7mqUjQlvnXkOO6OlT9c/ZoJVHYoAaqGxr09CN53G7XIsO4KtWA==", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "combine-source-map": "~0.8.0", + "defined": "^1.0.0", + "safe-buffer": "^5.1.1", + "through2": "^2.0.0", + "umd": "^3.0.0" + } + }, + "browser-resolve": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.3.tgz", + "integrity": "sha512-exDi1BYWB/6raKHmDTCicQfTkqwN5fioMFV4j8BsfMU4R2DK/QfZfK7kOVkmWCNANf0snkBzqGqAJBao9gZMdQ==", + "dev": true, + "requires": { + "resolve": "1.1.7" + }, + "dependencies": { + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + } + } + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "browserify": { + "version": "14.5.0", + "resolved": "https://registry.npmjs.org/browserify/-/browserify-14.5.0.tgz", + "integrity": "sha512-gKfOsNQv/toWz+60nSPfYzuwSEdzvV2WdxrVPUbPD/qui44rAkB3t3muNtmmGYHqrG56FGwX9SUEQmzNLAeS7g==", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "assert": "^1.4.0", + "browser-pack": "^6.0.1", + "browser-resolve": "^1.11.0", + "browserify-zlib": "~0.2.0", + "buffer": "^5.0.2", + "cached-path-relative": "^1.0.0", + "concat-stream": "~1.5.1", + "console-browserify": "^1.1.0", + "constants-browserify": "~1.0.0", + "crypto-browserify": "^3.0.0", + "defined": "^1.0.0", + "deps-sort": "^2.0.0", + "domain-browser": "~1.1.0", + "duplexer2": "~0.1.2", + "events": "~1.1.0", + "glob": "^7.1.0", + "has": "^1.0.0", + "htmlescape": "^1.1.0", + "https-browserify": "^1.0.0", + "inherits": "~2.0.1", + "insert-module-globals": "^7.0.0", + "labeled-stream-splicer": "^2.0.0", + "module-deps": "^4.0.8", + "os-browserify": "~0.3.0", + "parents": "^1.0.1", + "path-browserify": "~0.0.0", + "process": "~0.11.0", + "punycode": "^1.3.2", + "querystring-es3": "~0.2.0", + "read-only-stream": "^2.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.1.4", + "shasum": "^1.0.0", + "shell-quote": "^1.6.1", + "stream-browserify": "^2.0.0", + "stream-http": "^2.0.0", + "string_decoder": "~1.0.0", + "subarg": "^1.0.0", + "syntax-error": "^1.1.1", + "through2": "^2.0.0", + "timers-browserify": "^1.0.1", + "tty-browserify": "~0.0.0", + "url": "~0.11.0", + "util": "~0.10.1", + "vm-browserify": "~0.0.1", + "xtend": "^4.0.0" + } + }, + "browserify-aes": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", + "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", + "dev": true, + "requires": { + "buffer-xor": "^1.0.3", + "cipher-base": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.3", + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "browserify-cipher": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", + "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", + "dev": true, + "requires": { + "browserify-aes": "^1.0.4", + "browserify-des": "^1.0.0", + "evp_bytestokey": "^1.0.0" + } + }, + "browserify-des": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.2.tgz", + "integrity": "sha512-BioO1xf3hFwz4kc6iBhI3ieDFompMhrMlnDFC4/0/vd5MokpuAc3R+LYbwTA9A5Yc9pq9UYPqffKpW2ObuwX5A==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "des.js": "^1.0.0", + "inherits": "^2.0.1", + "safe-buffer": "^5.1.2" + } + }, + "browserify-rsa": { + "version": "4.0.1", + "resolved": "http://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", + "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "randombytes": "^2.0.1" + } + }, + "browserify-sign": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", + "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "dev": true, + "requires": { + "bn.js": "^4.1.1", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.2", + "elliptic": "^6.0.0", + "inherits": "^2.0.1", + "parse-asn1": "^5.0.0" + } + }, + "browserify-zlib": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", + "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", + "dev": true, + "requires": { + "pako": "~1.0.5" + } + }, + "buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.2.1.tgz", + "integrity": "sha512-c+Ko0loDaFfuPWiL02ls9Xd3GO3cPVmUobQ6t3rXNUk304u6hGq+8N/kFi+QEIKhzK3uwolVhLzszmfLmMLnqg==", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4" + } + }, + "buffer-from": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.1.tgz", + "integrity": "sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A==", + "dev": true + }, + "buffer-xor": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", + "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", + "dev": true + }, + "builtin-status-codes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", + "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "dev": true + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "requires": { + "collection-visit": "^1.0.0", + "component-emitter": "^1.2.1", + "get-value": "^2.0.6", + "has-value": "^1.0.0", + "isobject": "^3.0.1", + "set-value": "^2.0.0", + "to-object-path": "^0.3.0", + "union-value": "^1.0.0", + "unset-value": "^1.0.0" + } + }, + "cached-path-relative": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cached-path-relative/-/cached-path-relative-1.0.1.tgz", + "integrity": "sha1-0JxLUoAKpMB44t2BqGmqyQ0uVOc=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "capture-stack-trace": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz", + "integrity": "sha512-mYQLZnx5Qt1JgB1WEiMCf2647plpGeQ2NMR/5L0HNZzGQo4fuSPnK+wjfPnKZV0aiJDgzmWqqkV/g7JD+DW0qw==", + "dev": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true, + "requires": { + "align-text": "^0.1.3", + "lazy-cache": "^1.0.3" + } + }, + "chai": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", + "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", + "requires": { + "assertion-error": "^1.0.1", + "check-error": "^1.0.1", + "deep-eql": "^3.0.0", + "get-func-name": "^2.0.0", + "pathval": "^1.0.0", + "type-detect": "^4.0.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=" + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "dev": true, + "requires": { + "anymatch": "^1.3.0", + "async-each": "^1.0.0", + "fsevents": "^1.0.0", + "glob-parent": "^2.0.0", + "inherits": "^2.0.1", + "is-binary-path": "^1.0.0", + "is-glob": "^2.0.0", + "path-is-absolute": "^1.0.0", + "readdirp": "^2.0.0" + } + }, + "ci-info": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-1.5.1.tgz", + "integrity": "sha512-fKFIKXaYiL1exImwJ0AhR/6jxFPSKQBk2ayV5NiNoruUs2+rxC2kNw0EG+1Z9dugZRdCrppskQ8DN2cyaUM1Hw==", + "dev": true + }, + "cipher-base": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", + "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "class-utils": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", + "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "define-property": "^0.2.5", + "isobject": "^3.0.0", + "static-extend": "^0.1.1" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "cli-boxes": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-1.0.0.tgz", + "integrity": "sha1-T6kXw+WclKAEzWH47lCdplFocUM=", + "dev": true + }, + "cli-cursor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", + "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", + "dev": true, + "requires": { + "restore-cursor": "^1.0.1" + } + }, + "cli-truncate": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-1.1.0.tgz", + "integrity": "sha512-bAtZo0u82gCfaAGfSNxUdTI9mNyza7D8w4CVCcaOsy7sgwDzvx6ekr6cuWJqY3UGzgnQ1+4wgENup5eIhgxEYA==", + "dev": true, + "requires": { + "slice-ansi": "^1.0.0", + "string-width": "^2.0.0" + } + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true, + "requires": { + "center-align": "^0.1.1", + "right-align": "^0.1.1", + "wordwrap": "0.0.2" + }, + "dependencies": { + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true + } + } + }, + "clone": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/clone/-/clone-1.0.4.tgz", + "integrity": "sha1-2jCcwmPfFZlMaIypAheco8fNfH4=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true, + "requires": { + "map-visit": "^1.0.0", + "object-visit": "^1.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, + "columnify": { + "version": "1.5.4", + "resolved": "https://registry.npmjs.org/columnify/-/columnify-1.5.4.tgz", + "integrity": "sha1-Rzfd8ce2mop8NAVweC6UfuyOeLs=", + "dev": true, + "requires": { + "strip-ansi": "^3.0.0", + "wcwidth": "^1.0.0" + } + }, + "combine-source-map": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/combine-source-map/-/combine-source-map-0.8.0.tgz", + "integrity": "sha1-pY0N8ELBhvz4IqjoAV9UUNLXmos=", + "dev": true, + "requires": { + "convert-source-map": "~1.1.0", + "inline-source-map": "~0.6.0", + "lodash.memoize": "~3.0.3", + "source-map": "~0.5.3" + } + }, + "combined-stream": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", + "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", + "dev": true, + "requires": { + "delayed-stream": "~1.0.0" + } + }, + "commander": { + "version": "2.9.0", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "requires": { + "graceful-readlink": ">= 1.0.0" + } + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.5.2.tgz", + "integrity": "sha1-cIl4Yk2FavQaWnQd790mHadSwmY=", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "~2.0.0", + "typedarray": "~0.0.5" + }, + "dependencies": { + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true + }, + "readable-stream": { + "version": "2.0.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz", + "integrity": "sha1-j5A0HmilPMySh4jaz80Rs265t44=", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.1", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "string_decoder": "~0.10.x", + "util-deprecate": "~1.0.1" + } + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + } + } + }, + "configstore": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-3.1.2.tgz", + "integrity": "sha512-vtv5HtGjcYUgFrXc6Kx747B83MRRVS5R1VTEQoXvuP+kMI+if6uywV0nDGoiydJRy4yk7h9od5Og0kxx4zUXmw==", + "dev": true, + "requires": { + "dot-prop": "^4.1.0", + "graceful-fs": "^4.1.2", + "make-dir": "^1.0.0", + "unique-string": "^1.0.0", + "write-file-atomic": "^2.0.0", + "xdg-basedir": "^3.0.0" + } + }, + "console-browserify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", + "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", + "dev": true, + "requires": { + "date-now": "^0.1.4" + } + }, + "constants-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", + "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", + "dev": true + }, + "convert-source-map": { + "version": "1.1.3", + "resolved": "http://registry.npmjs.org/convert-source-map/-/convert-source-map-1.1.3.tgz", + "integrity": "sha1-SCnId+n+SbMWHzvzZziI4gRpmGA=", + "dev": true + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "create-ecdh": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", + "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "elliptic": "^6.0.0" + } + }, + "create-error-class": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/create-error-class/-/create-error-class-3.0.2.tgz", + "integrity": "sha1-Br56vvlHo/FKMP1hBnHUAbyot7Y=", + "dev": true, + "requires": { + "capture-stack-trace": "^1.0.0" + } + }, + "create-hash": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", + "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.1", + "inherits": "^2.0.1", + "md5.js": "^1.3.4", + "ripemd160": "^2.0.1", + "sha.js": "^2.4.0" + } + }, + "create-hmac": { + "version": "1.1.7", + "resolved": "http://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", + "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", + "dev": true, + "requires": { + "cipher-base": "^1.0.3", + "create-hash": "^1.1.0", + "inherits": "^2.0.1", + "ripemd160": "^2.0.0", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "^4.0.1", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dev": true, + "requires": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + } + }, + "crypto-random-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-1.0.0.tgz", + "integrity": "sha1-ojD2T1aDEOFJgAmUB5DsmVRbyn4=", + "dev": true + }, + "date-now": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", + "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", + "dev": true + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "decode-uri-component": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", + "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", + "dev": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "requires": { + "type-detect": "^4.0.0" + } + }, + "deep-extend": { + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", + "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "dev": true + }, + "defaults": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.3.tgz", + "integrity": "sha1-xlYFHpgX2f8I7YgUd/P+QBnz730=", + "dev": true, + "requires": { + "clone": "^1.0.2" + } + }, + "define-property": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", + "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "dev": true, + "requires": { + "is-descriptor": "^1.0.2", + "isobject": "^3.0.1" + }, + "dependencies": { + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "defined": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", + "dev": true + }, + "delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "dev": true + }, + "deps-sort": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/deps-sort/-/deps-sort-2.0.0.tgz", + "integrity": "sha1-CRckkC6EZYJg65EHSMzNGvbiH7U=", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "shasum": "^1.0.0", + "subarg": "^1.0.0", + "through2": "^2.0.0" + } + }, + "des.js": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", + "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0" + } + }, + "detect-indent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-5.0.0.tgz", + "integrity": "sha1-OHHMCmoALow+Wzz38zYmRnXwa50=", + "dev": true + }, + "detective": { + "version": "4.7.1", + "resolved": "https://registry.npmjs.org/detective/-/detective-4.7.1.tgz", + "integrity": "sha512-H6PmeeUcZloWtdt4DAkFyzFL94arpHr3NOwwmVILFiy+9Qd4JTxxXrzfyGk/lmct2qVGBwTSwSXagqu2BxmWig==", + "dev": true, + "requires": { + "acorn": "^5.2.1", + "defined": "^1.0.0" + } + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==" + }, + "diffie-hellman": { + "version": "5.0.3", + "resolved": "http://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", + "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "miller-rabin": "^4.0.0", + "randombytes": "^2.0.0" + } + }, + "domain-browser": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.1.7.tgz", + "integrity": "sha1-hnqksJP6oF8d4IwG9NeyH9+GmLw=", + "dev": true + }, + "dot-prop": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-4.2.0.tgz", + "integrity": "sha512-tUMXrxlExSW6U2EXiiKGSBVdYgtV8qlHL+C10TsW4PURY/ic+eaysnSkwB4kA/mBlCyy/IKDJ+Lc3wbWeaXtuQ==", + "dev": true, + "requires": { + "is-obj": "^1.0.0" + } + }, + "duplexer2": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", + "integrity": "sha1-ixLauHjA1p4+eJEFFmKjL8a93ME=", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "duplexer3": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", + "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", + "dev": true + }, + "elegant-spinner": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/elegant-spinner/-/elegant-spinner-1.0.1.tgz", + "integrity": "sha1-2wQ1IcldfjA/2PNFvtwzSc+wcp4=", + "dev": true + }, + "elliptic": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.1.tgz", + "integrity": "sha512-BsXLz5sqX8OHcsh7CqBMztyXARmGQ3LWPtGjJi6DiJHq5C/qvi9P3OqgswKSDftbu8+IoI/QDTAm2fFnQ9SZSQ==", + "dev": true, + "requires": { + "bn.js": "^4.4.0", + "brorand": "^1.0.1", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.0", + "inherits": "^2.0.1", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.0" + } + }, + "emojis-list": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", + "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", + "dev": true + }, + "enhanced-resolve": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz", + "integrity": "sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.4.0", + "tapable": "^1.0.0" + } + }, + "errno": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", + "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", + "dev": true, + "requires": { + "prr": "~1.0.1" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "events": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", + "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", + "dev": true + }, + "evp_bytestokey": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", + "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", + "dev": true, + "requires": { + "md5.js": "^1.3.4", + "safe-buffer": "^5.1.1" + } + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true, + "requires": { + "cross-spawn": "^5.0.1", + "get-stream": "^3.0.0", + "is-stream": "^1.1.0", + "npm-run-path": "^2.0.0", + "p-finally": "^1.0.0", + "signal-exit": "^3.0.0", + "strip-eof": "^1.0.0" + } + }, + "exit-hook": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", + "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", + "dev": true + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "requires": { + "debug": "^2.3.3", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "posix-character-classes": "^0.1.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "requires": { + "fill-range": "^2.1.0" + }, + "dependencies": { + "fill-range": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", + "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "dev": true, + "requires": { + "is-number": "^2.1.0", + "isobject": "^2.0.0", + "randomatic": "^3.0.0", + "repeat-element": "^1.1.2", + "repeat-string": "^1.5.2" + } + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + } + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "extend": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", + "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==", + "dev": true + }, + "extend-shallow": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", + "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", + "dev": true, + "requires": { + "assign-symbols": "^1.0.0", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "extglob": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", + "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "dev": true, + "requires": { + "array-unique": "^0.3.2", + "define-property": "^1.0.0", + "expand-brackets": "^2.1.4", + "extend-shallow": "^2.0.1", + "fragment-cache": "^0.2.1", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-number": "^3.0.0", + "repeat-string": "^1.6.1", + "to-regex-range": "^2.1.0" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "follow-redirects": { + "version": "1.5.8", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.8.tgz", + "integrity": "sha512-sy1mXPmv7kLAMKW/8XofG7o9T+6gAjzdZK4AJF6ryqQYUa/hnzgiypoeUecZ53x7XiqKNEpNqLtS97MshW2nxg==", + "requires": { + "debug": "=3.1.0" + } + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "requires": { + "for-in": "^1.0.1" + } + }, + "form-data": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.2.tgz", + "integrity": "sha1-SXBJi+YEwgwAXU9cI67NIda0kJk=", + "dev": true, + "requires": { + "asynckit": "^0.4.0", + "combined-stream": "1.0.6", + "mime-types": "^2.1.12" + } + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true, + "requires": { + "map-cache": "^0.2.2" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", + "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "dev": true, + "optional": true, + "requires": { + "nan": "^2.9.2", + "node-pre-gyp": "^0.10.0" + }, + "dependencies": { + "abbrev": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "delegates": "^1.0.0", + "readable-stream": "^2.0.6" + } + }, + "balanced-match": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "bundled": true, + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "chownr": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "debug": { + "version": "2.6.9", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ms": "2.0.0" + } + }, + "deep-extend": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "optional": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "detect-libc": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "fs-minipass": { + "version": "1.2.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "aproba": "^1.0.3", + "console-control-strings": "^1.0.0", + "has-unicode": "^2.0.0", + "object-assign": "^4.1.0", + "signal-exit": "^3.0.0", + "string-width": "^1.0.1", + "strip-ansi": "^3.0.1", + "wide-align": "^1.1.0" + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "iconv-lite": { + "version": "0.4.21", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safer-buffer": "^2.1.0" + } + }, + "ignore-walk": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minimatch": "^3.0.4" + } + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.5", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "requires": { + "number-is-nan": "^1.0.0" + } + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "minipass": { + "version": "2.2.4", + "bundled": true, + "dev": true, + "requires": { + "safe-buffer": "^5.1.1", + "yallist": "^3.0.0" + } + }, + "minizlib": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "minipass": "^2.2.1" + } + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "needle": { + "version": "2.2.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "debug": "^2.1.2", + "iconv-lite": "^0.4.4", + "sax": "^1.2.4" + } + }, + "node-pre-gyp": { + "version": "0.10.0", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "detect-libc": "^1.0.2", + "mkdirp": "^0.5.1", + "needle": "^2.2.0", + "nopt": "^4.0.1", + "npm-packlist": "^1.1.6", + "npmlog": "^4.0.2", + "rc": "^1.1.7", + "rimraf": "^2.6.1", + "semver": "^5.3.0", + "tar": "^4" + } + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "abbrev": "1", + "osenv": "^0.1.4" + } + }, + "npm-bundled": { + "version": "1.0.3", + "bundled": true, + "dev": true, + "optional": true + }, + "npm-packlist": { + "version": "1.1.10", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "ignore-walk": "^3.0.1", + "npm-bundled": "^1.0.1" + } + }, + "npmlog": { + "version": "4.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "are-we-there-yet": "~1.1.2", + "console-control-strings": "~1.1.0", + "gauge": "~2.7.3", + "set-blocking": "~2.0.0" + } + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.5", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "os-homedir": "^1.0.0", + "os-tmpdir": "^1.0.0" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.7", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "deep-extend": "^0.5.1", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + }, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.3.6", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + } + }, + "rimraf": { + "version": "2.6.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "glob": "^7.0.5" + } + }, + "safe-buffer": { + "version": "5.1.1", + "bundled": true, + "dev": true + }, + "safer-buffer": { + "version": "2.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sax": { + "version": "1.2.4", + "bundled": true, + "dev": true, + "optional": true + }, + "semver": { + "version": "5.5.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "requires": { + "code-point-at": "^1.0.0", + "is-fullwidth-code-point": "^1.0.0", + "strip-ansi": "^3.0.0" + } + }, + "string_decoder": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "4.4.1", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "chownr": "^1.0.1", + "fs-minipass": "^1.2.5", + "minipass": "^2.2.4", + "minizlib": "^1.1.0", + "mkdirp": "^0.5.0", + "safe-buffer": "^5.1.1", + "yallist": "^3.0.2" + } + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "optional": true, + "requires": { + "string-width": "^1.0.2" + } + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "yallist": { + "version": "3.0.2", + "bundled": true, + "dev": true + } + } + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "get-assigned-identifiers": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/get-assigned-identifiers/-/get-assigned-identifiers-1.2.0.tgz", + "integrity": "sha512-mBBwmeGTrxEMO4pMaaf/uUEFHnYtwr8FTe8Y/mer4rcV/bye0qGm6pw1bGZFGStxC5O76c5ZAVBGnqHmOaJpdQ==", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=" + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "glob": { + "version": "7.1.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", + "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "requires": { + "glob-parent": "^2.0.0", + "is-glob": "^2.0.0" + } + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true, + "requires": { + "is-glob": "^2.0.0" + } + }, + "global-dirs": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", + "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", + "dev": true, + "requires": { + "ini": "^1.3.4" + } + }, + "got": { + "version": "6.7.1", + "resolved": "http://registry.npmjs.org/got/-/got-6.7.1.tgz", + "integrity": "sha1-JAzQV4WpoY5WHcG0S0HHY+8ejbA=", + "dev": true, + "requires": { + "create-error-class": "^3.0.0", + "duplexer3": "^0.1.4", + "get-stream": "^3.0.0", + "is-redirect": "^1.0.0", + "is-retry-allowed": "^1.0.0", + "is-stream": "^1.0.0", + "lowercase-keys": "^1.0.0", + "safe-buffer": "^5.0.1", + "timed-out": "^4.0.0", + "unzip-response": "^2.0.1", + "url-parse-lax": "^1.0.0" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, + "growl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "has-unicode": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "requires": { + "get-value": "^2.0.6", + "has-values": "^1.0.0", + "isobject": "^3.0.0" + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "kind-of": "^4.0.0" + }, + "dependencies": { + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "hash-base": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", + "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "hash.js": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.5.tgz", + "integrity": "sha512-eWI5HG9Np+eHV1KQhisXWwM+4EPPYe5dFX1UZZH7k/E3JzDEazVH+VGlZi6R94ZqImq+A3D1mCEtrFIfg/E7sA==", + "dev": true, + "requires": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", + "dev": true, + "requires": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "homedir-polyfill": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.1.tgz", + "integrity": "sha1-TCu8inWJmP7r9e1oWA921GdotLw=", + "requires": { + "parse-passwd": "^1.0.0" + } + }, + "htmlescape": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", + "integrity": "sha1-OgPtwiFLyjtmQko+eVk0lQnLA1E=", + "dev": true + }, + "http-proxy-agent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-1.0.0.tgz", + "integrity": "sha1-zBzjjkU7+YSg93AtLdWcc9CBKEo=", + "dev": true, + "requires": { + "agent-base": "2", + "debug": "2", + "extend": "3" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "https-browserify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", + "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", + "dev": true + }, + "https-proxy-agent": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-1.0.0.tgz", + "integrity": "sha1-NffabEjOTdv6JkiRrFk+5f+GceY=", + "dev": true, + "requires": { + "agent-base": "2", + "debug": "2", + "extend": "3" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "ieee754": { + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", + "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==", + "dev": true + }, + "import-lazy": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", + "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "indexof": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", + "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "ini": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", + "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", + "dev": true + }, + "inline-source-map": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/inline-source-map/-/inline-source-map-0.6.2.tgz", + "integrity": "sha1-+Tk0ccGKedFyT4Y/o4tYY3Ct4qU=", + "dev": true, + "requires": { + "source-map": "~0.5.3" + } + }, + "insert-module-globals": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/insert-module-globals/-/insert-module-globals-7.2.0.tgz", + "integrity": "sha512-VE6NlW+WGn2/AeOMd496AHFYmE7eLKkUY6Ty31k4og5vmA3Fjuwe9v6ifH6Xx/Hz27QvdoMoviw1/pqWRB09Sw==", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "acorn-node": "^1.5.2", + "combine-source-map": "^0.8.0", + "concat-stream": "^1.6.1", + "is-buffer": "^1.1.0", + "path-is-absolute": "^1.0.1", + "process": "~0.11.0", + "through2": "^2.0.0", + "undeclared-identifiers": "^1.1.2", + "xtend": "^4.0.0" + }, + "dependencies": { + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" + } + } + } + }, + "interpret": { + "version": "0.6.6", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-0.6.6.tgz", + "integrity": "sha1-/s16GOfOXKar+5U+H4YhOknxYls=", + "dev": true + }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, + "is-absolute": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-0.2.6.tgz", + "integrity": "sha1-IN5p89uULvLYe5wto28XIjWxtes=", + "dev": true, + "requires": { + "is-relative": "^0.2.1", + "is-windows": "^0.2.0" + }, + "dependencies": { + "is-windows": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-0.2.0.tgz", + "integrity": "sha1-3hqm1j6indJIc3tp8f+LgALSEIw=", + "dev": true + } + } + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "requires": { + "binary-extensions": "^1.0.0" + } + }, + "is-buffer": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", + "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==" + }, + "is-ci": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-1.2.1.tgz", + "integrity": "sha512-s6tfsaQaQi3JNciBH6shVqEDvhGut0SUXr31ag8Pd8BBbVVlcGfWhpPmEOoM6RJ5TFhbypvf5yyRw/VXW1IiWg==", + "dev": true, + "requires": { + "ci-info": "^1.5.0" + } + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^0.1.6", + "is-data-descriptor": "^0.1.4", + "kind-of": "^5.0.0" + }, + "dependencies": { + "kind-of": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", + "dev": true + } + } + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "requires": { + "is-primitive": "^2.0.0" + } + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true, + "requires": { + "is-extglob": "^1.0.0" + } + }, + "is-installed-globally": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.1.0.tgz", + "integrity": "sha1-Df2Y9akRFxbdU13aZJL2e/PSWoA=", + "dev": true, + "requires": { + "global-dirs": "^0.1.0", + "is-path-inside": "^1.0.0" + } + }, + "is-npm": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-1.0.0.tgz", + "integrity": "sha1-8vtjpl5JBbQGyGBydloaTceTufQ=", + "dev": true + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "is-obj": { + "version": "1.0.1", + "resolved": "http://registry.npmjs.org/is-obj/-/is-obj-1.0.1.tgz", + "integrity": "sha1-PkcprB9f3gJc19g6iW2rn09n2w8=", + "dev": true + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "dev": true, + "requires": { + "path-is-inside": "^1.0.1" + } + }, + "is-plain-obj": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-1.1.0.tgz", + "integrity": "sha1-caUMhCnfync8kqOQpKA7OfzVHT4=", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-redirect": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-redirect/-/is-redirect-1.0.0.tgz", + "integrity": "sha1-HQPd7VO9jbDzDCbk+V02/HyH3CQ=", + "dev": true + }, + "is-relative": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-0.2.1.tgz", + "integrity": "sha1-0n9MfVFtF1+2ENuEu+7yPDvJeqU=", + "dev": true, + "requires": { + "is-unc-path": "^0.1.1" + } + }, + "is-retry-allowed": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-retry-allowed/-/is-retry-allowed-1.1.0.tgz", + "integrity": "sha1-EaBgVotnM5REAz0BJaYaINVk+zQ=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "is-unc-path": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-0.1.2.tgz", + "integrity": "sha1-arBTpyVzwQJQ/0FqOBTDUXivObk=", + "dev": true, + "requires": { + "unc-path-regex": "^0.1.0" + } + }, + "is-utf8": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", + "integrity": "sha1-Sw2hRCEE0bM2NA6AeX6GXPOffXI=", + "dev": true + }, + "is-windows": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", + "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "json-stable-stringify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-0.0.1.tgz", + "integrity": "sha1-YRwj6BTbN1Un34URk9tZ3Sryf0U=", + "dev": true, + "requires": { + "jsonify": "~0.0.0" + } + }, + "json3": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "jsonify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "dev": true + }, + "jsonparse": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", + "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", + "dev": true + }, + "jspm-config": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/jspm-config/-/jspm-config-0.3.4.tgz", + "integrity": "sha1-RMJpAuSujs4jZs7cn/FrEKXzkcY=", + "dev": true, + "requires": { + "any-promise": "^1.3.0", + "graceful-fs": "^4.1.4", + "make-error-cause": "^1.2.1", + "object.pick": "^1.1.2", + "parse-json": "^2.2.0", + "strip-bom": "^3.0.0", + "thenify": "^3.2.0", + "throat": "^3.0.0", + "xtend": "^4.0.1" + } + }, + "kind-of": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", + "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", + "dev": true + }, + "labeled-stream-splicer": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/labeled-stream-splicer/-/labeled-stream-splicer-2.0.1.tgz", + "integrity": "sha512-MC94mHZRvJ3LfykJlTUipBqenZz1pacOZEMhhQ8dMGcDHs0SBE5GbsavUXV7YtP3icBW17W0Zy1I0lfASmo9Pg==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "isarray": "^2.0.4", + "stream-splicer": "^2.0.0" + }, + "dependencies": { + "isarray": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.4.tgz", + "integrity": "sha512-GMxXOiUirWg1xTKRipM0Ek07rX+ubx4nNVElTJdNLYmNO/2YrDkgJGw9CljXn+r4EWiDQg/8lsRdHyg2PJuUaA==", + "dev": true + } + } + }, + "latest-version": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-3.1.0.tgz", + "integrity": "sha1-ogU4P+oyKzO1rjsYq+4NwvNW7hU=", + "dev": true, + "requires": { + "package-json": "^4.0.0" + } + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true + }, + "listify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/listify/-/listify-1.0.0.tgz", + "integrity": "sha1-A8p7otFQ1CZ3c/dOV1WNEFPSvuM=", + "dev": true + }, + "loader-utils": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz", + "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", + "dev": true, + "requires": { + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0" + } + }, + "lockfile": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lockfile/-/lockfile-1.0.4.tgz", + "integrity": "sha512-cvbTwETRfsFh4nHsL1eGWapU1XFi5Ot9E85sWAwia7Y7EgB7vfqcZhTKZ+l7hCGxSPoushMv5GKhT5PdLv03WA==", + "dev": true, + "requires": { + "signal-exit": "^3.0.2" + } + }, + "lodash._baseassign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "dev": true, + "requires": { + "lodash._basecopy": "^3.0.0", + "lodash.keys": "^3.0.0" + } + }, + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basecreate": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", + "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.create": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", + "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", + "dev": true, + "requires": { + "lodash._baseassign": "^3.0.0", + "lodash._basecreate": "^3.0.0", + "lodash._isiterateecall": "^3.0.0" + } + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" + } + }, + "lodash.memoize": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", + "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", + "dev": true + }, + "log-update": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/log-update/-/log-update-1.0.2.tgz", + "integrity": "sha1-GZKfZMQJPS0ucHWh2tivWcKWuNE=", + "dev": true, + "requires": { + "ansi-escapes": "^1.0.0", + "cli-cursor": "^1.0.2" + } + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, + "lowercase-keys": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", + "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", + "dev": true + }, + "lru-cache": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", + "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", + "dev": true, + "requires": { + "pseudomap": "^1.0.2", + "yallist": "^2.1.2" + } + }, + "make-dir": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", + "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", + "dev": true, + "requires": { + "pify": "^3.0.0" + } + }, + "make-error": { + "version": "1.3.5", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.5.tgz", + "integrity": "sha512-c3sIjNUow0+8swNwVpqoH4YCShKNFkMaw6oH1mNS2haDZQqkeZFlHS3dhoeEbKKmJB4vXpJucU6oH75aDYeE9g==" + }, + "make-error-cause": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/make-error-cause/-/make-error-cause-1.2.2.tgz", + "integrity": "sha1-3wOI/NCzeBbf8KX7gQiTl3fcvJ0=", + "dev": true, + "requires": { + "make-error": "^1.2.0" + } + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true, + "requires": { + "object-visit": "^1.0.0" + } + }, + "math-random": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.1.tgz", + "integrity": "sha1-izqsWIuKZuSXXjzepn97sylgH6w=", + "dev": true + }, + "md5.js": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", + "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "memory-fs": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", + "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "micromatch": { + "version": "3.1.10", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", + "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "braces": "^2.3.1", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "extglob": "^2.0.4", + "fragment-cache": "^0.2.1", + "kind-of": "^6.0.2", + "nanomatch": "^1.2.9", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.2" + } + }, + "miller-rabin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", + "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", + "dev": true, + "requires": { + "bn.js": "^4.0.0", + "brorand": "^1.0.1" + } + }, + "mime-db": { + "version": "1.36.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.36.0.tgz", + "integrity": "sha512-L+xvyD9MkoYMXb1jAmzI/lWYAxAMCPvIBSWur0PZ5nOf5euahRLVqH//FKW9mWp2lkqUgYiXPgkzfMUFi4zVDw==", + "dev": true + }, + "mime-types": { + "version": "2.1.20", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.20.tgz", + "integrity": "sha512-HrkrPaP9vGuWbLK1B1FfgAkbqNjIuy4eHlIYnFi7kamZyLLrGlo2mpcx0bBmNpKqBtYtAfGbodDddIgddSJC2A==", + "dev": true, + "requires": { + "mime-db": "~1.36.0" + } + }, + "minimalistic-assert": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", + "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", + "dev": true + }, + "minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.0", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" + }, + "mixin-deep": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", + "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "dev": true, + "requires": { + "for-in": "^1.0.2", + "is-extendable": "^1.0.1" + }, + "dependencies": { + "is-extendable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", + "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4" + } + } + } + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + }, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + } + } + }, + "mocha": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", + "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.9.0", + "debug": "2.6.8", + "diff": "3.2.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.1", + "growl": "1.9.2", + "he": "1.1.1", + "json3": "3.3.2", + "lodash.create": "3.1.1", + "mkdirp": "0.5.1", + "supports-color": "3.1.2" + }, + "dependencies": { + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "diff": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "dev": true + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "supports-color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "dev": true, + "requires": { + "has-flag": "^1.0.0" + } + } + } + }, + "module-deps": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/module-deps/-/module-deps-4.1.1.tgz", + "integrity": "sha1-IyFYM/HaE/1gbMuAh7RIUty4If0=", + "dev": true, + "requires": { + "JSONStream": "^1.0.3", + "browser-resolve": "^1.7.0", + "cached-path-relative": "^1.0.0", + "concat-stream": "~1.5.0", + "defined": "^1.0.0", + "detective": "^4.0.0", + "duplexer2": "^0.1.2", + "inherits": "^2.0.1", + "parents": "^1.0.0", + "readable-stream": "^2.0.2", + "resolve": "^1.1.3", + "stream-combiner2": "^1.1.1", + "subarg": "^1.0.0", + "through2": "^2.0.0", + "xtend": "^4.0.0" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" + }, + "nan": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz", + "integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw==", + "dev": true, + "optional": true + }, + "nanomatch": { + "version": "1.2.13", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", + "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "dev": true, + "requires": { + "arr-diff": "^4.0.0", + "array-unique": "^0.3.2", + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "fragment-cache": "^0.2.1", + "is-windows": "^1.0.2", + "kind-of": "^6.0.2", + "object.pick": "^1.3.0", + "regex-not": "^1.0.0", + "snapdragon": "^0.8.1", + "to-regex": "^3.0.1" + } + }, + "node-libs-browser": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-0.7.0.tgz", + "integrity": "sha1-PicsCBnjCJNeJmdECNevDhSRuDs=", + "dev": true, + "requires": { + "assert": "^1.1.1", + "browserify-zlib": "^0.1.4", + "buffer": "^4.9.0", + "console-browserify": "^1.1.0", + "constants-browserify": "^1.0.0", + "crypto-browserify": "3.3.0", + "domain-browser": "^1.1.1", + "events": "^1.0.0", + "https-browserify": "0.0.1", + "os-browserify": "^0.2.0", + "path-browserify": "0.0.0", + "process": "^0.11.0", + "punycode": "^1.2.4", + "querystring-es3": "^0.2.0", + "readable-stream": "^2.0.5", + "stream-browserify": "^2.0.1", + "stream-http": "^2.3.1", + "string_decoder": "^0.10.25", + "timers-browserify": "^2.0.2", + "tty-browserify": "0.0.0", + "url": "^0.11.0", + "util": "^0.10.3", + "vm-browserify": "0.0.4" + }, + "dependencies": { + "browserify-aes": { + "version": "0.4.0", + "resolved": "http://registry.npmjs.org/browserify-aes/-/browserify-aes-0.4.0.tgz", + "integrity": "sha1-BnFJtmjfMcS1hTPgLQHoBthgjiw=", + "dev": true, + "requires": { + "inherits": "^2.0.1" + } + }, + "browserify-zlib": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", + "integrity": "sha1-uzX4pRn2AOD6a4SFJByXnQFB+y0=", + "dev": true, + "requires": { + "pako": "~0.2.0" + } + }, + "buffer": { + "version": "4.9.1", + "resolved": "http://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", + "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", + "dev": true, + "requires": { + "base64-js": "^1.0.2", + "ieee754": "^1.1.4", + "isarray": "^1.0.0" + } + }, + "crypto-browserify": { + "version": "3.3.0", + "resolved": "http://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.3.0.tgz", + "integrity": "sha1-ufx1u0oO1h3PHNXa6W6zDJw+UGw=", + "dev": true, + "requires": { + "browserify-aes": "0.4.0", + "pbkdf2-compat": "2.0.1", + "ripemd160": "0.2.0", + "sha.js": "2.2.6" + } + }, + "https-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-0.0.1.tgz", + "integrity": "sha1-P5E2XKvmC3ftDruiS0VOPgnZWoI=", + "dev": true + }, + "os-browserify": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.2.1.tgz", + "integrity": "sha1-Y/xMzuXS13Y9Jrv4YBB45sLgBE8=", + "dev": true + }, + "pako": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", + "integrity": "sha1-8/dSL073gjSNqBYbrZ7P1Rv4OnU=", + "dev": true + }, + "path-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", + "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", + "dev": true + }, + "ripemd160": { + "version": "0.2.0", + "resolved": "http://registry.npmjs.org/ripemd160/-/ripemd160-0.2.0.tgz", + "integrity": "sha1-K/GYveFnys+lHAqSjoS2i74XH84=", + "dev": true + }, + "sha.js": { + "version": "2.2.6", + "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.2.6.tgz", + "integrity": "sha1-F93t3F9yL7ZlAWWIlUYZd4ZzFbo=", + "dev": true + }, + "string_decoder": { + "version": "0.10.31", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", + "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", + "dev": true + }, + "timers-browserify": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.10.tgz", + "integrity": "sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg==", + "dev": true, + "requires": { + "setimmediate": "^1.0.4" + } + }, + "tty-browserify": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", + "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", + "dev": true + } + } + }, + "nopt": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-1.0.10.tgz", + "integrity": "sha1-bd0hvSoxQXuScn3Vhfim83YI6+4=", + "dev": true, + "requires": { + "abbrev": "1" + } + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true, + "requires": { + "remove-trailing-separator": "^1.0.1" + } + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true, + "requires": { + "path-key": "^2.0.0" + } + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "requires": { + "copy-descriptor": "^0.1.0", + "define-property": "^0.2.5", + "kind-of": "^3.0.3" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "requires": { + "isobject": "^3.0.0" + } + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "requires": { + "for-own": "^0.1.4", + "is-extendable": "^0.1.1" + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "onetime": { + "version": "1.1.0", + "resolved": "http://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", + "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", + "dev": true + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", + "dev": true + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true + } + } + }, + "os-browserify": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", + "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "package-json": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/package-json/-/package-json-4.0.1.tgz", + "integrity": "sha1-iGmgQBJTZhxMTKPabCEh7VVfXu0=", + "dev": true, + "requires": { + "got": "^6.7.1", + "registry-auth-token": "^3.0.1", + "registry-url": "^3.0.3", + "semver": "^5.1.0" + } + }, + "pako": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", + "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", + "dev": true + }, + "parents": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parents/-/parents-1.0.1.tgz", + "integrity": "sha1-/t1NK/GTp3dF/nHjcdc8MwfZx1E=", + "dev": true, + "requires": { + "path-platform": "~0.11.15" + } + }, + "parse-asn1": { + "version": "5.1.1", + "resolved": "http://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", + "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", + "dev": true, + "requires": { + "asn1.js": "^4.0.0", + "browserify-aes": "^1.0.0", + "create-hash": "^1.1.0", + "evp_bytestokey": "^1.0.0", + "pbkdf2": "^3.0.3" + } + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "requires": { + "glob-base": "^0.3.0", + "is-dotfile": "^1.0.0", + "is-extglob": "^1.0.0", + "is-glob": "^2.0.0" + } + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "^1.2.0" + } + }, + "parse-passwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", + "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=" + }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, + "path-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.1.tgz", + "integrity": "sha512-BapA40NHICOS+USX9SN4tyhq+A2RrN/Ws5F0Z5aMHDp98Fl86lX8Oti8B7uN93L4Ifv4fHOEA+pQw87gmMO/lQ==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "path-platform": { + "version": "0.11.15", + "resolved": "https://registry.npmjs.org/path-platform/-/path-platform-0.11.15.tgz", + "integrity": "sha1-6GQhf3TDaFDwhSt43Hv31KVyG/I=", + "dev": true + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=" + }, + "pbkdf2": { + "version": "3.0.16", + "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", + "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", + "dev": true, + "requires": { + "create-hash": "^1.1.2", + "create-hmac": "^1.1.4", + "ripemd160": "^2.0.1", + "safe-buffer": "^5.0.1", + "sha.js": "^2.4.8" + } + }, + "pbkdf2-compat": { + "version": "2.0.1", + "resolved": "http://registry.npmjs.org/pbkdf2-compat/-/pbkdf2-compat-2.0.1.tgz", + "integrity": "sha1-tuDI+plJTZTgURV1gCpZpcFC8og=", + "dev": true + }, + "pify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", + "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "dev": true + }, + "popsicle": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/popsicle/-/popsicle-9.2.0.tgz", + "integrity": "sha512-petRj39w05GvH1WKuGFmzxR9+k+R9E7zX5XWTFee7P/qf88hMuLT7aAO/RsmldpQMtJsWQISkTQlfMRECKlxhw==", + "dev": true, + "requires": { + "concat-stream": "^1.4.7", + "form-data": "^2.0.0", + "make-error-cause": "^1.2.1", + "tough-cookie": "^2.0.0" + } + }, + "popsicle-proxy-agent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/popsicle-proxy-agent/-/popsicle-proxy-agent-3.0.0.tgz", + "integrity": "sha1-uRM8VdlFdZq37mG3cRNkYg066tw=", + "dev": true, + "requires": { + "http-proxy-agent": "^1.0.0", + "https-proxy-agent": "^1.0.0" + } + }, + "popsicle-retry": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/popsicle-retry/-/popsicle-retry-3.2.1.tgz", + "integrity": "sha1-4G6GZTO0KnoSPrMwy+Y6fOvLoQw=", + "dev": true, + "requires": { + "any-promise": "^1.1.0", + "xtend": "^4.0.1" + } + }, + "popsicle-rewrite": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/popsicle-rewrite/-/popsicle-rewrite-1.0.0.tgz", + "integrity": "sha1-HdTo6pwxgjUfuCD4eTTZkvf7kAc=", + "dev": true + }, + "popsicle-status": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/popsicle-status/-/popsicle-status-2.0.1.tgz", + "integrity": "sha1-jdcMT+fGlBCa3XhP/oDqysHnso0=", + "dev": true + }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "prepend-http": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-1.0.4.tgz", + "integrity": "sha1-1PRWKwzjaW5BrFLQ4ALlemNdxtw=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", + "dev": true + }, + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "dev": true + }, + "promise-finally": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/promise-finally/-/promise-finally-3.0.0.tgz", + "integrity": "sha1-3dXQ+JVDKxIGzrjaEnUGTRjnqiM=", + "dev": true + }, + "prr": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", + "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "psl": { + "version": "1.1.29", + "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", + "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", + "dev": true + }, + "public-encrypt": { + "version": "4.0.2", + "resolved": "http://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", + "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", + "dev": true, + "requires": { + "bn.js": "^4.1.0", + "browserify-rsa": "^4.0.0", + "create-hash": "^1.1.0", + "parse-asn1": "^5.0.0", + "randombytes": "^2.0.1" + } + }, + "punycode": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "dev": true + }, + "querystring": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", + "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", + "dev": true + }, + "querystring-es3": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", + "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", + "dev": true + }, + "randomatic": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.0.tgz", + "integrity": "sha512-KnGPVE0lo2WoXxIZ7cPR8YBpiol4gsSuOwDSg410oHh80ZMp5EiypNqL2K4Z77vJn6lB5rap7IkAmcUlalcnBQ==", + "dev": true, + "requires": { + "is-number": "^4.0.0", + "kind-of": "^6.0.0", + "math-random": "^1.0.1" + }, + "dependencies": { + "is-number": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", + "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "dev": true + } + } + }, + "randombytes": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", + "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "randomfill": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", + "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", + "dev": true, + "requires": { + "randombytes": "^2.0.5", + "safe-buffer": "^5.1.0" + } + }, + "rc": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", + "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "dev": true, + "requires": { + "deep-extend": "^0.6.0", + "ini": "~1.3.0", + "minimist": "^1.2.0", + "strip-json-comments": "~2.0.1" + } + }, + "read-only-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-only-stream/-/read-only-stream-2.0.0.tgz", + "integrity": "sha1-JyT9aoET1zdkrCiNQ4YnDB2/F/A=", + "dev": true, + "requires": { + "readable-stream": "^2.0.2" + } + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" + }, + "dependencies": { + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + } + } + }, + "readdirp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", + "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "minimatch": "^3.0.2", + "readable-stream": "^2.0.2", + "set-immediate-shim": "^1.0.1" + } + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true, + "requires": { + "is-equal-shallow": "^0.1.3" + } + }, + "regex-not": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", + "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.2", + "safe-regex": "^1.1.0" + } + }, + "registry-auth-token": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-3.3.2.tgz", + "integrity": "sha512-JL39c60XlzCVgNrO+qq68FoNb56w/m7JYvGR2jT5iR1xBrUA3Mfx5Twk5rqTThPmQKMWydGmq8oFtDlxfrmxnQ==", + "dev": true, + "requires": { + "rc": "^1.1.6", + "safe-buffer": "^5.0.1" + } + }, + "registry-url": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-3.1.0.tgz", + "integrity": "sha1-PU74cPc93h138M+aOBQyRE4XSUI=", + "dev": true, + "requires": { + "rc": "^1.0.1" + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.3.tgz", + "integrity": "sha512-ahGq0ZnV5m5XtZLMb+vP76kcAM5nkLqk0lpqAuojSKGgQtn4eRi4ZZGm2olo2zKFH+sMsWaqOCW1dqAnOru72g==", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "resolve": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.8.1.tgz", + "integrity": "sha512-AicPrAC7Qu1JxPCZ9ZgCZlY35QgFnNqc+0LtbRNxnVw4TXvjQ72wnuL9JQcEBgXkI9JM8MsT9kaQoHcpCRJOYA==", + "dev": true, + "requires": { + "path-parse": "^1.0.5" + } + }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "restore-cursor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", + "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", + "dev": true, + "requires": { + "exit-hook": "^1.0.0", + "onetime": "^1.0.0" + } + }, + "ret": { + "version": "0.1.15", + "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", + "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "dev": true + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true, + "requires": { + "align-text": "^0.1.1" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "ripemd160": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", + "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", + "dev": true, + "requires": { + "hash-base": "^3.0.0", + "inherits": "^2.0.1" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "safe-regex": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", + "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "dev": true, + "requires": { + "ret": "~0.1.10" + } + }, + "semver": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", + "dev": true + }, + "semver-diff": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", + "integrity": "sha1-S7uEN8jTfksM8aaP1ybsbWRdbTY=", + "dev": true, + "requires": { + "semver": "^5.0.3" + } + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "dev": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.3", + "split-string": "^3.0.1" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "setimmediate": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", + "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "dev": true + }, + "sha.js": { + "version": "2.4.11", + "resolved": "http://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", + "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "shasum": { + "version": "1.0.2", + "resolved": "http://registry.npmjs.org/shasum/-/shasum-1.0.2.tgz", + "integrity": "sha1-5wEjENj0F/TetXEhUOVni4euVl8=", + "dev": true, + "requires": { + "json-stable-stringify": "~0.0.0", + "sha.js": "~2.4.4" + } + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "^1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "shell-quote": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.6.1.tgz", + "integrity": "sha1-9HgZSczkAmlxJ0MOo7PFR29IF2c=", + "dev": true, + "requires": { + "array-filter": "~0.0.0", + "array-map": "~0.0.0", + "array-reduce": "~0.0.0", + "jsonify": "~0.0.0" + } + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "simple-concat": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.0.tgz", + "integrity": "sha1-c0TLuLbib7J9ZrL8hvn21Zl1IcY=", + "dev": true + }, + "slice-ansi": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", + "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0" + } + }, + "snapdragon": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", + "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "dev": true, + "requires": { + "base": "^0.11.1", + "debug": "^2.2.0", + "define-property": "^0.2.5", + "extend-shallow": "^2.0.1", + "map-cache": "^0.2.2", + "source-map": "^0.5.6", + "source-map-resolve": "^0.5.0", + "use": "^3.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "requires": { + "define-property": "^1.0.0", + "isobject": "^3.0.0", + "snapdragon-util": "^3.0.1" + }, + "dependencies": { + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true, + "requires": { + "is-descriptor": "^1.0.0" + } + }, + "is-accessor-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", + "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-data-descriptor": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", + "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", + "dev": true, + "requires": { + "kind-of": "^6.0.0" + } + }, + "is-descriptor": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", + "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", + "dev": true, + "requires": { + "is-accessor-descriptor": "^1.0.0", + "is-data-descriptor": "^1.0.0", + "kind-of": "^6.0.2" + } + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "requires": { + "kind-of": "^3.2.0" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "sort-keys": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", + "integrity": "sha1-RBttTTRnmPG05J6JIK37oOVD+a0=", + "dev": true, + "requires": { + "is-plain-obj": "^1.0.0" + } + }, + "source-list-map": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-0.1.8.tgz", + "integrity": "sha1-xVCyq1Qn9rPyH1r+rYjE9Vh7IQY=", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" + }, + "source-map-resolve": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", + "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "dev": true, + "requires": { + "atob": "^2.1.1", + "decode-uri-component": "^0.2.0", + "resolve-url": "^0.2.1", + "source-map-url": "^0.4.0", + "urix": "^0.1.0" + } + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "requires": { + "source-map": "^0.5.6" + } + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, + "split-string": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", + "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "dev": true, + "requires": { + "extend-shallow": "^3.0.0" + } + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "requires": { + "define-property": "^0.2.5", + "object-copy": "^0.1.0" + }, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true, + "requires": { + "is-descriptor": "^0.1.0" + } + } + } + }, + "stream-browserify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", + "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", + "dev": true, + "requires": { + "inherits": "~2.0.1", + "readable-stream": "^2.0.2" + } + }, + "stream-combiner2": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/stream-combiner2/-/stream-combiner2-1.1.1.tgz", + "integrity": "sha1-+02KFCDqNidk4hrUeAOXvry0HL4=", + "dev": true, + "requires": { + "duplexer2": "~0.1.0", + "readable-stream": "^2.0.2" + } + }, + "stream-http": { + "version": "2.8.3", + "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", + "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", + "dev": true, + "requires": { + "builtin-status-codes": "^3.0.0", + "inherits": "^2.0.1", + "readable-stream": "^2.3.6", + "to-arraybuffer": "^1.0.0", + "xtend": "^4.0.0" + } + }, + "stream-splicer": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/stream-splicer/-/stream-splicer-2.0.0.tgz", + "integrity": "sha1-G2O+Q4oTPktnHMGTUZdgAXWRDYM=", + "dev": true, + "requires": { + "inherits": "^2.0.1", + "readable-stream": "^2.0.2" + } + }, + "string-template": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/string-template/-/string-template-1.0.0.tgz", + "integrity": "sha1-np8iM9wA8hhxjsN5oopWc+zKi5Y=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "^2.0.0", + "strip-ansi": "^4.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "^3.0.0" + } + } + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.0" + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true, + "requires": { + "ansi-regex": "^2.0.0" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=" + }, + "subarg": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", + "integrity": "sha1-9izxdYHplrSPyWVpn1TAauJouNI=", + "dev": true, + "requires": { + "minimist": "^1.1.0" + } + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "requires": { + "has-flag": "^3.0.0" + } + }, + "syntax-error": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/syntax-error/-/syntax-error-1.4.0.tgz", + "integrity": "sha512-YPPlu67mdnHGTup2A8ff7BC2Pjq0e0Yp/IyTFN03zWO0RcK07uLcbi7C2KpGR2FvWbaB0+bfE27a+sBKebSo7w==", + "dev": true, + "requires": { + "acorn-node": "^1.2.0" + } + }, + "tapable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.1.0.tgz", + "integrity": "sha512-IlqtmLVaZA2qab8epUXbVWRn3aB1imbDMJtjB3nu4X0NqPkcY/JH9ZtCBWKHWPxs8Svi9tyo8w2dBoi07qZbBA==", + "dev": true + }, + "term-size": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/term-size/-/term-size-1.2.0.tgz", + "integrity": "sha1-RYuDiH8oj8Vtb/+/rSYuJmOO+mk=", + "dev": true, + "requires": { + "execa": "^0.7.0" + } + }, + "thenify": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.0.tgz", + "integrity": "sha1-5p44obq+lpsBCCB5eLn2K4hgSDk=", + "dev": true, + "requires": { + "any-promise": "^1.0.0" + } + }, + "throat": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/throat/-/throat-3.2.0.tgz", + "integrity": "sha512-/EY8VpvlqJ+sFtLPeOgc8Pl7kQVOWv0woD87KTXVHPIAE842FGT+rokxIhe8xIUP1cfgrkt0as0vDLjDiMtr8w==", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "http://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "through2": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", + "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", + "dev": true, + "requires": { + "readable-stream": "^2.1.5", + "xtend": "~4.0.1" + } + }, + "timed-out": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz", + "integrity": "sha1-8y6srFoXW+ol1/q1Zas+2HQe9W8=", + "dev": true + }, + "timers-browserify": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", + "integrity": "sha1-ycWLV1voQHN1y14kYtrO50NZ9B0=", + "dev": true, + "requires": { + "process": "~0.11.0" + } + }, + "to-arraybuffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", + "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "requires": { + "kind-of": "^3.0.2" + }, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "requires": { + "is-buffer": "^1.1.5" + } + } + } + }, + "to-regex": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", + "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "dev": true, + "requires": { + "define-property": "^2.0.2", + "extend-shallow": "^3.0.2", + "regex-not": "^1.0.2", + "safe-regex": "^1.1.0" + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "requires": { + "is-number": "^3.0.0", + "repeat-string": "^1.6.1" + } + }, + "touch": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/touch/-/touch-1.0.0.tgz", + "integrity": "sha1-RJy+LbrlqMgDjjDXH6D/RklHxN4=", + "dev": true, + "requires": { + "nopt": "~1.0.10" + } + }, + "tough-cookie": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", + "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", + "dev": true, + "requires": { + "psl": "^1.1.24", + "punycode": "^1.4.1" + } + }, + "ts-loader": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-5.1.0.tgz", + "integrity": "sha512-pbESalpH3V8sh/JdG0Zq6Nqp7SzgvYLWapLCXtPXRb6gpW9svgPV2FO6//480iZZpQY9uQCJdfY+l7B5KMUMBg==", + "dev": true, + "requires": { + "chalk": "^2.3.0", + "enhanced-resolve": "^4.0.0", + "loader-utils": "^1.0.2", + "micromatch": "^3.1.4", + "semver": "^5.0.1" + } + }, + "ts-node": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-3.3.0.tgz", + "integrity": "sha1-wTxqMCTjC+EYDdUwOPwgkonUv2k=", + "requires": { + "arrify": "^1.0.0", + "chalk": "^2.0.0", + "diff": "^3.1.0", + "make-error": "^1.1.1", + "minimist": "^1.2.0", + "mkdirp": "^0.5.1", + "source-map-support": "^0.4.0", + "tsconfig": "^6.0.0", + "v8flags": "^3.0.0", + "yn": "^2.0.0" + } + }, + "tsconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-6.0.0.tgz", + "integrity": "sha1-aw6DdgA9evGGT434+J3QBZ/80DI=", + "requires": { + "strip-bom": "^3.0.0", + "strip-json-comments": "^2.0.0" + } + }, + "tsify": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/tsify/-/tsify-3.0.4.tgz", + "integrity": "sha512-y75+qgB41YS8HJck+jmSIn395I4qRGtm5ZELzvNh80Llzh8ojPWp47jm0ZoIJesNYVzbqEyLzgYXV9d/calvVg==", + "dev": true, + "requires": { + "convert-source-map": "^1.1.0", + "fs.realpath": "^1.0.0", + "object-assign": "^4.1.0", + "semver": "^5.1.0", + "through2": "^2.0.0", + "tsconfig": "^5.0.3" + }, + "dependencies": { + "strip-bom": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-2.0.0.tgz", + "integrity": "sha1-YhmoVhZSBJHzV4i9vxRHqZx+aw4=", + "dev": true, + "requires": { + "is-utf8": "^0.2.0" + } + }, + "tsconfig": { + "version": "5.0.3", + "resolved": "https://registry.npmjs.org/tsconfig/-/tsconfig-5.0.3.tgz", + "integrity": "sha1-X0J45wGACWeo/Dg/0ZZIh48qbjo=", + "dev": true, + "requires": { + "any-promise": "^1.3.0", + "parse-json": "^2.2.0", + "strip-bom": "^2.0.0", + "strip-json-comments": "^2.0.0" + } + } + } + }, + "tty-browserify": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.1.tgz", + "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", + "dev": true + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==" + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "typescript": { + "version": "2.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.9.2.tgz", + "integrity": "sha512-Gr4p6nFNaoufRIY4NMdpQRNmgxVIGMs4Fcu/ujdYk3nAZqk7supzBE9idmvfZIlH/Cuj//dvi+019qEue9lV0w==", + "dev": true + }, + "typings": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/typings/-/typings-2.1.1.tgz", + "integrity": "sha1-usxp0lWXCkeOCfdsf2iZddU1p4o=", + "dev": true, + "requires": { + "archy": "^1.0.0", + "bluebird": "^3.1.1", + "chalk": "^1.0.0", + "cli-truncate": "^1.0.0", + "columnify": "^1.5.2", + "elegant-spinner": "^1.0.1", + "has-unicode": "^2.0.1", + "listify": "^1.0.0", + "log-update": "^1.0.2", + "minimist": "^1.2.0", + "promise-finally": "^3.0.0", + "typings-core": "^2.3.3", + "update-notifier": "^2.0.0", + "wordwrap": "^1.0.0", + "xtend": "^4.0.1" + }, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "http://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true, + "requires": { + "ansi-styles": "^2.2.1", + "escape-string-regexp": "^1.0.2", + "has-ansi": "^2.0.0", + "strip-ansi": "^3.0.0", + "supports-color": "^2.0.0" + } + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, + "typings-core": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/typings-core/-/typings-core-2.3.3.tgz", + "integrity": "sha1-CexUzVsR3V8e8vwKsx03ACyita0=", + "dev": true, + "requires": { + "array-uniq": "^1.0.2", + "configstore": "^3.0.0", + "debug": "^2.2.0", + "detect-indent": "^5.0.0", + "graceful-fs": "^4.1.2", + "has": "^1.0.1", + "invariant": "^2.2.0", + "is-absolute": "^0.2.3", + "jspm-config": "^0.3.0", + "listify": "^1.0.0", + "lockfile": "^1.0.1", + "make-error-cause": "^1.2.1", + "mkdirp": "^0.5.1", + "object.pick": "^1.1.1", + "parse-json": "^2.2.0", + "popsicle": "^9.0.0", + "popsicle-proxy-agent": "^3.0.0", + "popsicle-retry": "^3.2.0", + "popsicle-rewrite": "^1.0.0", + "popsicle-status": "^2.0.0", + "promise-finally": "^3.0.0", + "rc": "^1.1.5", + "rimraf": "^2.4.4", + "sort-keys": "^1.0.0", + "string-template": "^1.0.0", + "strip-bom": "^3.0.0", + "thenify": "^3.1.0", + "throat": "^3.0.0", + "touch": "^1.0.0", + "typescript": "^2.1.4", + "xtend": "^4.0.0", + "zip-object": "^0.1.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + } + } + }, + "uglify-js": { + "version": "2.7.5", + "resolved": "http://registry.npmjs.org/uglify-js/-/uglify-js-2.7.5.tgz", + "integrity": "sha1-RhLAx7qu4rp8SH3kkErhIgefLKg=", + "dev": true, + "requires": { + "async": "~0.2.6", + "source-map": "~0.5.1", + "uglify-to-browserify": "~1.0.0", + "yargs": "~3.10.0" + }, + "dependencies": { + "async": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", + "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", + "dev": true + } + } + }, + "uglify-to-browserify": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", + "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", + "dev": true + }, + "umd": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz", + "integrity": "sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow==", + "dev": true + }, + "unc-path-regex": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unc-path-regex/-/unc-path-regex-0.1.2.tgz", + "integrity": "sha1-5z3T17DXxe2G+6xrCufYxqadUPo=", + "dev": true + }, + "undeclared-identifiers": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/undeclared-identifiers/-/undeclared-identifiers-1.1.2.tgz", + "integrity": "sha512-13EaeocO4edF/3JKime9rD7oB6QI8llAGhgn5fKOPyfkJbRb6NFv9pYV6dFEmpa4uRjKeBqLZP8GpuzqHlKDMQ==", + "dev": true, + "requires": { + "acorn-node": "^1.3.0", + "get-assigned-identifiers": "^1.2.0", + "simple-concat": "^1.0.0", + "xtend": "^4.0.1" + } + }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "requires": { + "arr-union": "^3.1.0", + "get-value": "^2.0.6", + "is-extendable": "^0.1.1", + "set-value": "^0.4.3" + }, + "dependencies": { + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true, + "requires": { + "is-extendable": "^0.1.0" + } + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true, + "requires": { + "extend-shallow": "^2.0.1", + "is-extendable": "^0.1.1", + "is-plain-object": "^2.0.1", + "to-object-path": "^0.3.0" + } + } + } + }, + "unique-string": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-1.0.0.tgz", + "integrity": "sha1-nhBXzKhRq7kzmPizOuGHuZyuwRo=", + "dev": true, + "requires": { + "crypto-random-string": "^1.0.0" + } + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "requires": { + "has-value": "^0.3.1", + "isobject": "^3.0.0" + }, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "requires": { + "get-value": "^2.0.3", + "has-values": "^0.1.4", + "isobject": "^2.0.0" + }, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "requires": { + "isarray": "1.0.0" + } + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } + }, + "unzip-response": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/unzip-response/-/unzip-response-2.0.1.tgz", + "integrity": "sha1-0vD3N9FrBhXnKmk17QQhRXLVb5c=", + "dev": true + }, + "update-notifier": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-2.5.0.tgz", + "integrity": "sha512-gwMdhgJHGuj/+wHJJs9e6PcCszpxR1b236igrOkUofGhqJuG+amlIKwApH1IW1WWl7ovZxsX49lMBWLxSdm5Dw==", + "dev": true, + "requires": { + "boxen": "^1.2.1", + "chalk": "^2.0.1", + "configstore": "^3.0.0", + "import-lazy": "^2.1.0", + "is-ci": "^1.0.10", + "is-installed-globally": "^0.1.0", + "is-npm": "^1.0.0", + "latest-version": "^3.0.0", + "semver-diff": "^2.0.0", + "xdg-basedir": "^3.0.0" + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "url": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", + "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", + "dev": true, + "requires": { + "punycode": "1.3.2", + "querystring": "0.2.0" + }, + "dependencies": { + "punycode": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", + "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", + "dev": true + } + } + }, + "url-parse-lax": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-1.0.0.tgz", + "integrity": "sha1-evjzA2Rem9eaJy56FKxovAYJ2nM=", + "dev": true, + "requires": { + "prepend-http": "^1.0.1" + } + }, + "use": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", + "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", + "dev": true + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dev": true, + "requires": { + "inherits": "2.0.3" + } + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "v8flags": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-3.1.1.tgz", + "integrity": "sha512-iw/1ViSEaff8NJ3HLyEjawk/8hjJib3E7pvG4pddVXfUg1983s3VGsiClDjhK64MQVDGqc1Q8r18S4VKQZS9EQ==", + "requires": { + "homedir-polyfill": "^1.0.1" + } + }, + "vm-browserify": { + "version": "0.0.4", + "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", + "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", + "dev": true, + "requires": { + "indexof": "0.0.1" + } + }, + "watchpack": { + "version": "0.2.9", + "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-0.2.9.tgz", + "integrity": "sha1-Yuqkq15bo1/fwBgnVibjwPXj+ws=", + "dev": true, + "requires": { + "async": "^0.9.0", + "chokidar": "^1.0.0", + "graceful-fs": "^4.1.2" + }, + "dependencies": { + "async": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", + "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=", + "dev": true + } + } + }, + "wcwidth": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", + "integrity": "sha1-8LDc+RW8X/FSivrbLA4XtTLaL+g=", + "dev": true, + "requires": { + "defaults": "^1.0.3" + } + }, + "webpack": { + "version": "1.15.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-1.15.0.tgz", + "integrity": "sha1-T/MfU9sDM55VFkqdRo7gMklo/pg=", + "dev": true, + "requires": { + "acorn": "^3.0.0", + "async": "^1.3.0", + "clone": "^1.0.2", + "enhanced-resolve": "~0.9.0", + "interpret": "^0.6.4", + "loader-utils": "^0.2.11", + "memory-fs": "~0.3.0", + "mkdirp": "~0.5.0", + "node-libs-browser": "^0.7.0", + "optimist": "~0.6.0", + "supports-color": "^3.1.0", + "tapable": "~0.1.8", + "uglify-js": "~2.7.3", + "watchpack": "^0.2.1", + "webpack-core": "~0.6.9" + }, + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "http://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "dev": true + }, + "enhanced-resolve": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-0.9.1.tgz", + "integrity": "sha1-TW5omzcl+GCQknzMhs2fFjW4ni4=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.2", + "memory-fs": "^0.2.0", + "tapable": "^0.1.8" + }, + "dependencies": { + "memory-fs": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.2.0.tgz", + "integrity": "sha1-8rslNovBIeORwlIN6Slpyu4KApA=", + "dev": true + } + } + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "loader-utils": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-0.2.17.tgz", + "integrity": "sha1-+G5jdNQyBabmxg6RlvF8Apm/s0g=", + "dev": true, + "requires": { + "big.js": "^3.1.3", + "emojis-list": "^2.0.0", + "json5": "^0.5.0", + "object-assign": "^4.0.1" + } + }, + "memory-fs": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.3.0.tgz", + "integrity": "sha1-e8xrYp46Q+hx1+Kaymrop/FcuyA=", + "dev": true, + "requires": { + "errno": "^0.1.3", + "readable-stream": "^2.0.1" + } + }, + "supports-color": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.2.3.tgz", + "integrity": "sha1-ZawFBLOVQXHYpklGsq48u4pfVPY=", + "dev": true, + "requires": { + "has-flag": "^1.0.0" + } + }, + "tapable": { + "version": "0.1.10", + "resolved": "http://registry.npmjs.org/tapable/-/tapable-0.1.10.tgz", + "integrity": "sha1-KcNXB8K3DlDQdIK10gLo7URtr9Q=", + "dev": true + } + } + }, + "webpack-core": { + "version": "0.6.9", + "resolved": "https://registry.npmjs.org/webpack-core/-/webpack-core-0.6.9.tgz", + "integrity": "sha1-/FcViMhVjad76e+23r3Fo7FyvcI=", + "dev": true, + "requires": { + "source-list-map": "~0.1.7", + "source-map": "~0.4.1" + }, + "dependencies": { + "source-map": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz", + "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=", + "dev": true, + "requires": { + "amdefine": ">=0.0.4" + } + } + } + }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "widest-line": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-2.0.0.tgz", + "integrity": "sha1-AUKk6KJD+IgsAjOqDgKBqnYVInM=", + "dev": true, + "requires": { + "string-width": "^2.1.1" + } + }, + "window-size": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", + "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", + "dev": true + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.11", + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.2" + } + }, + "xdg-basedir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", + "integrity": "sha1-SWsswQnsqNus/i3HK2A8F8WHCtQ=", + "dev": true + }, + "xtend": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", + "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "3.10.0", + "resolved": "http://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", + "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", + "dev": true, + "requires": { + "camelcase": "^1.0.2", + "cliui": "^2.1.0", + "decamelize": "^1.0.0", + "window-size": "0.1.0" + }, + "dependencies": { + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true + } + } + }, + "yn": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yn/-/yn-2.0.0.tgz", + "integrity": "sha1-5a2ryKz0CPY4X8dklWhMiOavaJo=" + }, + "zip-object": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/zip-object/-/zip-object-0.1.0.tgz", + "integrity": "sha1-waDaBMiMg3dW4khoCgP/kC7D9To=", + "dev": true + } + } +} diff --git a/samples/client/petstore/typescript-axios/tests/default/package.json b/samples/client/petstore/typescript-axios/tests/default/package.json new file mode 100644 index 00000000000..187f525f396 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/package.json @@ -0,0 +1,36 @@ +{ + "private": true, + "dependencies": { + "@swagger/typescript-axios-petstore": "file:../../builds/with-npm-version", + "axios": "0.18.0", + "chai": "^4.1.0", + "ts-node": "^3.3.0" + }, + "scripts": { + "prepublish": "npm install ../../builds/with-npm-version && npm run build", + "test": "mocha test/*.ts --compilers ts:ts-node/register --timeout 10000", + "build": "tsc", + "webpack": "webpack", + "browserify": "browserify test -p [ tsify ] > ./dist/test.browserify-bundle.js" + }, + "devDependencies": { + "@types/chai": "^4.0.1", + "@types/mocha": "^2.2.41", + "@types/node": "^8.0.14", + "browserify": "^14.4.0", + "mocha": "^3.4.2", + "ts-loader": "^5.1.0", + "tsify": "^3.0.1", + "typescript": "^2.4.1", + "typings": "^2.1.1", + "webpack": "^1.13.0" + }, + "name": "typescript-fetch-test", + "version": "1.0.0", + "directories": { + "test": "test" + }, + "author": "", + "license": "ISC", + "description": "" +} diff --git a/samples/client/petstore/typescript-axios/tests/default/pom.xml b/samples/client/petstore/typescript-axios/tests/default/pom.xml new file mode 100644 index 00000000000..49c179c809c --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/pom.xml @@ -0,0 +1,59 @@ + + 4.0.0 + org.openapitools + TypeScriptAxiosPestoreClientTests + pom + 1.0-SNAPSHOT + TS Axios Petstore Test Client + + + + maven-dependency-plugin + + + package + + copy-dependencies + + + ${project.build.directory} + + + + + + org.codehaus.mojo + exec-maven-plugin + 1.2.1 + + + npm-install + pre-integration-test + + exec + + + npm + + install + + + + + npm-test + integration-test + + exec + + + npm + + test + + + + + + + + diff --git a/samples/client/petstore/typescript-axios/tests/default/test/PetApi.ts b/samples/client/petstore/typescript-axios/tests/default/test/PetApi.ts new file mode 100644 index 00000000000..26c24a0de7e --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/test/PetApi.ts @@ -0,0 +1,84 @@ +import { expect } from "chai"; +import { PetApi, Pet, Category } from "@swagger/typescript-axios-petstore"; +import { AxiosResponse } from "axios"; + +describe("PetApi", () => { + function runSuite(description: string, requestOptions?: any): void { + describe(description, () => { + let api: PetApi; + const fixture: Pet = createTestFixture(); + + beforeEach(() => { + api = new PetApi(); + }); + + it("should add and delete Pet", () => { + return api.addPet(fixture, requestOptions).then(() => {}); + }); + + it("should get Pet by ID", () => { + return api + .getPetById(fixture.id, requestOptions) + .then((result: AxiosResponse) => { + return expect(result.data).to.deep.equal(fixture); + }); + }); + + it("should update Pet by ID", () => { + return api + .getPetById(fixture.id, requestOptions) + .then((response: AxiosResponse) => { + const result = response.data; + result.name = "newname"; + return api.updatePet(result, requestOptions).then(() => { + return api + .getPetById(fixture.id, requestOptions) + .then((response: AxiosResponse) => { + return expect(response.data.name).to.deep.equal("newname"); + }); + }); + }); + }); + + it("should delete Pet", () => { + return api.deletePet(fixture.id, requestOptions); + }); + + it("should not contain deleted Pet", () => { + return api.getPetById(fixture.id, requestOptions).then( + (result: AxiosResponse) => { + return expect(result.data).to.not.exist; + }, + (err: any) => { + return expect(err).to.exist; + } + ); + }); + }); + } + + runSuite("without custom request options"); + + runSuite("with custom request options", { + credentials: "include", + mode: "cors" + }); +}); + +function createTestFixture(ts = Date.now()) { + const category: Category = { + id: ts, + name: `category${ts}` + }; + + const pet: Pet = { + id: ts, + name: `pet${ts}`, + category: category, + photoUrls: ["http://foo.bar.com/1", "http://foo.bar.com/2"], + status: Pet.StatusEnum.Available, + tags: [] + }; + + return pet; +} diff --git a/samples/client/petstore/typescript-axios/tests/default/test/PetApiFactory.ts b/samples/client/petstore/typescript-axios/tests/default/test/PetApiFactory.ts new file mode 100644 index 00000000000..8f4cde55623 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/test/PetApiFactory.ts @@ -0,0 +1,105 @@ +import { expect } from "chai"; +import { + PetApiFactory, + Pet, + Category +} from "@swagger/typescript-axios-petstore"; +import { Configuration } from "@swagger/typescript-axios-petstore"; +import { AxiosResponse } from "axios"; + +let config: Configuration; + +before(function() { + config = new Configuration(); + config.accessToken = "foobar"; + config.apiKey = (securityName: string) => { + // for multiple apiKey security + if (securityName === "api_key") { + return "foobar"; + } + return; + }; + config.username = "foo"; + config.password = "bar"; +}); + +describe("PetApiFactory", () => { + function runSuite(description: string, requestOptions?: any): void { + describe(description, () => { + const fixture: Pet = createTestFixture(); + + it("should add and delete Pet", () => { + return PetApiFactory(config) + .addPet(fixture, requestOptions) + .then(() => {}); + }); + + it("should get Pet by ID", () => { + return PetApiFactory(config) + .getPetById(fixture.id, requestOptions) + .then((result: AxiosResponse) => { + return expect(result.data).to.deep.equal(fixture); + }); + }); + + it("should update Pet by ID", () => { + return PetApiFactory(config) + .getPetById(fixture.id, requestOptions) + .then((result: AxiosResponse) => { + result.data.name = "newname"; + return PetApiFactory(config) + .updatePet(result.data, requestOptions) + .then(() => { + return PetApiFactory(config) + .getPetById(fixture.id, requestOptions) + .then((result: AxiosResponse) => { + return expect(result.data.name).to.deep.equal("newname"); + }); + }); + }); + }); + + it("should delete Pet", () => { + return PetApiFactory(config).deletePet(fixture.id, requestOptions); + }); + + it("should not contain deleted Pet", () => { + return PetApiFactory(config) + .getPetById(fixture.id, requestOptions) + .then( + (result: AxiosResponse) => { + return expect(result.data).to.not.exist; + }, + (err: any) => { + return expect(err).to.exist; + } + ); + }); + }); + } + + runSuite("without custom request options"); + + runSuite("with custom request options", { + credentials: "include", + mode: "cors" + }); +}); + +function createTestFixture(ts = Date.now()) { + const category: Category = { + id: ts, + name: `category${ts}` + }; + + const pet: Pet = { + id: ts, + name: `pet${ts}`, + category: category, + photoUrls: ["http://foo.bar.com/1", "http://foo.bar.com/2"], + status: Pet.StatusEnum.Available, + tags: [] + }; + + return pet; +} diff --git a/samples/client/petstore/typescript-axios/tests/default/test/StoreApi.ts b/samples/client/petstore/typescript-axios/tests/default/test/StoreApi.ts new file mode 100644 index 00000000000..ae3ce4efdc1 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/test/StoreApi.ts @@ -0,0 +1,30 @@ +import { expect } from "chai"; +import { StoreApi } from "@swagger/typescript-axios-petstore"; +import { AxiosResponse } from "axios"; + +describe("StoreApi", function() { + function runSuite(description: string, requestOptions?: any): void { + describe(description, () => { + let api: StoreApi; + + beforeEach(function() { + api = new StoreApi(); + }); + + it("should get inventory", function() { + return api + .getInventory(requestOptions) + .then((result: AxiosResponse<{ [key: string]: number }>) => { + expect(Object.keys(result)).to.not.be.empty; + }); + }); + }); + } + + runSuite("without custom request options"); + + runSuite("with custom request options", { + credentials: "include", + mode: "cors" + }); +}); diff --git a/samples/client/petstore/typescript-axios/tests/default/test/StoreApiFactory.ts b/samples/client/petstore/typescript-axios/tests/default/test/StoreApiFactory.ts new file mode 100644 index 00000000000..0ff7e4b99d4 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/test/StoreApiFactory.ts @@ -0,0 +1,41 @@ +import { expect } from "chai"; +import { StoreApiFactory } from "@swagger/typescript-axios-petstore"; +import { Configuration } from "@swagger/typescript-axios-petstore"; +import { AxiosResponse } from "axios"; + +let config: Configuration; + +before(function() { + config = new Configuration(); + config.accessToken = "foobar"; + config.apiKey = (securityName: string) => { + // for multiple apiKey security + if (securityName === "api_key") { + return "foobar"; + } + return; + }; + config.username = "foo"; + config.password = "bar"; +}); + +describe("StoreApiFactory", function() { + function runSuite(description: string, requestOptions?: any): void { + describe(description, () => { + it("should get inventory", function() { + return StoreApiFactory(config) + .getInventory(requestOptions) + .then((result: AxiosResponse<{ [key: string]: number }>) => { + expect(Object.keys(result.data)).to.not.be.empty; + }); + }); + }); + } + + runSuite("without custom request options"); + + runSuite("with custom request options", { + credentials: "include", + mode: "cors" + }); +}); diff --git a/samples/client/petstore/typescript-axios/tests/default/test/index.ts b/samples/client/petstore/typescript-axios/tests/default/test/index.ts new file mode 100644 index 00000000000..a3adb97ca81 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/test/index.ts @@ -0,0 +1,4 @@ +import './PetApi'; +import './StoreApi'; +import './PetApiFactory'; +import './StoreApiFactory'; diff --git a/samples/client/petstore/typescript-axios/tests/default/tsconfig.json b/samples/client/petstore/typescript-axios/tests/default/tsconfig.json new file mode 100644 index 00000000000..6524f781742 --- /dev/null +++ b/samples/client/petstore/typescript-axios/tests/default/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es5", + "noImplicitAny": true, + "sourceMap": false, + "outDir": "dist", + "types": [ + "mocha" + ], + "lib": [ + "es6", + "dom" + ] + }, + "exclude": [ + "node_modules" + ] +} diff --git a/samples/client/petstore/typescript-jquery/default/.openapi-generator/VERSION b/samples/client/petstore/typescript-jquery/default/.openapi-generator/VERSION index 14900cee60e..6d94c9c2e12 100644 --- a/samples/client/petstore/typescript-jquery/default/.openapi-generator/VERSION +++ b/samples/client/petstore/typescript-jquery/default/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.1-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/typescript-node/npm/package.json b/samples/client/petstore/typescript-node/npm/package.json index 2005298bd9b..cf13a928a79 100644 --- a/samples/client/petstore/typescript-node/npm/package.json +++ b/samples/client/petstore/typescript-node/npm/package.json @@ -20,7 +20,8 @@ "rewire": "^3.0.2" }, "devDependencies": { - "typescript": "^2.4.2" + "typescript": "^2.4.2", + "@types/node": "8.10.34" }, "publishConfig": { "registry": "https://skimdb.npmjs.com/registry" diff --git a/samples/meta-codegen/lib/README.md b/samples/meta-codegen/lib/README.md index e970d9f068f..94907133436 100644 --- a/samples/meta-codegen/lib/README.md +++ b/samples/meta-codegen/lib/README.md @@ -1,15 +1,16 @@ # OpenAPI Generator for the myClientCodegen library ## Overview -This is a boiler-plate project to generate your own client library with Swagger. Its goal is -to get you started with the basic plumbing so you can put in your own logic. It won't work without -your changes applied. +This is a boiler-plate project to generate your own project derived from an OpenAPI specification. +Its goal is to get you started with the basic plumbing so you can put in your own logic. +It won't work without your changes applied. -## What's Swagger? -The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service. +## What's OpenAPI +The goal of OpenAPI is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. +When properly described with OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. +Similar to what interfaces have done for lower-level programming, OpenAPI removes the guesswork in calling the service. - -Check out [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the Swagger project, including additional libraries with support for other languages and more. +Check out [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) for additional information about the OpenAPI project, including additional libraries with support for other languages and more. ## How do I use this? At this point, you've likely generated a client setup. It will include something along these lines: @@ -43,10 +44,17 @@ Once modified, you can run this: mvn package ``` -In your generator project. A single jar file will be produced in `target`. You can now use that with codegen: +In your generator project. A single jar file will be produced in `target`. You can now use that with [OpenAPI Generator](https://openapi-generator.tech): +For mac/linux: ``` -java -cp /path/to/openapi-generator-cli.jar:/path/to/your.jar org.openapitools.codegen.Codegen -g myClientCodegen -i /path/to/openapi.yaml -o ./test +java -cp /path/to/openapi-generator-cli.jar:/path/to/your.jar org.openapitools.codegen.OpenAPIGenerator generate -g myClientCodegen -i /path/to/openapi.yaml -o ./test +``` +(Do not forget to replace the values `/path/to/openapi-generator-cli.jar`, `/path/to/your.jar` and `/path/to/openapi.yaml` in the previous command) + +For Windows users, you will need to use `;` instead of `:` in the classpath, e.g. +``` +java -cp /path/to/openapi-generator-cli.jar;/path/to/your.jar org.openapitools.codegen.OpenAPIGenerator generate -g myClientCodegen -i /path/to/openapi.yaml -o ./test ``` Now your templates are available to the client generator and you can write output values @@ -62,13 +70,13 @@ the object you have available during client generation: ``` # The following additional debug options are available for all codegen targets: -# -DdebugSwagger prints the OpenAPI Specification as interpreted by the codegen +# -DdebugOpenAPI prints the OpenAPI Specification as interpreted by the codegen # -DdebugModels prints models passed to the template engine # -DdebugOperations prints operations passed to the template engine # -DdebugSupportingFiles prints additional data passed to the template engine -java -DdebugOperations -cp /path/to/openapi-generator-cli.jar:/path/to/your.jar org.openapitools.codegen.Codegen -g myClientCodegen -i /path/to/swagger.yaml -o ./test +java -DdebugOperations -cp /path/to/openapi-generator-cli.jar:/path/to/your.jar org.openapitools.codegen.OpenAPIGenerator generate -g myClientCodegen -i /path/to/openapi.yaml -o ./test ``` -Will, for example, output the debug info for operations. You can use this info -in the `api.mustache` file. \ No newline at end of file +Will, for example, output the debug info for operations. +You can use this info in the `api.mustache` file. \ No newline at end of file diff --git a/samples/meta-codegen/lib/pom.xml b/samples/meta-codegen/lib/pom.xml index dd8dcf14fea..0a6d0e60467 100644 --- a/samples/meta-codegen/lib/pom.xml +++ b/samples/meta-codegen/lib/pom.xml @@ -100,8 +100,8 @@ maven-compiler-plugin 3.6.1 - 1.7 - 1.7 + 1.8 + 1.8 @@ -116,7 +116,7 @@ UTF-8 - 3.0.0-SNAPSHOT + 4.0.0-SNAPSHOT 1.0.0 4.8.1 diff --git a/samples/meta-codegen/lib/src/main/java/com/my/company/codegen/MyclientcodegenGenerator.java b/samples/meta-codegen/lib/src/main/java/com/my/company/codegen/MyclientcodegenGenerator.java index 877b5778383..fd43a342519 100644 --- a/samples/meta-codegen/lib/src/main/java/com/my/company/codegen/MyclientcodegenGenerator.java +++ b/samples/meta-codegen/lib/src/main/java/com/my/company/codegen/MyclientcodegenGenerator.java @@ -19,7 +19,7 @@ public class MyclientcodegenGenerator extends DefaultCodegen implements CodegenC * @see org.openapitools.codegen.CodegenType */ public CodegenType getTag() { - return CodegenType.CLIENT; + return CodegenType.DOCUMENTATION; } /** diff --git a/samples/meta-codegen/pom.xml b/samples/meta-codegen/pom.xml new file mode 100644 index 00000000000..fc3ad25673e --- /dev/null +++ b/samples/meta-codegen/pom.xml @@ -0,0 +1,12 @@ + + 4.0.0 + org.openapitools + meta-codegen + 1.0.0 + pom + + lib/ + ../../modules/openapi-generator + + diff --git a/samples/meta-codegen/usage/.openapi-generator/VERSION b/samples/meta-codegen/usage/.openapi-generator/VERSION index 096bf47efe3..afa63656064 100644 --- a/samples/meta-codegen/usage/.openapi-generator/VERSION +++ b/samples/meta-codegen/usage/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/.php_cs b/samples/openapi3/client/petstore/php/OpenAPIClient-php/.php_cs index 6b8e23c818a..4fbe53ec5ff 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/.php_cs +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/.php_cs @@ -1,18 +1,23 @@ level(Symfony\CS\FixerInterface::PSR2_LEVEL) +return PhpCsFixer\Config::create() ->setUsingCache(true) - ->fixers( - [ - 'ordered_use', - 'phpdoc_order', - 'short_array_syntax', - 'strict', - 'strict_param' - ] - ) - ->finder( - Symfony\CS\Finder\DefaultFinder::create() - ->in(__DIR__) + ->setRules([ + '@PSR2' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('test') + ->exclude('tests') + ->in(__DIR__) ); diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/composer.json b/samples/openapi3/client/petstore/php/OpenAPIClient-php/composer.json index 65d3c935fb8..45b3c697261 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/composer.json +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/composer.json @@ -18,7 +18,7 @@ } ], "require": { - "php": ">=5.5", + "php": ">=5.6", "ext-curl": "*", "ext-json": "*", "ext-mbstring": "*", @@ -27,7 +27,7 @@ "require-dev": { "phpunit/phpunit": "^4.8", "squizlabs/php_codesniffer": "~2.6", - "friendsofphp/php-cs-fixer": "~1.12" + "friendsofphp/php-cs-fixer": "~2.12" }, "autoload": { "psr-4": { "OpenAPI\\Client\\" : "lib/" } diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/MapTest.md b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/MapTest.md index a6b378ac1fe..e2a51f7ddcd 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/MapTest.md +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/docs/Model/MapTest.md @@ -6,7 +6,7 @@ Name | Type | Description | Notes **map_map_of_string** | [**map[string,map[string,string]]**](map.md) | | [optional] **map_of_enum_string** | **map[string,string]** | | [optional] **direct_map** | **map[string,bool]** | | [optional] -**indirect_map** | [**\OpenAPI\Client\Model\StringBooleanMap**](StringBooleanMap.md) | | [optional] +**indirect_map** | **map[string,bool]** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Api/AnotherFakeApi.php index dd0f4d4a801..62319b80069 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 @@ -154,9 +154,6 @@ class AnotherFakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Client' !== 'string') { - $content = json_decode($content); - } } return [ @@ -172,9 +169,6 @@ class AnotherFakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -242,9 +236,6 @@ class AnotherFakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -316,10 +307,10 @@ class AnotherFakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { 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 8df96a6fd9f..9cd51d19e9c 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 @@ -150,9 +150,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('bool' !== 'string') { - $content = json_decode($content); - } } return [ @@ -168,9 +165,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -238,9 +232,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -306,10 +297,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -416,9 +407,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\OuterComposite' !== 'string') { - $content = json_decode($content); - } } return [ @@ -434,9 +422,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -504,9 +489,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -572,10 +554,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -682,9 +664,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('float' !== 'string') { - $content = json_decode($content); - } } return [ @@ -700,9 +679,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -770,9 +746,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -838,10 +811,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -948,9 +921,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== 'string') { - $content = json_decode($content); - } } return [ @@ -966,9 +936,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1036,9 +1003,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1104,10 +1068,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1319,10 +1283,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1549,10 +1513,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1663,9 +1627,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Client' !== 'string') { - $content = json_decode($content); - } } return [ @@ -1681,9 +1642,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1751,9 +1709,6 @@ class FakeApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1825,10 +1780,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -2228,10 +2183,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -2515,10 +2470,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -2734,10 +2689,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -2969,10 +2924,10 @@ class FakeApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { 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 fca125f3193..44eb33aa4e6 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 @@ -154,9 +154,6 @@ class FakeClassnameTags123Api $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Client' !== 'string') { - $content = json_decode($content); - } } return [ @@ -172,9 +169,6 @@ class FakeClassnameTags123Api $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -242,9 +236,6 @@ class FakeClassnameTags123Api $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -316,10 +307,10 @@ class FakeClassnameTags123Api // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { 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 548da849850..98e126ae2ef 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 @@ -259,10 +259,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -496,10 +496,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -614,9 +614,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Pet[]' !== 'string') { - $content = json_decode($content); - } } return [ @@ -632,9 +629,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -702,9 +696,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -780,10 +771,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -898,9 +889,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Pet[]' !== 'string') { - $content = json_decode($content); - } } return [ @@ -916,9 +904,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -986,9 +971,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1064,10 +1046,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1182,9 +1164,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Pet' !== 'string') { - $content = json_decode($content); - } } return [ @@ -1200,9 +1179,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1270,9 +1246,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1349,10 +1322,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1573,10 +1546,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1819,10 +1792,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1941,9 +1914,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') { - $content = json_decode($content); - } } return [ @@ -1959,9 +1929,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -2033,9 +2000,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -2123,10 +2087,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -2245,9 +2209,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\ApiResponse' !== 'string') { - $content = json_decode($content); - } } return [ @@ -2263,9 +2224,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -2337,9 +2295,6 @@ class PetApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -2433,10 +2388,10 @@ class PetApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { 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 cbcf97d1875..fd69b038f85 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 @@ -264,10 +264,10 @@ class StoreApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -376,9 +376,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('map[string,int]' !== 'string') { - $content = json_decode($content); - } } return [ @@ -394,9 +391,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -462,9 +456,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -526,10 +517,10 @@ class StoreApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -645,9 +636,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Order' !== 'string') { - $content = json_decode($content); - } } return [ @@ -663,9 +651,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -733,9 +718,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -819,10 +801,10 @@ class StoreApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -933,9 +915,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\Order' !== 'string') { - $content = json_decode($content); - } } return [ @@ -951,9 +930,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1021,9 +997,6 @@ class StoreApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1095,10 +1068,10 @@ class StoreApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { 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 739efdd7665..18f71547979 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 @@ -259,10 +259,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -478,10 +478,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -697,10 +697,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -921,10 +921,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1035,9 +1035,6 @@ class UserApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('\OpenAPI\Client\Model\User' !== 'string') { - $content = json_decode($content); - } } return [ @@ -1053,9 +1050,6 @@ class UserApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1123,9 +1117,6 @@ class UserApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1202,10 +1193,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1318,9 +1309,6 @@ class UserApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ('string' !== 'string') { - $content = json_decode($content); - } } return [ @@ -1336,9 +1324,6 @@ class UserApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1408,9 +1393,6 @@ class UserApi $content = $responseBody; //stream goes to serializer } else { $content = $responseBody->getContents(); - if ($returnType !== 'string') { - $content = json_decode($content); - } } return [ @@ -1494,10 +1476,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1699,10 +1681,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { @@ -1937,10 +1919,10 @@ class UserApi // for model (json/xml) if (isset($_tempBody)) { // $_tempBody is the method argument, if present - $httpBody = $_tempBody; - // \stdClass has no __toString(), so we should encode it manually - if ($httpBody instanceof \stdClass && $headers['Content-Type'] === 'application/json') { - $httpBody = \GuzzleHttp\json_encode($httpBody); + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; } } elseif (count($formParams) > 0) { if ($multipart) { diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php index dd0c12aecdf..74db144c025 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/Animal.php @@ -186,7 +186,7 @@ class Animal implements ModelInterface, ArrayAccess $this->container['color'] = isset($data['color']) ? $data['color'] : 'red'; // Initialize discriminator property with the model name. - $discriminator = array_search('className', self::$attributeMap); + $discriminator = array_search('className', self::$attributeMap, true); $this->container[$discriminator] = static::$openAPIModelName; } diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php index 5cdc40b6a1a..4f24eb7b46f 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/Model/MapTest.php @@ -60,7 +60,7 @@ class MapTest implements ModelInterface, ArrayAccess 'map_map_of_string' => 'map[string,map[string,string]]', 'map_of_enum_string' => 'map[string,string]', 'direct_map' => 'map[string,bool]', - 'indirect_map' => '\OpenAPI\Client\Model\StringBooleanMap' + 'indirect_map' => 'map[string,bool]' ]; /** @@ -321,7 +321,7 @@ class MapTest implements ModelInterface, ArrayAccess /** * Gets indirect_map * - * @return \OpenAPI\Client\Model\StringBooleanMap|null + * @return map[string,bool]|null */ public function getIndirectMap() { @@ -331,7 +331,7 @@ class MapTest implements ModelInterface, ArrayAccess /** * Sets indirect_map * - * @param \OpenAPI\Client\Model\StringBooleanMap|null $indirect_map indirect_map + * @param map[string,bool]|null $indirect_map indirect_map * * @return $this */ diff --git a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php index 05f6cb4e6f4..d8bff1321ac 100644 --- a/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php +++ b/samples/openapi3/client/petstore/php/OpenAPIClient-php/lib/ObjectSerializer.php @@ -29,6 +29,8 @@ namespace OpenAPI\Client; +use OpenAPI\Client\Model\ModelInterface; + /** * ObjectSerializer Class Doc Comment * @@ -61,19 +63,25 @@ class ObjectSerializer return $data; } elseif (is_object($data)) { $values = []; - $formats = $data::openAPIFormats(); - foreach ($data::openAPITypes() as $property => $openAPIType) { - $getter = $data::getters()[$property]; - $value = $data->$getter(); - if ($value !== null - && !in_array($openAPIType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) - && method_exists($openAPIType, 'getAllowableEnumValues') - && !in_array($value, $openAPIType::getAllowableEnumValues())) { - $imploded = implode("', '", $openAPIType::getAllowableEnumValues()); - throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null + && !in_array($openAPIType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) + && method_exists($openAPIType, 'getAllowableEnumValues') + && !in_array($value, $openAPIType::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $openAPIType::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + if ($value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } } - if ($value !== null) { - $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); } } return (object)$values; @@ -230,6 +238,8 @@ class ObjectSerializer if (null === $data) { return null; } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); $inner = substr($class, 4, -1); $deserialized = []; if (strrpos($inner, ",") !== false) { @@ -241,6 +251,7 @@ class ObjectSerializer } return $deserialized; } elseif (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; $subClass = substr($class, 0, -2); $values = []; foreach ($data as $key => $value) { @@ -284,12 +295,13 @@ class ObjectSerializer return new \SplFileObject($filename, 'r'); } elseif (method_exists($class, 'getAllowableEnumValues')) { - if (!in_array($data, $class::getAllowableEnumValues())) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { $imploded = implode("', '", $class::getAllowableEnumValues()); throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); } return $data; } else { + $data = is_string($data) ? json_decode($data) : $data; // If a discriminator is defined and points to a valid subclass, use it. $discriminator = $class::DISCRIMINATOR; if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { diff --git a/samples/schema/petstore-security-test/mysql/.openapi-generator-ignore b/samples/schema/petstore-security-test/mysql/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/schema/petstore-security-test/mysql/.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/schema/petstore-security-test/mysql/.openapi-generator/VERSION b/samples/schema/petstore-security-test/mysql/.openapi-generator/VERSION new file mode 100644 index 00000000000..6d94c9c2e12 --- /dev/null +++ b/samples/schema/petstore-security-test/mysql/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/schema/petstore-security-test/mysql/README.md b/samples/schema/petstore-security-test/mysql/README.md new file mode 100644 index 00000000000..54bda8398ac --- /dev/null +++ b/samples/schema/petstore-security-test/mysql/README.md @@ -0,0 +1,48 @@ +# MySQL Schema Codegen + +Main goal of this generator is to provide database structure file almost identical you usually generate with: +- PHPMyAdmin (Export structure only, SQL syntax) +- Adminer +- `mysqldump` function + +[MySQL documentation](https://dev.mysql.com/doc/) + +## Requirements +- MySQL Server ^5.7.8 (`JSON` column type added) + +## Openapi Data Type to MySQL Data Type mapping + +| Openapi Data Type | Openapi Data Format | Dependent properties | MySQL Data Types | Default MySQL Data Type | +| --- | --- | --- | --- | --- | +| `integer` | `int32` | `minimum` / `maximum` / `minimumExclusive` / `maximumExclusive` | `TINYINT` / `SMALLINT` / `MEDIUMINT`/ `INT` / `BIGINT` | `INT` | +| `integer` | `int64` | `minimum` / `maximum` / `minimumExclusive` / `maximumExclusive` | `TINYINT` / `SMALLINT` / `MEDIUMINT` / `INT` / `BIGINT` | `BIGINT` | +| `boolean` | | | `TINYINT` | `TINYINT` | +| `number` | `float` | | `DECIMAL` | `DECIMAL` | +| `number` | `double` | | `DECIMAL` | `DECIMAL` | +| `string` | | `minLength` / `maxLength` | `CHAR` / `VARCHAR` / `TEXT` / `MEDIUMTEXT` / `LONGTEXT` | `TEXT` | +| `string` | `byte` | | `TEXT` | `TEXT` | +| `string` | `binary` | | `MEDIUMBLOB` | `MEDIUMBLOB` | +| `file` | | | `MEDIUMBLOB` | `MEDIUMBLOB` | +| `string` | `date` | | `DATE` | `DATE` | +| `string` | `date-time` | | `DATETIME` | `DATETIME` | +| `string` | `enum` | | `ENUM` | `ENUM` | +| `array` | | | `JSON` | `JSON` | +| `object` | | | `JSON` | `JSON` | +| `\Model\User` (referenced definition) | | | `TEXT` | `TEXT` | + +## How to use + +Produced file(`mysql_schema.sql`) contains every table definition. Current implementation doesn't drop or modify existed tables, if you want rewrite whole schema make sure they're not presented. + +### PHPMyAdmin + +1. Choose **Import** tab from the home screen +2. In section **File to import** click to **Choose File** and find generated `mysql_schema.sql` +3. Make sure **Format** selector set to **SQL** +4. Push **Go** button + +### Adminer + +1. Click **Import** link in left sidebar +2. In **File upload** fieldset click to **Choose Files** and find generated `mysql_schema.sql` +3. Push **Execute** button diff --git a/samples/schema/petstore-security-test/mysql/mysql_schema.sql b/samples/schema/petstore-security-test/mysql/mysql_schema.sql new file mode 100644 index 00000000000..c913612f55b --- /dev/null +++ b/samples/schema/petstore-security-test/mysql/mysql_schema.sql @@ -0,0 +1,16 @@ +/* SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; */ +/* SET AUTOCOMMIT = 0; */ +/* START TRANSACTION; */ +/* SET time_zone = "+00:00"; */ + +-- -------------------------------------------------------- + +-- +-- Table structure for table `Return` generated from model 'Return' +-- Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r +-- + +CREATE TABLE IF NOT EXISTS `Return` ( + `return` INT DEFAULT NULL COMMENT 'property description *_/ ' \" =end -- \\r\\n \\n \\r' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Model for testing reserved words *_/ ' \" =end -- \\r\\n \\n \\r'; + diff --git a/samples/schema/petstore/mysql/.openapi-generator-ignore b/samples/schema/petstore/mysql/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/schema/petstore/mysql/.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/schema/petstore/mysql/.openapi-generator/VERSION b/samples/schema/petstore/mysql/.openapi-generator/VERSION new file mode 100644 index 00000000000..6d94c9c2e12 --- /dev/null +++ b/samples/schema/petstore/mysql/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/schema/petstore/mysql/README.md b/samples/schema/petstore/mysql/README.md new file mode 100644 index 00000000000..54bda8398ac --- /dev/null +++ b/samples/schema/petstore/mysql/README.md @@ -0,0 +1,48 @@ +# MySQL Schema Codegen + +Main goal of this generator is to provide database structure file almost identical you usually generate with: +- PHPMyAdmin (Export structure only, SQL syntax) +- Adminer +- `mysqldump` function + +[MySQL documentation](https://dev.mysql.com/doc/) + +## Requirements +- MySQL Server ^5.7.8 (`JSON` column type added) + +## Openapi Data Type to MySQL Data Type mapping + +| Openapi Data Type | Openapi Data Format | Dependent properties | MySQL Data Types | Default MySQL Data Type | +| --- | --- | --- | --- | --- | +| `integer` | `int32` | `minimum` / `maximum` / `minimumExclusive` / `maximumExclusive` | `TINYINT` / `SMALLINT` / `MEDIUMINT`/ `INT` / `BIGINT` | `INT` | +| `integer` | `int64` | `minimum` / `maximum` / `minimumExclusive` / `maximumExclusive` | `TINYINT` / `SMALLINT` / `MEDIUMINT` / `INT` / `BIGINT` | `BIGINT` | +| `boolean` | | | `TINYINT` | `TINYINT` | +| `number` | `float` | | `DECIMAL` | `DECIMAL` | +| `number` | `double` | | `DECIMAL` | `DECIMAL` | +| `string` | | `minLength` / `maxLength` | `CHAR` / `VARCHAR` / `TEXT` / `MEDIUMTEXT` / `LONGTEXT` | `TEXT` | +| `string` | `byte` | | `TEXT` | `TEXT` | +| `string` | `binary` | | `MEDIUMBLOB` | `MEDIUMBLOB` | +| `file` | | | `MEDIUMBLOB` | `MEDIUMBLOB` | +| `string` | `date` | | `DATE` | `DATE` | +| `string` | `date-time` | | `DATETIME` | `DATETIME` | +| `string` | `enum` | | `ENUM` | `ENUM` | +| `array` | | | `JSON` | `JSON` | +| `object` | | | `JSON` | `JSON` | +| `\Model\User` (referenced definition) | | | `TEXT` | `TEXT` | + +## How to use + +Produced file(`mysql_schema.sql`) contains every table definition. Current implementation doesn't drop or modify existed tables, if you want rewrite whole schema make sure they're not presented. + +### PHPMyAdmin + +1. Choose **Import** tab from the home screen +2. In section **File to import** click to **Choose File** and find generated `mysql_schema.sql` +3. Make sure **Format** selector set to **SQL** +4. Push **Go** button + +### Adminer + +1. Click **Import** link in left sidebar +2. In **File upload** fieldset click to **Choose Files** and find generated `mysql_schema.sql` +3. Push **Execute** button diff --git a/samples/schema/petstore/mysql/mysql_schema.sql b/samples/schema/petstore/mysql/mysql_schema.sql new file mode 100644 index 00000000000..808ea185ea5 --- /dev/null +++ b/samples/schema/petstore/mysql/mysql_schema.sql @@ -0,0 +1,333 @@ +/* SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; */ +/* SET AUTOCOMMIT = 0; */ +/* START TRANSACTION; */ +/* SET time_zone = "+00:00"; */ + +-- -------------------------------------------------------- + +-- +-- Table structure for table `$special[model.name]` generated from model 'DollarspecialLeft_Square_BracketmodelPeriodnameRight_Square_Bracket' +-- + +CREATE TABLE IF NOT EXISTS `$special[model.name]` ( + `$special[property.name]` BIGINT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `200_response` generated from model '200Underscoreresponse' +-- Model for testing model name starting with number +-- + +CREATE TABLE IF NOT EXISTS `200_response` ( + `name` INT DEFAULT NULL, + `class` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Model for testing model name starting with number'; + +-- +-- Table structure for table `AdditionalPropertiesClass` generated from model 'AdditionalPropertiesClass' +-- + +CREATE TABLE IF NOT EXISTS `AdditionalPropertiesClass` ( + `map_property` JSON DEFAULT NULL, + `map_of_map_property` JSON DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `Animal` generated from model 'Animal' +-- + +CREATE TABLE IF NOT EXISTS `Animal` ( + `className` TEXT NOT NULL, + `color` TEXT +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `ApiResponse` generated from model 'ApiResponse' +-- + +CREATE TABLE IF NOT EXISTS `ApiResponse` ( + `code` INT DEFAULT NULL, + `type` TEXT DEFAULT NULL, + `message` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `ArrayOfArrayOfNumberOnly` generated from model 'ArrayOfArrayOfNumberOnly' +-- + +CREATE TABLE IF NOT EXISTS `ArrayOfArrayOfNumberOnly` ( + `ArrayArrayNumber` JSON DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `ArrayOfNumberOnly` generated from model 'ArrayOfNumberOnly' +-- + +CREATE TABLE IF NOT EXISTS `ArrayOfNumberOnly` ( + `ArrayNumber` JSON DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `ArrayTest` generated from model 'ArrayTest' +-- + +CREATE TABLE IF NOT EXISTS `ArrayTest` ( + `array_of_string` JSON DEFAULT NULL, + `array_array_of_integer` JSON DEFAULT NULL, + `array_array_of_model` JSON DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `Capitalization` generated from model 'Capitalization' +-- + +CREATE TABLE IF NOT EXISTS `Capitalization` ( + `smallCamel` TEXT DEFAULT NULL, + `CapitalCamel` TEXT DEFAULT NULL, + `small_Snake` TEXT DEFAULT NULL, + `Capital_Snake` TEXT DEFAULT NULL, + `SCA_ETH_Flow_Points` TEXT DEFAULT NULL, + `ATT_NAME` TEXT DEFAULT NULL COMMENT 'Name of the pet ' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `Cat` generated from model 'Cat' +-- + +CREATE TABLE IF NOT EXISTS `Cat` ( + `className` TEXT NOT NULL, + `color` TEXT, + `declawed` TINYINT(1) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `Category` generated from model 'Category' +-- + +CREATE TABLE IF NOT EXISTS `Category` ( + `id` BIGINT DEFAULT NULL, + `name` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `ClassModel` generated from model 'ClassModel' +-- Model for testing model with \"_class\" property +-- + +CREATE TABLE IF NOT EXISTS `ClassModel` ( + `_class` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Model for testing model with \"_class\" property'; + +-- +-- Table structure for table `Client` generated from model 'Client' +-- + +CREATE TABLE IF NOT EXISTS `Client` ( + `client` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `Dog` generated from model 'Dog' +-- + +CREATE TABLE IF NOT EXISTS `Dog` ( + `className` TEXT NOT NULL, + `color` TEXT, + `breed` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `EnumArrays` generated from model 'EnumArrays' +-- + +CREATE TABLE IF NOT EXISTS `EnumArrays` ( + `just_symbol` ENUM('>=', '$') DEFAULT NULL, + `array_enum` JSON DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `Enum_Test` generated from model 'EnumUnderscoreTest' +-- + +CREATE TABLE IF NOT EXISTS `Enum_Test` ( + `enum_string` ENUM('UPPER', 'lower', '') DEFAULT NULL, + `enum_string_required` ENUM('UPPER', 'lower', '') NOT NULL, + `enum_integer` ENUM('1', '-1') DEFAULT NULL, + `enum_number` ENUM('1.1', '-1.2') DEFAULT NULL, + `outerEnum` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `File` generated from model 'File' +-- Must be named `File` for test. +-- + +CREATE TABLE IF NOT EXISTS `File` ( + `sourceURI` TEXT DEFAULT NULL COMMENT 'Test capitalization' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Must be named `File` for test.'; + +-- +-- Table structure for table `FileSchemaTestClass` generated from model 'FileSchemaTestClass' +-- + +CREATE TABLE IF NOT EXISTS `FileSchemaTestClass` ( + `file` TEXT DEFAULT NULL, + `files` JSON DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `format_test` generated from model 'formatUnderscoretest' +-- + +CREATE TABLE IF NOT EXISTS `format_test` ( + `integer` TINYINT UNSIGNED DEFAULT NULL, + `int32` TINYINT UNSIGNED DEFAULT NULL, + `int64` BIGINT DEFAULT NULL, + `number` DECIMAL(20, 9) UNSIGNED NOT NULL, + `float` DECIMAL(20, 9) UNSIGNED DEFAULT NULL, + `double` DECIMAL(20, 9) UNSIGNED DEFAULT NULL, + `string` TEXT DEFAULT NULL, + `byte` MEDIUMBLOB NOT NULL, + `binary` MEDIUMBLOB DEFAULT NULL, + `date` DATE NOT NULL, + `dateTime` DATETIME DEFAULT NULL, + `uuid` TEXT DEFAULT NULL, + `password` VARCHAR(64) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `hasOnlyReadOnly` generated from model 'hasOnlyReadOnly' +-- + +CREATE TABLE IF NOT EXISTS `hasOnlyReadOnly` ( + `bar` TEXT DEFAULT NULL, + `foo` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `List` generated from model 'List' +-- + +CREATE TABLE IF NOT EXISTS `List` ( + `123-list` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `MapTest` generated from model 'MapTest' +-- + +CREATE TABLE IF NOT EXISTS `MapTest` ( + `map_map_of_string` JSON DEFAULT NULL, + `map_of_enum_string` JSON DEFAULT NULL, + `direct_map` JSON DEFAULT NULL, + `indirect_map` JSON DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `MixedPropertiesAndAdditionalPropertiesClass` generated from model 'MixedPropertiesAndAdditionalPropertiesClass' +-- + +CREATE TABLE IF NOT EXISTS `MixedPropertiesAndAdditionalPropertiesClass` ( + `uuid` TEXT DEFAULT NULL, + `dateTime` DATETIME DEFAULT NULL, + `map` JSON DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `Name` generated from model 'Name' +-- Model for testing model name same as property name +-- + +CREATE TABLE IF NOT EXISTS `Name` ( + `name` INT NOT NULL, + `snake_case` INT DEFAULT NULL, + `property` TEXT DEFAULT NULL, + `123Number` INT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Model for testing model name same as property name'; + +-- +-- Table structure for table `NumberOnly` generated from model 'NumberOnly' +-- + +CREATE TABLE IF NOT EXISTS `NumberOnly` ( + `JustNumber` DECIMAL(20, 9) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `Order` generated from model 'Order' +-- + +CREATE TABLE IF NOT EXISTS `Order` ( + `id` BIGINT DEFAULT NULL, + `petId` BIGINT DEFAULT NULL, + `quantity` INT DEFAULT NULL, + `shipDate` DATETIME DEFAULT NULL, + `status` ENUM('placed', 'approved', 'delivered') DEFAULT NULL COMMENT 'Order Status', + `complete` TINYINT(1) DEFAULT false +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `OuterComposite` generated from model 'OuterComposite' +-- + +CREATE TABLE IF NOT EXISTS `OuterComposite` ( + `my_number` DECIMAL(20, 9) DEFAULT NULL, + `my_string` TEXT DEFAULT NULL, + `my_boolean` TINYINT(1) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `Pet` generated from model 'Pet' +-- + +CREATE TABLE IF NOT EXISTS `Pet` ( + `id` BIGINT DEFAULT NULL, + `category` TEXT DEFAULT NULL, + `name` TEXT NOT NULL, + `photoUrls` JSON NOT NULL, + `tags` JSON DEFAULT NULL, + `status` ENUM('available', 'pending', 'sold') DEFAULT NULL COMMENT 'pet status in the store' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `ReadOnlyFirst` generated from model 'ReadOnlyFirst' +-- + +CREATE TABLE IF NOT EXISTS `ReadOnlyFirst` ( + `bar` TEXT DEFAULT NULL, + `baz` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `Return` generated from model 'Return' +-- Model for testing reserved words +-- + +CREATE TABLE IF NOT EXISTS `Return` ( + `return` INT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='Model for testing reserved words'; + +-- +-- Table structure for table `Tag` generated from model 'Tag' +-- + +CREATE TABLE IF NOT EXISTS `Tag` ( + `id` BIGINT DEFAULT NULL, + `name` TEXT DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- +-- Table structure for table `User` generated from model 'User' +-- + +CREATE TABLE IF NOT EXISTS `User` ( + `id` BIGINT DEFAULT NULL, + `username` TEXT DEFAULT NULL, + `firstName` TEXT DEFAULT NULL, + `lastName` TEXT DEFAULT NULL, + `email` TEXT DEFAULT NULL, + `password` TEXT DEFAULT NULL, + `phone` TEXT DEFAULT NULL, + `userStatus` INT DEFAULT NULL COMMENT 'User Status' +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator-ignore b/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator/VERSION b/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator/VERSION new file mode 100644 index 00000000000..6d94c9c2e12 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/openapi3/petstore/kotlin-springboot/README.md b/samples/server/openapi3/petstore/kotlin-springboot/README.md new file mode 100644 index 00000000000..b6865a08113 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/README.md @@ -0,0 +1,21 @@ +# openAPIPetstore + +This Kotlin based [Spring Boot](https://spring.io/projects/spring-boot) application has been generated using the [OpenAPI Generator](https://github.com/OpenAPITools/openapi-generator). + +## Getting Started + +This document assumes you have either maven or gradle available, either via the wrapper or otherwise. This does not come with a gradle / maven wrapper checked in. + +By default a [`pom.xml`](pom.xml) file will be generated. If you specified `gradleBuildFile=true` when generating this project, a `build.gradle.kts` will also be generated. Note this uses [Gradle Kotlin DSL](https://github.com/gradle/kotlin-dsl). + +To build the project using maven, run: +```bash +mvn package && java -jar target/openapi-spring-1.0.0.jar +``` + +To build the project using gradle, run: +```bash +gradle build && java -jar build/libs/openapi-spring-1.0.0.jar +``` + +If all builds successfully, the server should run on [http://localhost:8080/](http://localhost:8080/) diff --git a/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts b/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts new file mode 100644 index 00000000000..f7a2deac996 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/build.gradle.kts @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +buildscript { + repositories { + jcenter() + mavenCentral() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + } +} + +group = "org.openapitools" +version = "1.0.0" + +repositories { + jcenter() + mavenCentral() +} + +tasks.withType { + kotlinOptions.jvmTarget = "1.8" +} + +plugins { + val kotlinVersion = "1.2.60" + id("org.jetbrains.kotlin.jvm") version kotlinVersion + id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion + id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion + id("org.springframework.boot") version "2.0.3.RELEASE" + id("io.spring.dependency-management") version "1.0.5.RELEASE" +} + +dependencies { + 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.springframework.boot:spring-boot-starter-test") { + exclude(module = "junit") + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/pom.xml b/samples/server/openapi3/petstore/kotlin-springboot/pom.xml new file mode 100644 index 00000000000..96ed05a21d5 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/pom.xml @@ -0,0 +1,109 @@ + + 4.0.0 + org.openapitools + openapi-spring + jar + openapi-spring + 1.0.0 + + 1.2.60 + + + org.springframework.boot + spring-boot-starter-parent + 2.0.3.RELEASE + + + ${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.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 + + + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/settings.gradle b/samples/server/openapi3/petstore/kotlin-springboot/settings.gradle new file mode 100644 index 00000000000..f0dd035311e --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "openapi-spring" \ No newline at end of file diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/Application.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/Application.kt new file mode 100644 index 00000000000..f2ee49d476b --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/Application.kt @@ -0,0 +1,14 @@ +package org.openapitools + +import org.springframework.boot.runApplication +import org.springframework.context.annotation.ComponentScan +import org.springframework.boot.autoconfigure.SpringBootApplication + + +@SpringBootApplication +@ComponentScan(basePackages = ["org.openapitools", "org.openapitools.api", "org.openapitools.model"]) +class Application + +fun main(args: Array) { + runApplication(*args) +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/Exceptions.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/Exceptions.kt new file mode 100644 index 00000000000..4d8400902aa --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/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/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt new file mode 100644 index 00000000000..17b87c74fdf --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -0,0 +1,159 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import io.swagger.annotations.* +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity +import org.springframework.stereotype.Controller +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +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.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.web.multipart.MultipartFile +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.* + +import kotlin.collections.List +import kotlin.collections.Map + +@Controller +@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 pet: Pet): ResponseEntity { + return ResponseEntity(service.addPet(pet), HttpStatus.OK) + } + + @ApiOperation( + value = "Deletes a pet", + nickname = "deletePet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid pet value")]) + @RequestMapping( + value = ["/pet/{petId}"], + method = [RequestMethod.DELETE]) + fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String?): ResponseEntity { + return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK) + } + + @ApiOperation( + value = "Finds Pets by status", + nickname = "findPetsByStatus", + notes = "Multiple status values can be provided with comma separated strings", + response = Pet::class, + responseContainer = "List", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "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: List): ResponseEntity> { + return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK) + } + + @ApiOperation( + value = "Finds Pets by tags", + nickname = "findPetsByTags", + notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + response = Pet::class, + responseContainer = "List", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "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: List): ResponseEntity> { + return ResponseEntity(service.findPetsByTags(tags), HttpStatus.OK) + } + + @ApiOperation( + value = "Find pet by ID", + nickname = "getPetById", + notes = "Returns a single pet", + response = Pet::class, + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")]) + @RequestMapping( + value = ["/pet/{petId}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long): ResponseEntity { + return ResponseEntity(service.getPetById(petId), HttpStatus.OK) + } + + @ApiOperation( + value = "Update an existing pet", + nickname = "updatePet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")]) + @RequestMapping( + value = ["/pet"], + consumes = ["application/json", "application/xml"], + method = [RequestMethod.PUT]) + fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet): ResponseEntity { + return ResponseEntity(service.updatePet(pet), HttpStatus.OK) + } + + @ApiOperation( + value = "Updates a pet in the store with form data", + nickname = "updatePetWithForm", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 405, message = "Invalid input")]) + @RequestMapping( + value = ["/pet/{petId}"], + consumes = ["application/x-www-form-urlencoded"], + method = [RequestMethod.POST]) + fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long,@ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestParam(value="name", required=false) name: String ,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) status: String ): ResponseEntity { + return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK) + } + + @ApiOperation( + value = "uploads an image", + nickname = "uploadFile", + notes = "", + response = ModelApiResponse::class, + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)]) + @RequestMapping( + value = ["/pet/{petId}/uploadImage"], + produces = ["application/json"], + consumes = ["multipart/form-data"], + method = [RequestMethod.POST]) + fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String ,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: MultipartFile): ResponseEntity { + return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK) + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt new file mode 100644 index 00000000000..b31d96e91b7 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -0,0 +1,23 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet + +interface PetApiService { + + fun addPet(pet: Pet): Unit + + fun deletePet(petId: Long,apiKey: String?): Unit + + fun findPetsByStatus(status: List): List + + fun findPetsByTags(tags: List): List + + fun getPetById(petId: Long): Pet + + fun updatePet(pet: Pet): Unit + + fun updatePetWithForm(petId: Long,name: String,status: String): Unit + + fun uploadFile(petId: Long,additionalMetadata: String,file: org.springframework.web.multipart.MultipartFile): ModelApiResponse +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt new file mode 100644 index 00000000000..80b7d6e8fe1 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -0,0 +1,41 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import org.springframework.stereotype.Service + +@Service +class PetApiServiceImpl : PetApiService { + + override fun addPet(pet: Pet): Unit { + TODO("Implement me") + } + + override fun deletePet(petId: Long,apiKey: String?): Unit { + TODO("Implement me") + } + + override fun findPetsByStatus(status: List): List { + TODO("Implement me") + } + + override fun findPetsByTags(tags: List): List { + TODO("Implement me") + } + + override fun getPetById(petId: Long): Pet { + TODO("Implement me") + } + + override fun updatePet(pet: Pet): Unit { + TODO("Implement me") + } + + override fun updatePetWithForm(petId: Long,name: String,status: String): Unit { + TODO("Implement me") + } + + override fun uploadFile(petId: Long,additionalMetadata: String,file: org.springframework.web.multipart.MultipartFile): ModelApiResponse { + TODO("Implement me") + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt new file mode 100644 index 00000000000..f277e808906 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -0,0 +1,93 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import io.swagger.annotations.* +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity +import org.springframework.stereotype.Controller +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +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.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.web.multipart.MultipartFile +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.* + +import kotlin.collections.List +import kotlin.collections.Map + +@Controller +@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: String): ResponseEntity { + return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK) + } + + @ApiOperation( + value = "Returns pet inventories by status", + nickname = "getInventory", + notes = "Returns a map of status codes to quantities", + response = Int::class, + responseContainer = "Map", + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Map::class, responseContainer = "Map")]) + @RequestMapping( + value = ["/store/inventory"], + produces = ["application/json"], + method = [RequestMethod.GET]) + fun getInventory(): ResponseEntity> { + return ResponseEntity(service.getInventory(), HttpStatus.OK) + } + + @ApiOperation( + value = "Find purchase order by ID", + nickname = "getOrderById", + notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + response = Order::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) + @RequestMapping( + value = ["/store/order/{orderId}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long): ResponseEntity { + return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK) + } + + @ApiOperation( + value = "Place an order for a pet", + nickname = "placeOrder", + notes = "", + response = Order::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")]) + @RequestMapping( + value = ["/store/order"], + produces = ["application/xml", "application/json"], + consumes = ["application/json"], + method = [RequestMethod.POST]) + fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order): ResponseEntity { + return ResponseEntity(service.placeOrder(order), HttpStatus.OK) + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt new file mode 100644 index 00000000000..7767fa87a8a --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -0,0 +1,14 @@ +package org.openapitools.api + +import org.openapitools.model.Order + +interface StoreApiService { + + fun deleteOrder(orderId: String): Unit + + fun getInventory(): Map + + fun getOrderById(orderId: Long): Order + + fun placeOrder(order: Order): Order +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt new file mode 100644 index 00000000000..850853758fe --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt @@ -0,0 +1,24 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import org.springframework.stereotype.Service + +@Service +class StoreApiServiceImpl : StoreApiService { + + override fun deleteOrder(orderId: String): Unit { + TODO("Implement me") + } + + override fun getInventory(): Map { + TODO("Implement me") + } + + override fun getOrderById(orderId: Long): Order { + TODO("Implement me") + } + + override fun placeOrder(order: Order): Order { + TODO("Implement me") + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt new file mode 100644 index 00000000000..6822bccecaf --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -0,0 +1,144 @@ +package org.openapitools.api + +import org.openapitools.model.User +import io.swagger.annotations.* +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity +import org.springframework.stereotype.Controller +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +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.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.web.multipart.MultipartFile +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.* + +import kotlin.collections.List +import kotlin.collections.Map + +@Controller +@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"], + consumes = ["application/json"], + method = [RequestMethod.POST]) + fun createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity { + return ResponseEntity(service.createUser(user), HttpStatus.OK) + } + + @ApiOperation( + value = "Creates list of users with given input array", + nickname = "createUsersWithArrayInput", + notes = "") + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation")]) + @RequestMapping( + value = ["/user/createWithArray"], + consumes = ["application/json"], + method = [RequestMethod.POST]) + fun createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List): ResponseEntity { + return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.OK) + } + + @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"], + consumes = ["application/json"], + method = [RequestMethod.POST]) + fun createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody user: List): ResponseEntity { + return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.OK) + } + + @ApiOperation( + value = "Delete user", + nickname = "deleteUser", + notes = "This can only be done by the logged in user.") + @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: String): ResponseEntity { + return ResponseEntity(service.deleteUser(username), HttpStatus.OK) + } + + @ApiOperation( + value = "Get user by user name", + nickname = "getUserByName", + notes = "", + response = User::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String): ResponseEntity { + return ResponseEntity(service.getUserByName(username), HttpStatus.OK) + } + + @ApiOperation( + value = "Logs user into the system", + nickname = "loginUser", + notes = "", + response = String::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) + @RequestMapping( + value = ["/user/login"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String): ResponseEntity { + return ResponseEntity(service.loginUser(username, password), HttpStatus.OK) + } + + @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.OK) + } + + @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}"], + consumes = ["application/json"], + method = [RequestMethod.PUT]) + fun updateUser(@ApiParam(value = "name that need to be deleted", required=true) @PathVariable("username") username: String,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity { + return ResponseEntity(service.updateUser(username, user), HttpStatus.OK) + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt new file mode 100644 index 00000000000..b8a3d7ebae1 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -0,0 +1,22 @@ +package org.openapitools.api + +import org.openapitools.model.User + +interface UserApiService { + + fun createUser(user: User): Unit + + fun createUsersWithArrayInput(user: List): Unit + + fun createUsersWithListInput(user: List): Unit + + fun deleteUser(username: String): Unit + + fun getUserByName(username: String): User + + fun loginUser(username: String,password: String): String + + fun logoutUser(): Unit + + fun updateUser(username: String,user: User): Unit +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt new file mode 100644 index 00000000000..62b365a6d82 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -0,0 +1,40 @@ +package org.openapitools.api + +import org.openapitools.model.User +import org.springframework.stereotype.Service + +@Service +class UserApiServiceImpl : UserApiService { + + override fun createUser(user: User): Unit { + TODO("Implement me") + } + + override fun createUsersWithArrayInput(user: List): Unit { + TODO("Implement me") + } + + override fun createUsersWithListInput(user: List): Unit { + TODO("Implement me") + } + + override fun deleteUser(username: String): Unit { + TODO("Implement me") + } + + override fun getUserByName(username: String): User { + TODO("Implement me") + } + + override fun loginUser(username: String,password: String): String { + TODO("Implement me") + } + + override fun logoutUser(): Unit { + TODO("Implement me") + } + + override fun updateUser(username: String,user: User): Unit { + TODO("Implement me") + } +} diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Body.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Body.kt new file mode 100644 index 00000000000..df03586b383 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Body.kt @@ -0,0 +1,24 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.Valid +import javax.validation.constraints.* +import io.swagger.annotations.ApiModelProperty + +/** + * + * @param name Updated name of the pet + * @param status Updated status of the pet + */ +data class Body ( + + @ApiModelProperty(value = "Updated name of the pet") + @JsonProperty("name") val name: String? = null, + + @ApiModelProperty(value = "Updated status of the pet") + @JsonProperty("status") val status: String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Body1.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Body1.kt new file mode 100644 index 00000000000..1e95e248d1c --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Body1.kt @@ -0,0 +1,24 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.Valid +import javax.validation.constraints.* +import io.swagger.annotations.ApiModelProperty + +/** + * + * @param additionalMetadata Additional data to pass to server + * @param file file to upload + */ +data class Body1 ( + + @ApiModelProperty(value = "Additional data to pass to server") + @JsonProperty("additionalMetadata") val additionalMetadata: String? = null, + + @ApiModelProperty(value = "file to upload") + @JsonProperty("file") val file: java.io.File? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt new file mode 100644 index 00000000000..da259e87b8e --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt @@ -0,0 +1,24 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.Valid +import javax.validation.constraints.* +import io.swagger.annotations.ApiModelProperty + +/** + * A category for a pet + * @param id + * @param name + */ +data class Category ( + + @ApiModelProperty(value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("name") val name: String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt new file mode 100644 index 00000000000..e933f2436a4 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -0,0 +1,28 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.Valid +import javax.validation.constraints.* +import io.swagger.annotations.ApiModelProperty + +/** + * Describes the result of uploading an image resource + * @param code + * @param type + * @param message + */ +data class ModelApiResponse ( + + @ApiModelProperty(value = "") + @JsonProperty("code") val code: Int? = null, + + @ApiModelProperty(value = "") + @JsonProperty("type") val type: String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("message") val message: String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt new file mode 100644 index 00000000000..e1065f56bd3 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt @@ -0,0 +1,55 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import javax.validation.Valid +import javax.validation.constraints.* +import 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(value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("petId") val petId: Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("quantity") val quantity: Int? = null, + + @ApiModelProperty(value = "") + @JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + + @ApiModelProperty(value = "Order Status") + @JsonProperty("status") val status: Order.Status? = null, + + @ApiModelProperty(value = "") + @JsonProperty("complete") val complete: Boolean? = null +) { + + /** + * Order Status + * Values: placed,approved,delivered + */ + enum class Status(val value: String) { + + @JsonProperty("placed") placed("placed"), + + @JsonProperty("approved") approved("approved"), + + @JsonProperty("delivered") delivered("delivered"); + + } + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt new file mode 100644 index 00000000000..967bd0846b6 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt @@ -0,0 +1,59 @@ +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.Valid +import javax.validation.constraints.* +import io.swagger.annotations.ApiModelProperty + +/** + * A pet for sale in the pet store + * @param id + * @param category + * @param name + * @param photoUrls + * @param tags + * @param status pet status in the store + */ +data class Pet ( + + @get:NotNull + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty("name") val name: String, + + @get:NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("photoUrls") val photoUrls: List, + + @ApiModelProperty(value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("category") val category: Category? = null, + + @ApiModelProperty(value = "") + @JsonProperty("tags") val tags: List? = null, + + @ApiModelProperty(value = "pet status in the store") + @JsonProperty("status") val status: Pet.Status? = null +) { + + /** + * pet status in the store + * Values: available,pending,sold + */ + enum class Status(val value: String) { + + @JsonProperty("available") available("available"), + + @JsonProperty("pending") pending("pending"), + + @JsonProperty("sold") sold("sold"); + + } + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt new file mode 100644 index 00000000000..e40833c55fd --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt @@ -0,0 +1,24 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.Valid +import javax.validation.constraints.* +import io.swagger.annotations.ApiModelProperty + +/** + * A tag for a pet + * @param id + * @param name + */ +data class Tag ( + + @ApiModelProperty(value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("name") val name: String? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt new file mode 100644 index 00000000000..b9cc2886ea0 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt @@ -0,0 +1,48 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.Valid +import javax.validation.constraints.* +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(value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("username") val username: String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("firstName") val firstName: String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("lastName") val lastName: String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("email") val email: String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("password") val password: String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("phone") val phone: String? = null, + + @ApiModelProperty(value = "User Status") + @JsonProperty("userStatus") val userStatus: Int? = null +) { + +} + diff --git a/samples/server/openapi3/petstore/kotlin-springboot/src/main/resources/application.yaml b/samples/server/openapi3/petstore/kotlin-springboot/src/main/resources/application.yaml new file mode 100644 index 00000000000..8e2ebcde976 --- /dev/null +++ b/samples/server/openapi3/petstore/kotlin-springboot/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-security-test/lumen/.openapi-generator/VERSION b/samples/server/petstore-security-test/lumen/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/server/petstore-security-test/lumen/.openapi-generator/VERSION +++ b/samples/server/petstore-security-test/lumen/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore-security-test/lumen/lib/app/Http/Controllers/FakeApi.php b/samples/server/petstore-security-test/lumen/lib/app/Http/Controllers/FakeApi.php index 8e3320c2eef..c02ad03ba34 100644 --- a/samples/server/petstore-security-test/lumen/lib/app/Http/Controllers/FakeApi.php +++ b/samples/server/petstore-security-test/lumen/lib/app/Http/Controllers/FakeApi.php @@ -1,11 +1,11 @@ get('/', function () use ($app) { @@ -23,9 +23,9 @@ $app->get('/', function () use ($app) { /** * put testCodeInjectEndRnNR - * Summary: To test code injection ' \" =end -- \\r\\n \\n \\r - * Notes: + * Summary: To test code injection *_/ ' \" =end -- \\r\\n \\n \\r + * Notes: To test code injection *_/ ' \" =end -- \\r\\n \\n \\r */ -$app->put('/fake', 'FakeApi@testCodeInjectEndRnNR'); +$app->put('/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r/fake', 'FakeApi@testCodeInjectEndRnNR'); diff --git a/samples/server/petstore-security-test/lumen/lib/readme.md b/samples/server/petstore-security-test/lumen/lib/readme.md index b57e2fc40ba..01b8099336c 100644 --- a/samples/server/petstore-security-test/lumen/lib/readme.md +++ b/samples/server/petstore-security-test/lumen/lib/readme.md @@ -14,3 +14,8 @@ This example uses the [Lumen Framework](http://lumen.laravel.com/). To see how Using `composer install` to install the framework and dependencies via [Composer](http://getcomposer.org/). +### Running the generated server stub + +```bash +php -S localhost:8080 public/index.php +``` diff --git a/samples/server/petstore-security-test/php-slim/.openapi-generator/VERSION b/samples/server/petstore-security-test/php-slim/.openapi-generator/VERSION index 4395ff59232..6d94c9c2e12 100644 --- a/samples/server/petstore-security-test/php-slim/.openapi-generator/VERSION +++ b/samples/server/petstore-security-test/php-slim/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore-security-test/php-slim/README.md b/samples/server/petstore-security-test/php-slim/README.md index 337746cd020..20eb0877e19 100644 --- a/samples/server/petstore-security-test/php-slim/README.md +++ b/samples/server/petstore-security-test/php-slim/README.md @@ -5,7 +5,7 @@ ## Requirements * Web server with URL rewriting -* PHP 5.5 or newer +* PHP 5.5.9 or newer This package contains `.htaccess` for Apache configuration. If you use another server(Nginx, HHVM, IIS, lighttpd) check out [Web Servers](https://www.slimframework.com/docs/v3/start/web-servers.html) doc. @@ -30,15 +30,20 @@ $ php -S localhost:8888 -t php-slim-server ## Run tests -This package uses PHPUnit 4.8 for unit testing. +This package uses PHPUnit 4.8 for unit testing and PHP Codesniffer to check source code against user defined coding standard(`phpcsStandard` generator config option). [Test folder](test) contains templates which you can fill with real test assertions. How to write tests read at [PHPUnit Manual - Chapter 2. Writing Tests for PHPUnit](https://phpunit.de/manual/4.8/en/writing-tests-for-phpunit.html). +How to configure PHP CodeSniffer read at [PHP CodeSniffer Documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki). +There is [phplint](https://github.com/overtrue/phplint) tool to check php syntax automatically. Command | Tool | Target ---- | ---- | ---- `$ composer test` | PHPUnit | All tests `$ composer run test-apis` | PHPUnit | Apis tests `$ composer run test-models` | PHPUnit | Models tests +`$ composer run phpcs` | PHP CodeSniffer | All files +`$ composer run phplint` | phplint | All files + ## API Endpoints diff --git a/samples/server/petstore-security-test/php-slim/composer.json b/samples/server/petstore-security-test/php-slim/composer.json index ca199179020..1c4e6a790f8 100644 --- a/samples/server/petstore-security-test/php-slim/composer.json +++ b/samples/server/petstore-security-test/php-slim/composer.json @@ -1,12 +1,14 @@ { "minimum-stability": "RC", "require": { - "php": ">=5.5", + "php": ">=5.5.9", "slim/slim": "3.*", "tuupola/slim-basic-auth": "^3.0.0" }, "require-dev": { - "phpunit/phpunit": "^4.8" + "phpunit/phpunit": "^4.8", + "overtrue/phplint": "^1.0", + "squizlabs/php_codesniffer": "^3.0" }, "autoload": { "psr-4": { "OpenAPIServer\\": "lib/" } @@ -20,6 +22,8 @@ "@test-models" ], "test-apis": "phpunit --testsuite Apis", - "test-models": "phpunit --testsuite Models" + "test-models": "phpunit --testsuite Models", + "phpcs": "phpcs ./ --ignore=vendor --warning-severity=0 --standard=PSR12", + "phplint": "phplint ./ --exclude=vendor" } -} \ No newline at end of file +} diff --git a/samples/server/petstore-security-test/php-slim/composer.lock b/samples/server/petstore-security-test/php-slim/composer.lock index fcf4c150619..91f98b9ed53 100644 --- a/samples/server/petstore-security-test/php-slim/composer.lock +++ b/samples/server/petstore-security-test/php-slim/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "7abeaa62669cac171aa0692df2e1943b", + "content-hash": "df189d30a7ab9ec76b4d8994a6cfaec9", "packages": [ { "name": "container-interop/container-interop", @@ -37,59 +37,6 @@ "homepage": "https://github.com/container-interop/container-interop", "time": "2017-02-14T19:40:03+00:00" }, - { - "name": "http-interop/http-factory", - "version": "0.3.0", - "source": { - "type": "git", - "url": "https://github.com/http-interop/http-factory.git", - "reference": "c2587cc0a6f74987fefb5b8074acfd32c69a4b0f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/http-interop/http-factory/zipball/c2587cc0a6f74987fefb5b8074acfd32c69a4b0f", - "reference": "c2587cc0a6f74987fefb5b8074acfd32c69a4b0f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/http-message": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Interop\\Http\\Factory\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP message factories", - "keywords": [ - "factory", - "http", - "message", - "psr", - "psr-17", - "psr-7", - "request", - "response" - ], - "abandoned": "psr/http-factory", - "time": "2017-03-24T14:48:51+00:00" - }, { "name": "nikic/fast-route", "version": "v1.3.0", @@ -235,6 +182,58 @@ ], "time": "2017-02-14T16:28:37+00:00" }, + { + "name": "psr/http-factory", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/378bfe27931ecc54ff824a20d6f6bfc303bbd04c", + "reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c", + "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": "2018-07-30T21:54:04+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -464,20 +463,20 @@ }, { "name": "tuupola/callable-handler", - "version": "0.3.0", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/tuupola/callable-handler.git", - "reference": "5141efa1e974687a3fa53338811a988198f50662" + "reference": "662744a6a4a52235be5bd73ac04de4375eff3fc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tuupola/callable-handler/zipball/5141efa1e974687a3fa53338811a988198f50662", - "reference": "5141efa1e974687a3fa53338811a988198f50662", + "url": "https://api.github.com/repos/tuupola/callable-handler/zipball/662744a6a4a52235be5bd73ac04de4375eff3fc9", + "reference": "662744a6a4a52235be5bd73ac04de4375eff3fc9", "shasum": "" }, "require": { - "php": "^7.0", + "php": "^7.1", "psr/http-server-middleware": "^1.0" }, "require-dev": { @@ -485,7 +484,7 @@ "overtrue/phplint": "^1.0", "phpunit/phpunit": "^6.5", "squizlabs/php_codesniffer": "^3.2", - "tuupola/http-factory": "^0.3.0", + "tuupola/http-factory": "^0.4.0", "zendframework/zend-diactoros": "^1.6" }, "type": "library", @@ -513,29 +512,30 @@ "psr-15", "psr-7" ], - "time": "2018-01-23T04:07:25+00:00" + "time": "2018-08-02T11:15:40+00:00" }, { "name": "tuupola/http-factory", - "version": "0.3.0", + "version": "0.4.2", "source": { "type": "git", "url": "https://github.com/tuupola/http-factory.git", - "reference": "57b2e19ff3f4af0bbee4e31fd282689be351f1ad" + "reference": "c7e2712d5c4f49ddae704ae1f42854f437ddb028" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tuupola/http-factory/zipball/57b2e19ff3f4af0bbee4e31fd282689be351f1ad", - "reference": "57b2e19ff3f4af0bbee4e31fd282689be351f1ad", + "url": "https://api.github.com/repos/tuupola/http-factory/zipball/c7e2712d5c4f49ddae704ae1f42854f437ddb028", + "reference": "c7e2712d5c4f49ddae704ae1f42854f437ddb028", "shasum": "" }, "require": { - "http-interop/http-factory": "^0.3.0" + "php": "^7.1", + "psr/http-factory": "^1.0" }, "require-dev": { - "http-interop/http-factory-tests": "^0.3.0", - "overtrue/phplint": "^0.2.1", - "phpunit/phpunit": "^5.7", + "http-interop/http-factory-tests": "^0.5.0", + "overtrue/phplint": "^1.0", + "phpunit/phpunit": "^6.5", "squizlabs/php_codesniffer": "^3.0" }, "type": "library", @@ -563,29 +563,28 @@ "psr-17", "psr-7" ], - "time": "2017-07-15T22:03:15+00:00" + "time": "2018-08-09T09:02:33+00:00" }, { "name": "tuupola/slim-basic-auth", - "version": "3.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/tuupola/slim-basic-auth.git", - "reference": "b169fba3113059548e3a2ac4096b1b08616b070e" + "reference": "e4bbd5e9f609cb6e83264e56f79289fea48c8bbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tuupola/slim-basic-auth/zipball/b169fba3113059548e3a2ac4096b1b08616b070e", - "reference": "b169fba3113059548e3a2ac4096b1b08616b070e", + "url": "https://api.github.com/repos/tuupola/slim-basic-auth/zipball/e4bbd5e9f609cb6e83264e56f79289fea48c8bbc", + "reference": "e4bbd5e9f609cb6e83264e56f79289fea48c8bbc", "shasum": "" }, "require": { - "http-interop/http-factory": "^0.3.0", "php": "^7.1", "psr/http-message": "^1.0", "psr/http-server-middleware": "^1.0", - "tuupola/callable-handler": "^0.3.0", - "tuupola/http-factory": "^0.3.0" + "tuupola/callable-handler": "^0.3.0|^0.4.0", + "tuupola/http-factory": "^0.4.0" }, "require-dev": { "codedungeon/phpunit-result-printer": "^0.6.0", @@ -621,7 +620,7 @@ "psr-15", "psr-7" ], - "time": "2018-05-06T05:41:44+00:00" + "time": "2018-08-07T08:09:49+00:00" } ], "packages-dev": [ @@ -679,6 +678,59 @@ ], "time": "2017-07-22T11:58:36+00:00" }, + { + "name": "overtrue/phplint", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/overtrue/phplint.git", + "reference": "b8822e30b5bd1412471520901ba148c5417656c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/overtrue/phplint/zipball/b8822e30b5bd1412471520901ba148c5417656c8", + "reference": "b8822e30b5bd1412471520901ba148c5417656c8", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.5.9", + "symfony/console": "^3.2|^4.0", + "symfony/finder": "^3.0|^4.0", + "symfony/process": "^3.0|^4.0", + "symfony/yaml": "^3.0|^4.0" + }, + "require-dev": { + "jakub-onderka/php-console-highlighter": "^0.3.2" + }, + "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": "2018-06-19T06:30:45+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "1.0.1", @@ -1642,6 +1694,123 @@ "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21T13:59:46+00:00" }, + { + "name": "symfony/console", + "version": "v4.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/ca80b8ced97cf07390078b29773dc384c39eee1f", + "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0" + }, + "suggest": { + "psr/log-implementation": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-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": "2018-07-26T11:24:31+00:00" + }, + { + "name": "symfony/finder", + "version": "v4.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/e162f1df3102d0b7472805a5a9d5db9fcf0a8068", + "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-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": "2018-07-26T11:24:31+00:00" + }, { "name": "symfony/polyfill-ctype", "version": "v1.9.0", @@ -1700,6 +1869,114 @@ ], "time": "2018-08-06T14:22:27+00:00" }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-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": "2018-08-06T14:22:27+00:00" + }, + { + "name": "symfony/process", + "version": "v4.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "f01fc7a4493572f7f506c49dcb50ad01fb3a2f56" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/f01fc7a4493572f7f506c49dcb50ad01fb3a2f56", + "reference": "f01fc7a4493572f7f506c49dcb50ad01fb3a2f56", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-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": "2018-07-26T11:24:31+00:00" + }, { "name": "symfony/yaml", "version": "v3.4.14", @@ -1816,7 +2093,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.5" + "php": ">=5.5.9" }, "platform-dev": [] } diff --git a/samples/server/petstore-security-test/php-slim/lib/AbstractApiController.php b/samples/server/petstore-security-test/php-slim/lib/AbstractApiController.php index 03b525eb3ee..9d6b899e2d3 100644 --- a/samples/server/petstore-security-test/php-slim/lib/AbstractApiController.php +++ b/samples/server/petstore-security-test/php-slim/lib/AbstractApiController.php @@ -36,7 +36,8 @@ namespace OpenAPIServer; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -abstract class AbstractApiController { +abstract class AbstractApiController +{ /** * @var \Interop\Container\ContainerInterface Slim app container instance @@ -48,8 +49,8 @@ abstract class AbstractApiController { * * @param \Interop\Container\ContainerInterface $container Slim app container instance */ - public function __construct($container) { + public function __construct($container) + { $this->container = $container; } - } diff --git a/samples/server/petstore-security-test/php-slim/lib/Api/FakeApi.php b/samples/server/petstore-security-test/php-slim/lib/Api/FakeApi.php index 464145051c8..e5f473ac0a3 100644 --- a/samples/server/petstore-security-test/php-slim/lib/Api/FakeApi.php +++ b/samples/server/petstore-security-test/php-slim/lib/Api/FakeApi.php @@ -38,8 +38,9 @@ use OpenAPIServer\AbstractApiController; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -class FakeApi extends AbstractApiController { - +class FakeApi extends AbstractApiController +{ + /** * PUT testCodeInjectEndRnNR * Summary: To test code injection *_/ ' \" =end -- \\r\\n \\n \\r @@ -49,10 +50,10 @@ class FakeApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function testCodeInjectEndRnNR($request, $response, $args) { + public function testCodeInjectEndRnNR($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing testCodeInjectEndRnNR as a PUT method ?'); return $response; } - } diff --git a/samples/server/petstore-security-test/php-slim/lib/Model/ModelReturn.php b/samples/server/petstore-security-test/php-slim/lib/Model/ModelReturn.php index f070d4efccd..8cf6a29ab8e 100644 --- a/samples/server/petstore-security-test/php-slim/lib/Model/ModelReturn.php +++ b/samples/server/petstore-security-test/php-slim/lib/Model/ModelReturn.php @@ -7,9 +7,9 @@ namespace OpenAPIServer\Model; /** * ModelReturn */ -class ModelReturn { - +class ModelReturn +{ + /** @var int $return property description *_/ ' \" =end -- \\r\\n \\n \\r*/ private $return; - } diff --git a/samples/server/petstore-security-test/php-slim/lib/SlimRouter.php b/samples/server/petstore-security-test/php-slim/lib/SlimRouter.php index 794b6192388..0b7509aab71 100644 --- a/samples/server/petstore-security-test/php-slim/lib/SlimRouter.php +++ b/samples/server/petstore-security-test/php-slim/lib/SlimRouter.php @@ -10,7 +10,7 @@ * @link https://github.com/openapitools/openapi-generator */ -/** +/** * OpenAPI Petstore *_/ ' \" =end -- \\r\\n \\n \\r * * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ *_/ ' \" =end -- @@ -42,7 +42,8 @@ use Tuupola\Middleware\HttpBasicAuthentication; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -class SlimRouter { +class SlimRouter +{ /** * @var $slimApp Slim\App instance @@ -55,7 +56,8 @@ class SlimRouter { * @param ContainerInterface|array $container Either a ContainerInterface or an associative array of app settings * @throws InvalidArgumentException when no container is provided that implements ContainerInterface */ - public function __construct($container = []) { + public function __construct($container = []) + { $app = new App($container); $basicAuth = new HttpBasicAuthentication([ @@ -68,7 +70,8 @@ class SlimRouter { ]); $app->PUT( - '/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r/fake', FakeApi::class . ':testCodeInjectEndRnNR' + '/ ' \" =end -- \\r\\n \\n \\r/v2 *_/ ' \" =end -- \\r\\n \\n \\r/fake', + FakeApi::class . ':testCodeInjectEndRnNR' ); $this->slimApp = $app; @@ -78,7 +81,8 @@ class SlimRouter { * Returns Slim Framework instance * @return App */ - public function getSlimApp() { + public function getSlimApp() + { return $this->slimApp; } } diff --git a/samples/server/petstore-security-test/php-slim/test/Api/FakeApiTest.php b/samples/server/petstore-security-test/php-slim/test/Api/FakeApiTest.php index 3205216ec96..de4df30629f 100644 --- a/samples/server/petstore-security-test/php-slim/test/Api/FakeApiTest.php +++ b/samples/server/petstore-security-test/php-slim/test/Api/FakeApiTest.php @@ -37,34 +37,35 @@ use OpenAPIServer\Api\FakeApi; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\FakeApi */ -class FakeApiTest extends \PHPUnit_Framework_TestCase { +class FakeApiTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** @@ -73,7 +74,7 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { * To test code injection *_/ ' \" =end -- \\r\\n \\n \\r. * @covers ::testCodeInjectEndRnNR */ - public function testTestCodeInjectEndRnNR() { - + public function testTestCodeInjectEndRnNR() + { } } diff --git a/samples/server/petstore-security-test/php-slim/test/Model/ModelReturnTest.php b/samples/server/petstore-security-test/php-slim/test/Model/ModelReturnTest.php index d535c902fc2..036a63c111d 100644 --- a/samples/server/petstore-security-test/php-slim/test/Model/ModelReturnTest.php +++ b/samples/server/petstore-security-test/php-slim/test/Model/ModelReturnTest.php @@ -37,48 +37,49 @@ use OpenAPIServer\Model\ModelReturn; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\ModelReturn */ -class ModelReturnTest extends \PHPUnit_Framework_TestCase { +class ModelReturnTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "ModelReturn" */ - public function testModelReturn() { + public function testModelReturn() + { $testModelReturn = new ModelReturn(); } /** * Test attribute "return" */ - public function testPropertyReturn() { - + public function testPropertyReturn() + { } } - diff --git a/samples/server/petstore/aspnetcore/.openapi-generator/VERSION b/samples/server/petstore/aspnetcore/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/server/petstore/aspnetcore/.openapi-generator/VERSION +++ b/samples/server/petstore/aspnetcore/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs index 0be78aacc4f..9ea99af7cdf 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/PetApi.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.SwaggerGen; using Newtonsoft.Json; using System.ComponentModel.DataAnnotations; @@ -22,7 +23,7 @@ namespace Org.OpenAPITools.Controllers /// /// /// - public class PetApiController : Controller + public class PetApiController : ControllerBase { /// /// Add a new pet to the store diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs index ed5f6e327ee..2b46191a792 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/StoreApi.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.SwaggerGen; using Newtonsoft.Json; using System.ComponentModel.DataAnnotations; @@ -22,7 +23,7 @@ namespace Org.OpenAPITools.Controllers /// /// /// - public class StoreApiController : Controller + public class StoreApiController : ControllerBase { /// /// Delete purchase order by ID diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs index 463f0d8ecfd..99fc6e4ea24 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Controllers/UserApi.cs @@ -11,6 +11,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Mvc; +using Swashbuckle.AspNetCore.Annotations; using Swashbuckle.AspNetCore.SwaggerGen; using Newtonsoft.Json; using System.ComponentModel.DataAnnotations; @@ -22,7 +23,7 @@ namespace Org.OpenAPITools.Controllers /// /// /// - public class UserApiController : Controller + public class UserApiController : ControllerBase { /// /// Create user diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Org.OpenAPITools.csproj b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Org.OpenAPITools.csproj index 48868bd103b..05d9192229f 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Org.OpenAPITools.csproj +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Org.OpenAPITools.csproj @@ -2,17 +2,16 @@ Org.OpenAPITools Org.OpenAPITools - netcoreapp2.0 + netcoreapp2.1 true true Org.OpenAPITools Org.OpenAPITools - - - - + + + diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Program.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Program.cs index 3da6fd0a6d0..fc39443af25 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Program.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Program.cs @@ -14,18 +14,17 @@ namespace Org.OpenAPITools /// public static void Main(string[] args) { - BuildWebHost(args).Run(); + CreateWebHostBuilder(args).Build().Run(); } /// - /// Build Web Host + /// Create the web host builder. /// /// - /// Webhost - public static IWebHost BuildWebHost(string[] args) => + /// IWebHostBuilder + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => WebHost.CreateDefaultBuilder(args) - .UseStartup() - .UseUrls("http://0.0.0.0:8080/") - .Build(); + .UseStartup() + .UseUrls("http://0.0.0.0:8080/"); } -} +} \ No newline at end of file diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Properties/launchSettings.json b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Properties/launchSettings.json index 21acfed207b..1b527df2c2b 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Properties/launchSettings.json +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Properties/launchSettings.json @@ -1,25 +1,27 @@ -{ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, + "windowsAuthentication": false, + "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:50352/", - "sslPort": 0 + "applicationUrl": "http://localhost:61788", + "sslPort": 44301 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, - "launchUrl": "swagger/", + "launchUrl": "api/values", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, - "web": { + "WebApplication1": { "commandName": "Project", "launchBrowser": true, - "launchUrl": "http://localhost:5000/swagger/", + "launchUrl": "api/values", + "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs index 4f76c4ed6d1..0df10a0b0cb 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/Startup.cs @@ -10,8 +10,10 @@ using System; using System.IO; +using System.Reflection; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json.Converters; @@ -27,20 +29,20 @@ namespace Org.OpenAPITools /// public class Startup { - private readonly IHostingEnvironment _hostingEnv; - private readonly IConfiguration _configuration; - /// /// Constructor /// - /// /// - public Startup(IHostingEnvironment env, IConfiguration configuration) + public Startup(IConfiguration configuration) { - _hostingEnv = env; - _configuration = configuration; + Configuration = configuration; } + /// + /// The application configuration. + /// + public IConfiguration Configuration { get; } + /// /// This method gets called by the runtime. Use this method to add services to the container. /// @@ -50,6 +52,7 @@ namespace Org.OpenAPITools // Add framework services. services .AddMvc() + .SetCompatibilityVersion (CompatibilityVersion.Version_2_1) .AddJsonOptions(opts => { opts.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); @@ -77,7 +80,7 @@ namespace Org.OpenAPITools }); c.CustomSchemaIds(type => type.FriendlyId(true)); c.DescribeAllEnumsAsStrings(); - c.IncludeXmlComments($"{AppContext.BaseDirectory}{Path.DirectorySeparatorChar}{_hostingEnv.ApplicationName}.xml"); + c.IncludeXmlComments($"{AppContext.BaseDirectory}{Path.DirectorySeparatorChar}{Assembly.GetEntryAssembly().GetName().Name}.xml"); // Sets the basePath property in the Swagger document generated c.DocumentFilter("/v2"); @@ -91,8 +94,9 @@ namespace Org.OpenAPITools /// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. /// /// - public void Configure(IApplicationBuilder app) + public void Configure(IApplicationBuilder app, IHostingEnvironment env) { + app.UseHttpsRedirection(); app .UseMvc() .UseDefaultFiles() @@ -110,14 +114,13 @@ namespace Org.OpenAPITools // c.SwaggerEndpoint("/openapi-original.json", "OpenAPI Petstore Original"); }); - if (_hostingEnv.IsDevelopment()) +if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { - //TODO: Enable production exception handling (https://docs.microsoft.com/en-us/aspnet/core/fundamentals/error-handling) - // app.UseExceptionHandler("/Home/Error"); + app.UseHsts(); } } } diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/appsettings.json b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/appsettings.json index c6af7d9b069..def9159a7d9 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/appsettings.json +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/appsettings.json @@ -1,10 +1,8 @@ { "Logging": { - "IncludeScopes": false, "LogLevel": { - "Default": "Information", - "System": "Information", - "Microsoft": "Information" + "Default": "Warning" } - } + }, + "AllowedHosts": "*" } diff --git a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/wwwroot/openapi-original.json b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/wwwroot/openapi-original.json index 34eb757240d..82d674b5575 100644 --- a/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/wwwroot/openapi-original.json +++ b/samples/server/petstore/aspnetcore/src/Org.OpenAPITools/wwwroot/openapi-original.json @@ -104,6 +104,7 @@ "in" : "query", "description" : "Status values that need to be considered for filter", "required" : true, + "style" : "form", "explode" : false, "schema" : { "type" : "array", @@ -157,6 +158,7 @@ "in" : "query", "description" : "Tags to filter by", "required" : true, + "style" : "form", "explode" : false, "schema" : { "type" : "array", diff --git a/samples/server/petstore/cpp-pistache/CMakeLists.txt b/samples/server/petstore/cpp-pistache/CMakeLists.txt index 0a0cf93a9f3..f355231cf2d 100644 --- a/samples/server/petstore/cpp-pistache/CMakeLists.txt +++ b/samples/server/petstore/cpp-pistache/CMakeLists.txt @@ -63,10 +63,13 @@ UserApiMainServer.cpp add_executable(pet_api_server ${PET_API_SERVER_SOURCES}) +add_dependencies(pet_api_server PISTACHE NLOHMANN) add_executable(store_api_server ${STORE_API_SERVER_SOURCES}) +add_dependencies(store_api_server PISTACHE NLOHMANN) add_executable(user_api_server ${USER_API_SERVER_SOURCES}) +add_dependencies(user_api_server PISTACHE NLOHMANN) target_link_libraries(pet_api_server pistache pthread) target_link_libraries(store_api_server pistache pthread) diff --git a/samples/server/petstore/cpp-pistache/api/PetApi.cpp b/samples/server/petstore/cpp-pistache/api/PetApi.cpp index 5aa08b532fc..df764048389 100644 --- a/samples/server/petstore/cpp-pistache/api/PetApi.cpp +++ b/samples/server/petstore/cpp-pistache/api/PetApi.cpp @@ -11,12 +11,14 @@ */ #include "PetApi.h" +#include "Helpers.h" namespace org { namespace openapitools { namespace server { namespace api { +using namespace org::openapitools::server::helpers; using namespace org::openapitools::server::model; PetApi::PetApi(Pistache::Address addr) @@ -94,7 +96,14 @@ void PetApi::delete_pet_handler(const Pistache::Rest::Request &request, Pistache void PetApi::find_pets_by_status_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { // Getting the query params - auto status = request.query().get("status"); + auto statusQuery = request.query().get("status"); + Pistache::Optional> status; + if(!statusQuery.isEmpty()){ + std::vector value; + if(fromStringValue(statusQuery.get(), value)){ + status = Pistache::Some(value); + } + } try { this->find_pets_by_status(status, response); @@ -108,7 +117,14 @@ void PetApi::find_pets_by_status_handler(const Pistache::Rest::Request &request, void PetApi::find_pets_by_tags_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { // Getting the query params - auto tags = request.query().get("tags"); + auto tagsQuery = request.query().get("tags"); + Pistache::Optional> tags; + if(!tagsQuery.isEmpty()){ + std::vector value; + if(fromStringValue(tagsQuery.get(), value)){ + tags = Pistache::Some(value); + } + } try { this->find_pets_by_tags(tags, response); diff --git a/samples/server/petstore/cpp-pistache/api/PetApi.h b/samples/server/petstore/cpp-pistache/api/PetApi.h index 1e688417ee9..db76fa2654e 100644 --- a/samples/server/petstore/cpp-pistache/api/PetApi.h +++ b/samples/server/petstore/cpp-pistache/api/PetApi.h @@ -40,7 +40,7 @@ using namespace org::openapitools::server::model; class PetApi { public: PetApi(Pistache::Address addr); - virtual ~PetApi() {}; + virtual ~PetApi() {} void init(size_t thr); void start(); void shutdown(); @@ -90,7 +90,7 @@ private: /// Multiple status values can be provided with comma separated strings /// /// Status values that need to be considered for filter - virtual void find_pets_by_status(const Pistache::Optional &status, Pistache::Http::ResponseWriter &response) = 0; + virtual void find_pets_by_status(const Pistache::Optional> &status, Pistache::Http::ResponseWriter &response) = 0; /// /// Finds Pets by tags @@ -99,7 +99,7 @@ private: /// Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. /// /// Tags to filter by - virtual void find_pets_by_tags(const Pistache::Optional &tags, Pistache::Http::ResponseWriter &response) = 0; + virtual void find_pets_by_tags(const Pistache::Optional> &tags, Pistache::Http::ResponseWriter &response) = 0; /// /// Find pet by ID diff --git a/samples/server/petstore/cpp-pistache/api/StoreApi.cpp b/samples/server/petstore/cpp-pistache/api/StoreApi.cpp index fb17690e38f..8097ca8f2f1 100644 --- a/samples/server/petstore/cpp-pistache/api/StoreApi.cpp +++ b/samples/server/petstore/cpp-pistache/api/StoreApi.cpp @@ -11,12 +11,14 @@ */ #include "StoreApi.h" +#include "Helpers.h" namespace org { namespace openapitools { namespace server { namespace api { +using namespace org::openapitools::server::helpers; using namespace org::openapitools::server::model; StoreApi::StoreApi(Pistache::Address addr) diff --git a/samples/server/petstore/cpp-pistache/api/StoreApi.h b/samples/server/petstore/cpp-pistache/api/StoreApi.h index e4491a771b4..b5625112db5 100644 --- a/samples/server/petstore/cpp-pistache/api/StoreApi.h +++ b/samples/server/petstore/cpp-pistache/api/StoreApi.h @@ -40,7 +40,7 @@ using namespace org::openapitools::server::model; class StoreApi { public: StoreApi(Pistache::Address addr); - virtual ~StoreApi() {}; + virtual ~StoreApi() {} void init(size_t thr); void start(); void shutdown(); diff --git a/samples/server/petstore/cpp-pistache/api/UserApi.cpp b/samples/server/petstore/cpp-pistache/api/UserApi.cpp index 45720407e08..13b70d9215a 100644 --- a/samples/server/petstore/cpp-pistache/api/UserApi.cpp +++ b/samples/server/petstore/cpp-pistache/api/UserApi.cpp @@ -11,12 +11,14 @@ */ #include "UserApi.h" +#include "Helpers.h" namespace org { namespace openapitools { namespace server { namespace api { +using namespace org::openapitools::server::helpers; using namespace org::openapitools::server::model; UserApi::UserApi(Pistache::Address addr) @@ -136,8 +138,22 @@ void UserApi::get_user_by_name_handler(const Pistache::Rest::Request &request, P void UserApi::login_user_handler(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter response) { // Getting the query params - auto username = request.query().get("username"); - auto password = request.query().get("password"); + auto usernameQuery = request.query().get("username"); + Pistache::Optional username; + if(!usernameQuery.isEmpty()){ + std::string value; + if(fromStringValue(usernameQuery.get(), value)){ + username = Pistache::Some(value); + } + } + auto passwordQuery = request.query().get("password"); + Pistache::Optional password; + if(!passwordQuery.isEmpty()){ + std::string value; + if(fromStringValue(passwordQuery.get(), value)){ + password = Pistache::Some(value); + } + } try { this->login_user(username, password, response); diff --git a/samples/server/petstore/cpp-pistache/api/UserApi.h b/samples/server/petstore/cpp-pistache/api/UserApi.h index 5cb7fb0a35a..aebd1a97ac7 100644 --- a/samples/server/petstore/cpp-pistache/api/UserApi.h +++ b/samples/server/petstore/cpp-pistache/api/UserApi.h @@ -40,7 +40,7 @@ using namespace org::openapitools::server::model; class UserApi { public: UserApi(Pistache::Address addr); - virtual ~UserApi() {}; + virtual ~UserApi() {} void init(size_t thr); void start(); void shutdown(); diff --git a/samples/server/petstore/cpp-pistache/impl/PetApiImpl.cpp b/samples/server/petstore/cpp-pistache/impl/PetApiImpl.cpp index a180ed772c5..111441543c1 100644 --- a/samples/server/petstore/cpp-pistache/impl/PetApiImpl.cpp +++ b/samples/server/petstore/cpp-pistache/impl/PetApiImpl.cpp @@ -29,10 +29,10 @@ void PetApiImpl::add_pet(const Pet &pet, Pistache::Http::ResponseWriter &respons void PetApiImpl::delete_pet(const int64_t &petId, const Pistache::Optional &apiKey, Pistache::Http::ResponseWriter &response) { response.send(Pistache::Http::Code::Ok, "Do some magic\n"); } -void PetApiImpl::find_pets_by_status(const Pistache::Optional &status, Pistache::Http::ResponseWriter &response) { +void PetApiImpl::find_pets_by_status(const Pistache::Optional> &status, Pistache::Http::ResponseWriter &response) { response.send(Pistache::Http::Code::Ok, "Do some magic\n"); } -void PetApiImpl::find_pets_by_tags(const Pistache::Optional &tags, Pistache::Http::ResponseWriter &response) { +void PetApiImpl::find_pets_by_tags(const Pistache::Optional> &tags, Pistache::Http::ResponseWriter &response) { response.send(Pistache::Http::Code::Ok, "Do some magic\n"); } void PetApiImpl::get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response) { diff --git a/samples/server/petstore/cpp-pistache/impl/PetApiImpl.h b/samples/server/petstore/cpp-pistache/impl/PetApiImpl.h index d903d0b6132..63f72a254ae 100644 --- a/samples/server/petstore/cpp-pistache/impl/PetApiImpl.h +++ b/samples/server/petstore/cpp-pistache/impl/PetApiImpl.h @@ -43,12 +43,12 @@ using namespace org::openapitools::server::model; class PetApiImpl : public org::openapitools::server::api::PetApi { public: PetApiImpl(Pistache::Address addr); - ~PetApiImpl() { }; + ~PetApiImpl() {} void add_pet(const Pet &pet, Pistache::Http::ResponseWriter &response); void delete_pet(const int64_t &petId, const Pistache::Optional &apiKey, Pistache::Http::ResponseWriter &response); - void find_pets_by_status(const Pistache::Optional &status, Pistache::Http::ResponseWriter &response); - void find_pets_by_tags(const Pistache::Optional &tags, Pistache::Http::ResponseWriter &response); + void find_pets_by_status(const Pistache::Optional> &status, Pistache::Http::ResponseWriter &response); + void find_pets_by_tags(const Pistache::Optional> &tags, Pistache::Http::ResponseWriter &response); void get_pet_by_id(const int64_t &petId, Pistache::Http::ResponseWriter &response); void update_pet(const Pet &pet, Pistache::Http::ResponseWriter &response); void update_pet_with_form(const Pistache::Rest::Request &request, Pistache::Http::ResponseWriter &response); diff --git a/samples/server/petstore/cpp-pistache/impl/StoreApiImpl.h b/samples/server/petstore/cpp-pistache/impl/StoreApiImpl.h index 8c18fff0027..8109a2c1392 100644 --- a/samples/server/petstore/cpp-pistache/impl/StoreApiImpl.h +++ b/samples/server/petstore/cpp-pistache/impl/StoreApiImpl.h @@ -43,7 +43,7 @@ using namespace org::openapitools::server::model; class StoreApiImpl : public org::openapitools::server::api::StoreApi { public: StoreApiImpl(Pistache::Address addr); - ~StoreApiImpl() { }; + ~StoreApiImpl() {} void delete_order(const std::string &orderId, Pistache::Http::ResponseWriter &response); void get_inventory(Pistache::Http::ResponseWriter &response); diff --git a/samples/server/petstore/cpp-pistache/impl/UserApiImpl.h b/samples/server/petstore/cpp-pistache/impl/UserApiImpl.h index 8da0e1277af..98cb593e694 100644 --- a/samples/server/petstore/cpp-pistache/impl/UserApiImpl.h +++ b/samples/server/petstore/cpp-pistache/impl/UserApiImpl.h @@ -43,7 +43,7 @@ using namespace org::openapitools::server::model; class UserApiImpl : public org::openapitools::server::api::UserApi { public: UserApiImpl(Pistache::Address addr); - ~UserApiImpl() { }; + ~UserApiImpl() {} void create_user(const User &user, Pistache::Http::ResponseWriter &response); void create_users_with_array_input(const std::vector &user, Pistache::Http::ResponseWriter &response); diff --git a/samples/server/petstore/cpp-pistache/model/Helpers.cpp b/samples/server/petstore/cpp-pistache/model/Helpers.cpp new file mode 100644 index 00000000000..8c0e859b642 --- /dev/null +++ b/samples/server/petstore/cpp-pistache/model/Helpers.cpp @@ -0,0 +1,98 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* OpenAPI spec version: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +#include "Helpers.h" + +namespace org { +namespace openapitools { +namespace server { +namespace helpers { + + +std::string toStringValue(const std::string &value){ + return std::string(value); +} + +std::string toStringValue(const int32_t &value){ + return std::to_string(value); +} + +std::string toStringValue(const int64_t &value){ + return std::to_string(value); +} + +std::string toStringValue(const bool &value){ + return value?std::string("true"):std::string("false"); +} + +std::string toStringValue(const float &value){ + return std::to_string(value); +} + +std::string toStringValue(const double &value){ + return std::to_string(value); +} + +bool fromStringValue(const std::string &inStr, std::string &value){ + value = std::string(inStr); + return true; +} + +bool fromStringValue(const std::string &inStr, int32_t &value){ + try { + value = std::stoi( inStr ); + } + catch (const std::invalid_argument) { + return false; + } + return true; +} + +bool fromStringValue(const std::string &inStr, int64_t &value){ + try { + value = std::stol( inStr ); + } + catch (const std::invalid_argument) { + return false; + } + return true; +} + +bool fromStringValue(const std::string &inStr, bool &value){ + bool result = true; + inStr == "true"?value = true: inStr == "false"?value = false: result = false; + return result; +} + +bool fromStringValue(const std::string &inStr, float &value){ + try { + value = std::stof( inStr ); + } + catch (const std::invalid_argument) { + return false; + } + return true; +} + +bool fromStringValue(const std::string &inStr, double &value){ + try { + value = std::stod( inStr ); + } + catch (const std::invalid_argument) { + return false; + } + return true; +} + +} +} +} +} diff --git a/samples/server/petstore/cpp-pistache/model/Helpers.h b/samples/server/petstore/cpp-pistache/model/Helpers.h new file mode 100644 index 00000000000..8c62ecda5a0 --- /dev/null +++ b/samples/server/petstore/cpp-pistache/model/Helpers.h @@ -0,0 +1,76 @@ +/** +* OpenAPI Petstore +* This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. +* +* OpenAPI spec version: 1.0.0 +* +* +* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). +* https://openapi-generator.tech +* Do not edit the class manually. +*/ +/* + * Helpers.h + * + * This is the helper class for models and primitives + */ + +#ifndef Helpers_H_ +#define Helpers_H_ + +#include +#include +#include +#include +#include + +namespace org { +namespace openapitools { +namespace server { +namespace helpers { + + std::string toStringValue(const std::string &value); + std::string toStringValue(const int32_t &value); + std::string toStringValue(const int64_t &value); + std::string toStringValue(const bool &value); + std::string toStringValue(const float &value); + std::string toStringValue(const double &value); + + bool fromStringValue(const std::string &inStr, std::string &value); + bool fromStringValue(const std::string &inStr, int32_t &value); + bool fromStringValue(const std::string &inStr, int64_t &value); + bool fromStringValue(const std::string &inStr, bool &value); + bool fromStringValue(const std::string &inStr, float &value); + bool fromStringValue(const std::string &inStr, double &value); + template + bool fromStringValue(const std::vector &inStr, std::vector &value){ + try{ + for(auto & item : inStr){ + T itemValue; + if(fromStringValue(item, itemValue)){ + value.push_back(itemValue); + } + } + } + catch(...){ + return false; + } + return value.size() > 0; + } + template + bool fromStringValue(const std::string &inStr, std::vector &value, char separator = ','){ + std::vector inStrings; + std::istringstream f(inStr); + std::string s; + while (std::getline(f, s, separator)) { + inStrings.push_back(s); + } + return fromStringValue(inStrings, value); + } + +} +} +} +} + +#endif // Helpers_H_ \ No newline at end of file diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/CMakeLists.txt b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/CMakeLists.txt index 527b76ca9b4..54e6d36d73f 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/CMakeLists.txt +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/CMakeLists.txt @@ -7,7 +7,8 @@ set(EXTERNAL_INSTALL_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/external) ExternalProject_Add(QHTTPENGINE GIT_REPOSITORY https://github.com/etherealjoy/qhttpengine.git - CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} + -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH} ) include_directories(${EXTERNAL_INSTALL_LOCATION}/include) diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/Dockerfile b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/Dockerfile index b3395482976..b0c591d10f6 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/Dockerfile +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/Dockerfile @@ -1,11 +1,11 @@ FROM alpine:latest AS build -RUN apk add --update \ +RUN apk add --update \ cmake \ alpine-sdk \ - openssl \ - qt5-qtbase-dev \ - qt5-qttools-dev + openssl \ + qt5-qtbase-dev \ + qt5-qttools-dev WORKDIR /usr/server ADD ./src ./src @@ -13,17 +13,17 @@ ADD ./CMakeLists.txt ./ RUN mkdir -p ./build WORKDIR /usr/server/build RUN cmake -DNODEBUG:STRING="ON" .. -RUN make +RUN make FROM alpine:latest AS runtime -RUN apk add --update \ +RUN apk add --update \ libgcc \ libstdc++ \ qt5-qtbase \ openssl WORKDIR /usr/server -COPY --from=build /usr/server/build/src/cpp-qt5-server ./build/src/ +COPY --from=build /usr/server/build/src/cpp-qt5-qhttpengine-server ./build/src/ COPY --from=build /usr/server/external/ ./external EXPOSE 8080/tcp -ENTRYPOINT ["/usr/server/build/src/cpp-qt5-server"] \ No newline at end of file +ENTRYPOINT ["/usr/server/build/src/cpp-qt5-qhttpengine-server"] \ No newline at end of file diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/LICENSE.txt b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/LICENSE.txt index 04938f840c9..be59130f858 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/LICENSE.txt +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/LICENSE.txt @@ -1,4 +1,4 @@ -QHttpEngine +QHttpEngine The MIT License (MIT) diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/README.MD b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/README.MD index d354460c635..5be785bda41 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/README.MD +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/README.MD @@ -1,8 +1,9 @@ +# C++ Qt5 Server + ## Qt5 HTTP Server based on the Qhttpengine -This server was generated by the [openapi-generator] -(https://openapi-generator.tech) project. -By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. -- + +This server was generated by the [openapi-generator](https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. To see how to make this your own, look here: @@ -21,30 +22,36 @@ Simple set of classes for developing HTTP server applications in Qt. To learn more about building and using the library, please visit this page: -https://ci.quickmediasolutions.com/job/qhttpengine-documentation/doxygen/ - +[Link](https://ci.quickmediasolutions.com/job/qhttpengine-documentation/doxygen) ### Viewing the code -You can view the code using an editor like Microsoft Visual Studio Code or you can + +You can view the code using an editor like Microsoft Visual Studio Code or you can Use QtCreator and browse for the root CMakeLists.txt and load it as a project ### Build with make + Install the tools [Linux/Debian] -``` + +```shell sudo apt install cmake build-essential libssl-dev qtbase5-dev qtbase5-dev-tools git curl ``` To build, go to the `server` folder -``` -make + +```shell +make ``` To run the server -``` + +```shell ./build/src/cpp-qt5-server & ``` + #### Invoke an API -``` + +```shell curl -X GET http://localhost:8080/v2/store/inventory curl -X POST http://localhost:8080/v2/store/order -H "Content-Type: application/json" -d "{ \"id\": 22, \"petId\": 1541, \"quantity\": 5, \"shipDate\": \"2018-06-16T18:31:43.870Z\", \"status\": \"placed\", \"complete\": \"true\" }" curl -X GET http://localhost:8080/v2/pet/findByStatus @@ -52,38 +59,50 @@ curl -X GET http://localhost:8080/v2/store/inventory ``` ### Run and build with docker + Building with docker multistage If you dont have docker install [here](https://docs.docker.com/install) Add yourself to the docker group -``` +```shell docker build --network=host -t cpp-qt5-server . ``` -Running with docker -``` -docker run --rm -it --name=server-container cpp-qt5-server + +Running with docker + +```shell +docker run --rm -it --name=server-container cpp-qt5-server ``` #### Invoking an API + Mind the IP here -``` + +```shell curl -X GET http://172.17.0.2:8080/v2/store/inventory curl -X POST http://172.17.0.2:8080/v2/store/order -H "Content-Type: application/json" -d "{ \"id\": 22, \"petId\": 1541, \"quantity\": 5, \"shipDate\": \"2018-06-16T18:31:43.870Z\", \"status\": \"placed\", \"complete\": \"true\" }" ``` use this command to get the container IP -``` + +```shell docker inspect server-container | grep "IPAddress" ``` -To exit from the command line -``` + +To exit from the command line + +```shell Ctrl + p + q ``` + To stop container -``` + +```shell docker stop ``` + or to terminate and quit -``` + +```shell Ctrl+C ``` diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/CMakeLists.txt b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/CMakeLists.txt index 9faf5db60e4..0311ec2020f 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/CMakeLists.txt +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/CMakeLists.txt @@ -12,7 +12,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -std=c++14 -Wall -Wno-unused-varia if(${NODEBUG} STREQUAL "OFF") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pg -g3") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg -g3") -else (${NODEBUG} STREQUAL "OFF") +else (${NODEBUG} STREQUAL "OFF") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -s -O3") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s -O3") endif(${NODEBUG} STREQUAL "OFF") diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/handlers/OAIApiRouter.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/handlers/OAIApiRouter.cpp index e45ee728700..c662c60a0e1 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/handlers/OAIApiRouter.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/handlers/OAIApiRouter.cpp @@ -14,7 +14,7 @@ #include #include #include -#include + #include "OAIApiRouter.h" #include "OAIPetApiRequest.h" @@ -24,270 +24,205 @@ namespace OpenAPI { -inline QHttpEngine::Socket::Method toQHttpEngineMethod(QString method){ - - if( method == QString("OPTIONS")) - return QHttpEngine::Socket::Method::OPTIONS; - if( method == QString("GET")) - return QHttpEngine::Socket::Method::GET; - if( method == QString("HEAD")) - return QHttpEngine::Socket::Method::HEAD; - if( method == QString("POST")) - return QHttpEngine::Socket::Method::POST; - if( method == QString("PUT")) - return QHttpEngine::Socket::Method::PUT; - if( method == QString("DELETE")) - return QHttpEngine::Socket::Method::DELETE; - if( method == QString("TRACE")) - return QHttpEngine::Socket::Method::TRACE; - if( method == QString("CONNECT")) - return QHttpEngine::Socket::Method::CONNECT; - - return static_cast(-1); +OAIApiRouter::OAIApiRouter() { + createApiHandlers(); } -ApiRouter::ApiRouter() { - OAIPetApiApiHandler = new OAIPetApiHandler(); - OAIStoreApiApiHandler = new OAIStoreApiHandler(); - OAIUserApiApiHandler = new OAIUserApiHandler(); - -} - -ApiRouter::~ApiRouter(){ - qDebug() << "~ApiRouter()"; +OAIApiRouter::~OAIApiRouter(){ + delete OAIPetApiApiHandler; delete OAIStoreApiApiHandler; delete OAIUserApiApiHandler; - } -void ApiRouter::setUpRoutes() { +void OAIApiRouter::createApiHandlers() { + OAIPetApiApiHandler = new OAIPetApiHandler(); + OAIStoreApiApiHandler = new OAIStoreApiHandler(); + OAIUserApiApiHandler = new OAIUserApiHandler(); +} + +void OAIApiRouter::setUpRoutes() { - Routes.insert("/v2/pet",[this](QHttpEngine::Socket *socket) { - if(toQHttpEngineMethod("POST") == socket->method()){ + Routes.insert(QString("%1 %2").arg("POST").arg("/v2/pet").toLower(), [this](QHttpEngine::Socket *socket) { auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); reqObj->addPetRequest(); - } }); - Routes.insert("/v2/pet/findByStatus",[this](QHttpEngine::Socket *socket) { - if(toQHttpEngineMethod("GET") == socket->method()){ + Routes.insert(QString("%1 %2").arg("GET").arg("/v2/pet/findByStatus").toLower(), [this](QHttpEngine::Socket *socket) { auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); reqObj->findPetsByStatusRequest(); - } }); - Routes.insert("/v2/pet/findByTags",[this](QHttpEngine::Socket *socket) { - if(toQHttpEngineMethod("GET") == socket->method()){ + Routes.insert(QString("%1 %2").arg("GET").arg("/v2/pet/findByTags").toLower(), [this](QHttpEngine::Socket *socket) { auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); reqObj->findPetsByTagsRequest(); - } }); - Routes.insert("/v2/pet",[this](QHttpEngine::Socket *socket) { - if(toQHttpEngineMethod("PUT") == socket->method()){ + Routes.insert(QString("%1 %2").arg("PUT").arg("/v2/pet").toLower(), [this](QHttpEngine::Socket *socket) { auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); reqObj->updatePetRequest(); - } }); - Routes.insert("/v2/store/inventory",[this](QHttpEngine::Socket *socket) { - if(toQHttpEngineMethod("GET") == socket->method()){ + Routes.insert(QString("%1 %2").arg("GET").arg("/v2/store/inventory").toLower(), [this](QHttpEngine::Socket *socket) { auto reqObj = new OAIStoreApiRequest(socket, OAIStoreApiApiHandler); reqObj->getInventoryRequest(); - } }); - Routes.insert("/v2/store/order",[this](QHttpEngine::Socket *socket) { - if(toQHttpEngineMethod("POST") == socket->method()){ + Routes.insert(QString("%1 %2").arg("POST").arg("/v2/store/order").toLower(), [this](QHttpEngine::Socket *socket) { auto reqObj = new OAIStoreApiRequest(socket, OAIStoreApiApiHandler); reqObj->placeOrderRequest(); - } }); - Routes.insert("/v2/user",[this](QHttpEngine::Socket *socket) { - if(toQHttpEngineMethod("POST") == socket->method()){ + Routes.insert(QString("%1 %2").arg("POST").arg("/v2/user").toLower(), [this](QHttpEngine::Socket *socket) { auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); reqObj->createUserRequest(); - } }); - Routes.insert("/v2/user/createWithArray",[this](QHttpEngine::Socket *socket) { - if(toQHttpEngineMethod("POST") == socket->method()){ + Routes.insert(QString("%1 %2").arg("POST").arg("/v2/user/createWithArray").toLower(), [this](QHttpEngine::Socket *socket) { auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); reqObj->createUsersWithArrayInputRequest(); - } }); - Routes.insert("/v2/user/createWithList",[this](QHttpEngine::Socket *socket) { - if(toQHttpEngineMethod("POST") == socket->method()){ + Routes.insert(QString("%1 %2").arg("POST").arg("/v2/user/createWithList").toLower(), [this](QHttpEngine::Socket *socket) { auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); reqObj->createUsersWithListInputRequest(); - } }); - Routes.insert("/v2/user/login",[this](QHttpEngine::Socket *socket) { - if(toQHttpEngineMethod("GET") == socket->method()){ + Routes.insert(QString("%1 %2").arg("GET").arg("/v2/user/login").toLower(), [this](QHttpEngine::Socket *socket) { auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); reqObj->loginUserRequest(); - } }); - Routes.insert("/v2/user/logout",[this](QHttpEngine::Socket *socket) { - if(toQHttpEngineMethod("GET") == socket->method()){ + Routes.insert(QString("%1 %2").arg("GET").arg("/v2/user/logout").toLower(), [this](QHttpEngine::Socket *socket) { auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); reqObj->logoutUserRequest(); - } - }); + }); } -void ApiRouter::processRequest(QHttpEngine::Socket *socket){ - if (Routes.contains(socket->path())) { - for(auto endpoints : Routes.values(socket->path())) { - endpoints.operator()(socket); - } - } else - { - { - QString completePath("/v2/pet/{petId}"); - QString pet_idPathParam("{"); - pet_idPathParam.append("petId").append("}"); - completePath.replace("/", "\\/"); // replace '/' with '\/' for regex - completePath.replace(pet_idPathParam, "([^\\/]*?)"); // match anything but '/'' - completePath.append("$"); // End of string - QRegularExpression re(completePath, QRegularExpression::CaseInsensitiveOption); - QRegularExpressionMatch match = re.match(socket->path()); - if ((toQHttpEngineMethod("DELETE") == socket->method()) && match.hasMatch() ) { - QString pathparam = match.captured(1); - auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); - reqObj->deletePetRequest(pathparam);; - return; - } - } - { - QString completePath("/v2/pet/{petId}"); - QString pet_idPathParam("{"); - pet_idPathParam.append("petId").append("}"); - completePath.replace("/", "\\/"); // replace '/' with '\/' for regex - completePath.replace(pet_idPathParam, "([^\\/]*?)"); // match anything but '/'' - completePath.append("$"); // End of string - QRegularExpression re(completePath, QRegularExpression::CaseInsensitiveOption); - QRegularExpressionMatch match = re.match(socket->path()); - if ((toQHttpEngineMethod("GET") == socket->method()) && match.hasMatch() ) { - QString pathparam = match.captured(1); - auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); - reqObj->getPetByIdRequest(pathparam);; - return; - } - } - { - QString completePath("/v2/pet/{petId}"); - QString pet_idPathParam("{"); - pet_idPathParam.append("petId").append("}"); - completePath.replace("/", "\\/"); // replace '/' with '\/' for regex - completePath.replace(pet_idPathParam, "([^\\/]*?)"); // match anything but '/'' - completePath.append("$"); // End of string - QRegularExpression re(completePath, QRegularExpression::CaseInsensitiveOption); - QRegularExpressionMatch match = re.match(socket->path()); - if ((toQHttpEngineMethod("POST") == socket->method()) && match.hasMatch() ) { - QString pathparam = match.captured(1); - auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); - reqObj->updatePetWithFormRequest(pathparam);; - return; - } - } - { - QString completePath("/v2/pet/{petId}/uploadImage"); - QString pet_idPathParam("{"); - pet_idPathParam.append("petId").append("}"); - completePath.replace("/", "\\/"); // replace '/' with '\/' for regex - completePath.replace(pet_idPathParam, "([^\\/]*?)"); // match anything but '/'' - completePath.append("$"); // End of string - QRegularExpression re(completePath, QRegularExpression::CaseInsensitiveOption); - QRegularExpressionMatch match = re.match(socket->path()); - if ((toQHttpEngineMethod("POST") == socket->method()) && match.hasMatch() ) { - QString pathparam = match.captured(1); - auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); - reqObj->uploadFileRequest(pathparam);; - return; - } - } - { - QString completePath("/v2/store/order/{orderId}"); - QString order_idPathParam("{"); - order_idPathParam.append("orderId").append("}"); - completePath.replace("/", "\\/"); // replace '/' with '\/' for regex - completePath.replace(order_idPathParam, "([^\\/]*?)"); // match anything but '/'' - completePath.append("$"); // End of string - QRegularExpression re(completePath, QRegularExpression::CaseInsensitiveOption); - QRegularExpressionMatch match = re.match(socket->path()); - if ((toQHttpEngineMethod("DELETE") == socket->method()) && match.hasMatch() ) { - QString pathparam = match.captured(1); - auto reqObj = new OAIStoreApiRequest(socket, OAIStoreApiApiHandler); - reqObj->deleteOrderRequest(pathparam);; - return; - } - } - { - QString completePath("/v2/store/order/{orderId}"); - QString order_idPathParam("{"); - order_idPathParam.append("orderId").append("}"); - completePath.replace("/", "\\/"); // replace '/' with '\/' for regex - completePath.replace(order_idPathParam, "([^\\/]*?)"); // match anything but '/'' - completePath.append("$"); // End of string - QRegularExpression re(completePath, QRegularExpression::CaseInsensitiveOption); - QRegularExpressionMatch match = re.match(socket->path()); - if ((toQHttpEngineMethod("GET") == socket->method()) && match.hasMatch() ) { - QString pathparam = match.captured(1); - auto reqObj = new OAIStoreApiRequest(socket, OAIStoreApiApiHandler); - reqObj->getOrderByIdRequest(pathparam);; - return; - } - } - { - QString completePath("/v2/user/{username}"); - QString usernamePathParam("{"); - usernamePathParam.append("username").append("}"); - completePath.replace("/", "\\/"); // replace '/' with '\/' for regex - completePath.replace(usernamePathParam, "([^\\/]*?)"); // match anything but '/'' - completePath.append("$"); // End of string - QRegularExpression re(completePath, QRegularExpression::CaseInsensitiveOption); - QRegularExpressionMatch match = re.match(socket->path()); - if ((toQHttpEngineMethod("DELETE") == socket->method()) && match.hasMatch() ) { - QString pathparam = match.captured(1); - auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); - reqObj->deleteUserRequest(pathparam);; - return; - } - } - { - QString completePath("/v2/user/{username}"); - QString usernamePathParam("{"); - usernamePathParam.append("username").append("}"); - completePath.replace("/", "\\/"); // replace '/' with '\/' for regex - completePath.replace(usernamePathParam, "([^\\/]*?)"); // match anything but '/'' - completePath.append("$"); // End of string - QRegularExpression re(completePath, QRegularExpression::CaseInsensitiveOption); - QRegularExpressionMatch match = re.match(socket->path()); - if ((toQHttpEngineMethod("GET") == socket->method()) && match.hasMatch() ) { - QString pathparam = match.captured(1); - auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); - reqObj->getUserByNameRequest(pathparam);; - return; - } - } - { - QString completePath("/v2/user/{username}"); - QString usernamePathParam("{"); - usernamePathParam.append("username").append("}"); - completePath.replace("/", "\\/"); // replace '/' with '\/' for regex - completePath.replace(usernamePathParam, "([^\\/]*?)"); // match anything but '/'' - completePath.append("$"); // End of string - QRegularExpression re(completePath, QRegularExpression::CaseInsensitiveOption); - QRegularExpressionMatch match = re.match(socket->path()); - if ((toQHttpEngineMethod("PUT") == socket->method()) && match.hasMatch() ) { - QString pathparam = match.captured(1); - auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); - reqObj->updateUserRequest(pathparam);; - return; - } - } +void OAIApiRouter::processRequest(QHttpEngine::Socket *socket){ + if( handleRequest(socket) ){ + return; + } + if( handleRequestAndExtractPathParam(socket) ){ + return; } socket->setStatusCode(QHttpEngine::Socket::NotFound); if(socket->isOpen()){ socket->writeHeaders(); socket->close(); } - return; } + +bool OAIApiRouter::handleRequest(QHttpEngine::Socket *socket){ + auto reqPath = QString("%1 %2").arg(fromQHttpEngineMethod(socket->method())).arg(socket->path()).toLower(); + if ( Routes.contains(reqPath) ) { + Routes.value(reqPath).operator()(socket); + return true; + } + return false; +} + +bool OAIApiRouter::handleRequestAndExtractPathParam(QHttpEngine::Socket *socket){ + auto reqPath = QString("%1 %2").arg(fromQHttpEngineMethod(socket->method())).arg(socket->path()).toLower(); + { + auto completePath = QString("%1 %2").arg("DELETE").arg("/v2/pet/{petId}").toLower(); + if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); + if ( match.hasMatch() ){ + QString petId = match.captured(QString("petId").toLower()); + auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); + reqObj->deletePetRequest(petId); + return true; + } + } + } + { + auto completePath = QString("%1 %2").arg("GET").arg("/v2/pet/{petId}").toLower(); + if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); + if ( match.hasMatch() ){ + QString petId = match.captured(QString("petId").toLower()); + auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); + reqObj->getPetByIdRequest(petId); + return true; + } + } + } + { + auto completePath = QString("%1 %2").arg("POST").arg("/v2/pet/{petId}").toLower(); + if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); + if ( match.hasMatch() ){ + QString petId = match.captured(QString("petId").toLower()); + auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); + reqObj->updatePetWithFormRequest(petId); + return true; + } + } + } + { + auto completePath = QString("%1 %2").arg("POST").arg("/v2/pet/{petId}/uploadImage").toLower(); + if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); + if ( match.hasMatch() ){ + QString petId = match.captured(QString("petId").toLower()); + auto reqObj = new OAIPetApiRequest(socket, OAIPetApiApiHandler); + reqObj->uploadFileRequest(petId); + return true; + } + } + } + { + auto completePath = QString("%1 %2").arg("DELETE").arg("/v2/store/order/{orderId}").toLower(); + if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); + if ( match.hasMatch() ){ + QString orderId = match.captured(QString("orderId").toLower()); + auto reqObj = new OAIStoreApiRequest(socket, OAIStoreApiApiHandler); + reqObj->deleteOrderRequest(orderId); + return true; + } + } + } + { + auto completePath = QString("%1 %2").arg("GET").arg("/v2/store/order/{orderId}").toLower(); + if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); + if ( match.hasMatch() ){ + QString orderId = match.captured(QString("orderId").toLower()); + auto reqObj = new OAIStoreApiRequest(socket, OAIStoreApiApiHandler); + reqObj->getOrderByIdRequest(orderId); + return true; + } + } + } + { + auto completePath = QString("%1 %2").arg("DELETE").arg("/v2/user/{username}").toLower(); + if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); + if ( match.hasMatch() ){ + QString username = match.captured(QString("username").toLower()); + auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); + reqObj->deleteUserRequest(username); + return true; + } + } + } + { + auto completePath = QString("%1 %2").arg("GET").arg("/v2/user/{username}").toLower(); + if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); + if ( match.hasMatch() ){ + QString username = match.captured(QString("username").toLower()); + auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); + reqObj->getUserByNameRequest(username); + return true; + } + } + } + { + auto completePath = QString("%1 %2").arg("PUT").arg("/v2/user/{username}").toLower(); + if ( reqPath.startsWith(completePath.leftRef( completePath.indexOf(QString("/{")))) ) { + QRegularExpressionMatch match = getRequestMatch( completePath, reqPath ); + if ( match.hasMatch() ){ + QString username = match.captured(QString("username").toLower()); + auto reqObj = new OAIUserApiRequest(socket, OAIUserApiApiHandler); + reqObj->updateUserRequest(username); + return true; + } + } + } + return false; +} + } diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/handlers/OAIApiRouter.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/handlers/OAIApiRouter.h index 5f3532b2762..573b5052ce6 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/handlers/OAIApiRouter.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/handlers/OAIApiRouter.h @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -30,7 +31,7 @@ namespace OpenAPI { -class RequestHandler : public QHttpEngine::QObjectHandler +class OAIApiRequestHandler : public QHttpEngine::QObjectHandler { Q_OBJECT signals: @@ -43,21 +44,61 @@ protected: } }; -class ApiRouter : public QObject +class OAIApiRouter : public QObject { Q_OBJECT public: - ApiRouter(); - virtual ~ApiRouter(); + OAIApiRouter(); + virtual ~OAIApiRouter(); void setUpRoutes(); void processRequest(QHttpEngine::Socket *socket); private: - QMultiMap> Routes; + QMap> Routes; + QMultiMap> RoutesWithPathParam; + + bool handleRequest(QHttpEngine::Socket *socket); + bool handleRequestAndExtractPathParam(QHttpEngine::Socket *socket); + OAIPetApiHandler *OAIPetApiApiHandler; OAIStoreApiHandler *OAIStoreApiApiHandler; - OAIUserApiHandler *OAIUserApiApiHandler; + OAIUserApiHandler *OAIUserApiApiHandler; +protected: + // override this method to provide custom class derived from ApiHandler classes + virtual void createApiHandlers(); + +private : + inline QString fromQHttpEngineMethod(QHttpEngine::Socket::Method method){ + switch( method ){ + case QHttpEngine::Socket::Method::OPTIONS: + return QStringLiteral("OPTIONS"); + case QHttpEngine::Socket::Method::GET: + return QStringLiteral("GET"); + case QHttpEngine::Socket::Method::HEAD: + return QStringLiteral("HEAD"); + case QHttpEngine::Socket::Method::POST: + return QStringLiteral("POST"); + case QHttpEngine::Socket::Method::PUT: + return QStringLiteral("PUT"); + case QHttpEngine::Socket::Method::DELETE: + return QStringLiteral("DELETE"); + case QHttpEngine::Socket::Method::TRACE: + return QStringLiteral("TRACE"); + case QHttpEngine::Socket::Method::CONNECT: + return QStringLiteral("CONNECT"); + } + return QStringLiteral(""); + } + + inline QRegularExpressionMatch getRequestMatch(QString serverTemplatePath, QString requestPath){ + QRegularExpression parExpr( R"(\{([^\/\\s]+)\})" ); + serverTemplatePath.replace( parExpr, R"((?<\1>[^\/\s]+))" ); + serverTemplatePath.append("[\\/]?$"); + QRegularExpression pathExpr( serverTemplatePath ); + return pathExpr.match( requestPath ); + } + }; diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/main.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/main.cpp index db0590c4ed8..a2f6aea81d7 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/main.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/main.cpp @@ -19,43 +19,43 @@ #include #include #include -#ifdef __linux__ +#ifdef __linux__ #include #include -#endif +#endif #include #include "OAIApiRouter.h" -#ifdef __linux__ +#ifdef __linux__ void catchUnixSignals(QList quitSignals) { auto handler = [](int sig) -> void { // blocking and not aysnc-signal-safe func are valid qDebug() << "\nquit the application by signal " << sig; QCoreApplication::quit(); }; - - sigset_t blocking_mask; - sigemptyset(&blocking_mask); - for (auto sig : quitSignals) - sigaddset(&blocking_mask, sig); - - struct sigaction sa; - sa.sa_handler = handler; - sa.sa_mask = blocking_mask; - sa.sa_flags = 0; - - for (auto sig : quitSignals) + + sigset_t blocking_mask; + sigemptyset(&blocking_mask); + for (auto sig : quitSignals) + sigaddset(&blocking_mask, sig); + + struct sigaction sa; + sa.sa_handler = handler; + sa.sa_mask = blocking_mask; + sa.sa_flags = 0; + + for (auto sig : quitSignals) sigaction(sig, &sa, nullptr); } -#endif +#endif int main(int argc, char * argv[]) { QCoreApplication a(argc, argv); -#ifdef __linux__ +#ifdef __linux__ QList sigs({SIGQUIT, SIGINT, SIGTERM, SIGHUP}); catchUnixSignals(sigs); -#endif +#endif // Build the command-line options QCommandLineParser parser; QCommandLineOption addressOption( @@ -80,11 +80,11 @@ int main(int argc, char * argv[]) // Obtain the values QHostAddress address = QHostAddress(parser.value(addressOption)); quint16 port = static_cast(parser.value(portOption).toInt()); - - QSharedPointer handler(new OpenAPI::RequestHandler()); - OpenAPI::ApiRouter router; + + QSharedPointer handler(new OpenAPI::OAIApiRequestHandler()); + OpenAPI::OAIApiRouter router; router.setUpRoutes(); - QObject::connect(handler.data(), &OpenAPI::RequestHandler::requestReceived, [&](QHttpEngine::Socket *socket) { + QObject::connect(handler.data(), &OpenAPI::OAIApiRequestHandler::requestReceived, [&](QHttpEngine::Socket *socket) { router.processRequest(socket); }); @@ -95,6 +95,6 @@ int main(int argc, char * argv[]) qCritical("Unable to listen on the specified port."); return 1; } - + return a.exec(); } diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.cpp index 7bba2a9468d..0e576128205 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIApiResponse.cpp @@ -31,7 +31,7 @@ OAIApiResponse::OAIApiResponse() { } OAIApiResponse::~OAIApiResponse() { - + } void diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.cpp index c70d263a5a0..fb8ec997ce3 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAICategory.cpp @@ -31,7 +31,7 @@ OAICategory::OAICategory() { } OAICategory::~OAICategory() { - + } void diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIHelpers.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIHelpers.h index 0172e953778..d904bcc7920 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIHelpers.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIHelpers.h @@ -134,7 +134,7 @@ namespace OpenAPI { for(auto itemkey : varmap.keys() ){ T itemVal; fromJsonValue(itemVal, QJsonValue::fromVariant(varmap.value(itemkey))); - val.insert(itemkey, val); + val.insert(itemkey, itemVal); } } return; diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIObject.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIObject.h index 74db802a37e..fe37f898f7d 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIObject.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIObject.h @@ -21,9 +21,9 @@ namespace OpenAPI { class OAIObject { public: virtual ~OAIObject(){ - + } - + virtual QJsonObject asJsonObject() const { return jObj; } diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.cpp index 7afaa063a29..567533b830b 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIOrder.cpp @@ -31,7 +31,7 @@ OAIOrder::OAIOrder() { } OAIOrder::~OAIOrder() { - + } void diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.cpp index 97cb3399151..83e4b23f8e7 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIPet.cpp @@ -31,7 +31,7 @@ OAIPet::OAIPet() { } OAIPet::~OAIPet() { - + } void diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.cpp index e8f1a69972b..d450cc833f6 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAITag.cpp @@ -31,7 +31,7 @@ OAITag::OAITag() { } OAITag::~OAITag() { - + } void diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.cpp index 375c8b3220c..9f345cf874a 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/models/OAIUser.cpp @@ -31,7 +31,7 @@ OAIUser::OAIUser() { } OAIUser::~OAIUser() { - + } void diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIPetApiRequest.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIPetApiRequest.cpp index 1a5953e78b1..40ccab593c7 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIPetApiRequest.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIPetApiRequest.cpp @@ -25,7 +25,7 @@ OAIPetApiRequest::OAIPetApiRequest(QHttpEngine::Socket *s, OAIPetApiHandler* hdl auto headers = s->headers(); for(auto itr = headers.begin(); itr != headers.end(); itr++) { requestHeaders.insert(QString(itr.key()), QString(itr.value())); - } + } } OAIPetApiRequest::~OAIPetApiRequest(){ @@ -33,7 +33,7 @@ OAIPetApiRequest::~OAIPetApiRequest(){ qDebug() << "OAIPetApiRequest::~OAIPetApiRequest()"; } -QMap +QMap OAIPetApiRequest::getRequestHeaders() const { return requestHeaders; } @@ -53,7 +53,7 @@ QHttpEngine::Socket* OAIPetApiRequest::getRawSocket(){ void OAIPetApiRequest::addPetRequest(){ qDebug() << "/v2/pet"; connect(this, &OAIPetApiRequest::addPet, handler, &OAIPetApiHandler::addPet); - + QJsonDocument doc; @@ -63,14 +63,14 @@ void OAIPetApiRequest::addPetRequest(){ ::OpenAPI::fromJsonValue(oai_pet, obj); - emit addPet( oai_pet); + emit addPet(oai_pet); } void OAIPetApiRequest::deletePetRequest(const QString& pet_idstr){ qDebug() << "/v2/pet/{petId}"; connect(this, &OAIPetApiRequest::deletePet, handler, &OAIPetApiHandler::deletePet); - + qint64 pet_id; fromStringValue(pet_idstr, pet_id); @@ -81,59 +81,59 @@ void OAIPetApiRequest::deletePetRequest(const QString& pet_idstr){ } - emit deletePet( pet_id, api_key); + emit deletePet(pet_id, api_key); } void OAIPetApiRequest::findPetsByStatusRequest(){ qDebug() << "/v2/pet/findByStatus"; connect(this, &OAIPetApiRequest::findPetsByStatus, handler, &OAIPetApiHandler::findPetsByStatus); + - - QList status; + QList status; if(socket->queryString().keys().contains("status")){ fromStringValue(socket->queryString().values("status"), status); } - emit findPetsByStatus( status); + emit findPetsByStatus(status); } void OAIPetApiRequest::findPetsByTagsRequest(){ qDebug() << "/v2/pet/findByTags"; connect(this, &OAIPetApiRequest::findPetsByTags, handler, &OAIPetApiHandler::findPetsByTags); + - - QList tags; + QList tags; if(socket->queryString().keys().contains("tags")){ fromStringValue(socket->queryString().values("tags"), tags); } - emit findPetsByTags( tags); + emit findPetsByTags(tags); } void OAIPetApiRequest::getPetByIdRequest(const QString& pet_idstr){ qDebug() << "/v2/pet/{petId}"; connect(this, &OAIPetApiRequest::getPetById, handler, &OAIPetApiHandler::getPetById); - + qint64 pet_id; fromStringValue(pet_idstr, pet_id); - emit getPetById( pet_id); + emit getPetById(pet_id); } void OAIPetApiRequest::updatePetRequest(){ qDebug() << "/v2/pet"; connect(this, &OAIPetApiRequest::updatePet, handler, &OAIPetApiHandler::updatePet); - + QJsonDocument doc; @@ -143,14 +143,14 @@ void OAIPetApiRequest::updatePetRequest(){ ::OpenAPI::fromJsonValue(oai_pet, obj); - emit updatePet( oai_pet); + emit updatePet(oai_pet); } void OAIPetApiRequest::updatePetWithFormRequest(const QString& pet_idstr){ qDebug() << "/v2/pet/{petId}"; connect(this, &OAIPetApiRequest::updatePetWithForm, handler, &OAIPetApiHandler::updatePetWithForm); - + qint64 pet_id; fromStringValue(pet_idstr, pet_id); @@ -158,14 +158,14 @@ void OAIPetApiRequest::updatePetWithFormRequest(const QString& pet_idstr){ QString name; QString status; - emit updatePetWithForm( pet_id, name, status); + emit updatePetWithForm(pet_id, name, status); } void OAIPetApiRequest::uploadFileRequest(const QString& pet_idstr){ qDebug() << "/v2/pet/{petId}/uploadImage"; connect(this, &OAIPetApiRequest::uploadFile, handler, &OAIPetApiHandler::uploadFile); - + qint64 pet_id; fromStringValue(pet_idstr, pet_id); @@ -173,13 +173,13 @@ void OAIPetApiRequest::uploadFileRequest(const QString& pet_idstr){ QString additional_metadata; QIODevice* file; - emit uploadFile( pet_id, additional_metadata, file); + emit uploadFile(pet_id, additional_metadata, file); } - + void OAIPetApiRequest::addPetResponse(){ - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::OK); if(socket->isOpen()){ socket->close(); @@ -187,7 +187,7 @@ void OAIPetApiRequest::addPetResponse(){ } void OAIPetApiRequest::deletePetResponse(){ - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::OK); if(socket->isOpen()){ socket->close(); @@ -222,7 +222,7 @@ void OAIPetApiRequest::getPetByIdResponse(const OAIPet& res){ } void OAIPetApiRequest::updatePetResponse(){ - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::OK); if(socket->isOpen()){ socket->close(); @@ -230,7 +230,7 @@ void OAIPetApiRequest::updatePetResponse(){ } void OAIPetApiRequest::updatePetWithFormResponse(){ - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::OK); if(socket->isOpen()){ socket->close(); @@ -249,7 +249,7 @@ void OAIPetApiRequest::uploadFileResponse(const OAIApiResponse& res){ void OAIPetApiRequest::addPetError(QNetworkReply::NetworkError error_type, QString& error_str){ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::NotFound); socket->write(error_str.toUtf8()); if(socket->isOpen()){ @@ -259,7 +259,7 @@ void OAIPetApiRequest::addPetError(QNetworkReply::NetworkError error_type, QStri void OAIPetApiRequest::deletePetError(QNetworkReply::NetworkError error_type, QString& error_str){ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::NotFound); socket->write(error_str.toUtf8()); if(socket->isOpen()){ @@ -302,7 +302,7 @@ void OAIPetApiRequest::getPetByIdError(const OAIPet& res, QNetworkReply::Network void OAIPetApiRequest::updatePetError(QNetworkReply::NetworkError error_type, QString& error_str){ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::NotFound); socket->write(error_str.toUtf8()); if(socket->isOpen()){ @@ -312,7 +312,7 @@ void OAIPetApiRequest::updatePetError(QNetworkReply::NetworkError error_type, QS void OAIPetApiRequest::updatePetWithFormError(QNetworkReply::NetworkError error_type, QString& error_str){ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::NotFound); socket->write(error_str.toUtf8()); if(socket->isOpen()){ @@ -336,7 +336,7 @@ void OAIPetApiRequest::sendCustomResponse(QByteArray & res, QNetworkReply::Netwo Q_UNUSED(res); // TODO Q_UNUSED(error_type); // TODO } - + void OAIPetApiRequest::sendCustomResponse(QIODevice *res, QNetworkReply::NetworkError error_type){ Q_UNUSED(res); // TODO Q_UNUSED(error_type); // TODO diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIPetApiRequest.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIPetApiRequest.h index aba7871567a..da87285e0ff 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIPetApiRequest.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIPetApiRequest.h @@ -31,7 +31,7 @@ namespace OpenAPI { class OAIPetApiRequest : public QObject { Q_OBJECT - + public: OAIPetApiRequest(QHttpEngine::Socket *s, OAIPetApiHandler* handler); virtual ~OAIPetApiRequest(); @@ -99,7 +99,7 @@ private: resHeaders.insert(itr.key().toUtf8(), itr.value().toUtf8()); } socket->setHeaders(resHeaders); - socket->writeHeaders(); + socket->writeHeaders(); } }; diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIStoreApiRequest.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIStoreApiRequest.cpp index a383601baa3..c770ae2a09f 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIStoreApiRequest.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIStoreApiRequest.cpp @@ -25,7 +25,7 @@ OAIStoreApiRequest::OAIStoreApiRequest(QHttpEngine::Socket *s, OAIStoreApiHandle auto headers = s->headers(); for(auto itr = headers.begin(); itr != headers.end(); itr++) { requestHeaders.insert(QString(itr.key()), QString(itr.value())); - } + } } OAIStoreApiRequest::~OAIStoreApiRequest(){ @@ -33,7 +33,7 @@ OAIStoreApiRequest::~OAIStoreApiRequest(){ qDebug() << "OAIStoreApiRequest::~OAIStoreApiRequest()"; } -QMap +QMap OAIStoreApiRequest::getRequestHeaders() const { return requestHeaders; } @@ -53,20 +53,20 @@ QHttpEngine::Socket* OAIStoreApiRequest::getRawSocket(){ void OAIStoreApiRequest::deleteOrderRequest(const QString& order_idstr){ qDebug() << "/v2/store/order/{orderId}"; connect(this, &OAIStoreApiRequest::deleteOrder, handler, &OAIStoreApiHandler::deleteOrder); - + QString order_id; fromStringValue(order_idstr, order_id); - emit deleteOrder( order_id); + emit deleteOrder(order_id); } void OAIStoreApiRequest::getInventoryRequest(){ qDebug() << "/v2/store/inventory"; connect(this, &OAIStoreApiRequest::getInventory, handler, &OAIStoreApiHandler::getInventory); - + @@ -77,20 +77,20 @@ void OAIStoreApiRequest::getInventoryRequest(){ void OAIStoreApiRequest::getOrderByIdRequest(const QString& order_idstr){ qDebug() << "/v2/store/order/{orderId}"; connect(this, &OAIStoreApiRequest::getOrderById, handler, &OAIStoreApiHandler::getOrderById); - + qint64 order_id; fromStringValue(order_idstr, order_id); - emit getOrderById( order_id); + emit getOrderById(order_id); } void OAIStoreApiRequest::placeOrderRequest(){ qDebug() << "/v2/store/order"; connect(this, &OAIStoreApiRequest::placeOrder, handler, &OAIStoreApiHandler::placeOrder); - + QJsonDocument doc; @@ -100,13 +100,13 @@ void OAIStoreApiRequest::placeOrderRequest(){ ::OpenAPI::fromJsonValue(oai_order, obj); - emit placeOrder( oai_order); + emit placeOrder(oai_order); } - + void OAIStoreApiRequest::deleteOrderResponse(){ - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::OK); if(socket->isOpen()){ socket->close(); @@ -143,7 +143,7 @@ void OAIStoreApiRequest::placeOrderResponse(const OAIOrder& res){ void OAIStoreApiRequest::deleteOrderError(QNetworkReply::NetworkError error_type, QString& error_str){ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::NotFound); socket->write(error_str.toUtf8()); if(socket->isOpen()){ @@ -189,7 +189,7 @@ void OAIStoreApiRequest::sendCustomResponse(QByteArray & res, QNetworkReply::Net Q_UNUSED(res); // TODO Q_UNUSED(error_type); // TODO } - + void OAIStoreApiRequest::sendCustomResponse(QIODevice *res, QNetworkReply::NetworkError error_type){ Q_UNUSED(res); // TODO Q_UNUSED(error_type); // TODO diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIStoreApiRequest.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIStoreApiRequest.h index b9c6ce1c041..491e27db1f7 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIStoreApiRequest.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIStoreApiRequest.h @@ -30,7 +30,7 @@ namespace OpenAPI { class OAIStoreApiRequest : public QObject { Q_OBJECT - + public: OAIStoreApiRequest(QHttpEngine::Socket *s, OAIStoreApiHandler* handler); virtual ~OAIStoreApiRequest(); @@ -82,7 +82,7 @@ private: resHeaders.insert(itr.key().toUtf8(), itr.value().toUtf8()); } socket->setHeaders(resHeaders); - socket->writeHeaders(); + socket->writeHeaders(); } }; diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIUserApiRequest.cpp b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIUserApiRequest.cpp index bdc5b0b6882..f7162aafadc 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIUserApiRequest.cpp +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIUserApiRequest.cpp @@ -25,7 +25,7 @@ OAIUserApiRequest::OAIUserApiRequest(QHttpEngine::Socket *s, OAIUserApiHandler* auto headers = s->headers(); for(auto itr = headers.begin(); itr != headers.end(); itr++) { requestHeaders.insert(QString(itr.key()), QString(itr.value())); - } + } } OAIUserApiRequest::~OAIUserApiRequest(){ @@ -33,7 +33,7 @@ OAIUserApiRequest::~OAIUserApiRequest(){ qDebug() << "OAIUserApiRequest::~OAIUserApiRequest()"; } -QMap +QMap OAIUserApiRequest::getRequestHeaders() const { return requestHeaders; } @@ -53,7 +53,7 @@ QHttpEngine::Socket* OAIUserApiRequest::getRawSocket(){ void OAIUserApiRequest::createUserRequest(){ qDebug() << "/v2/user"; connect(this, &OAIUserApiRequest::createUser, handler, &OAIUserApiHandler::createUser); - + QJsonDocument doc; @@ -63,18 +63,18 @@ void OAIUserApiRequest::createUserRequest(){ ::OpenAPI::fromJsonValue(oai_user, obj); - emit createUser( oai_user); + emit createUser(oai_user); } void OAIUserApiRequest::createUsersWithArrayInputRequest(){ qDebug() << "/v2/user/createWithArray"; connect(this, &OAIUserApiRequest::createUsersWithArrayInput, handler, &OAIUserApiHandler::createUsersWithArrayInput); - + QJsonDocument doc; - QList oai_user; + QList oai_user; if(socket->readJson(doc)){ QJsonArray jsonArray = doc.array(); foreach(QJsonValue obj, jsonArray) { @@ -85,18 +85,18 @@ void OAIUserApiRequest::createUsersWithArrayInputRequest(){ } - emit createUsersWithArrayInput( oai_user); + emit createUsersWithArrayInput(oai_user); } void OAIUserApiRequest::createUsersWithListInputRequest(){ qDebug() << "/v2/user/createWithList"; connect(this, &OAIUserApiRequest::createUsersWithListInput, handler, &OAIUserApiHandler::createUsersWithListInput); - + QJsonDocument doc; - QList oai_user; + QList oai_user; if(socket->readJson(doc)){ QJsonArray jsonArray = doc.array(); foreach(QJsonValue obj, jsonArray) { @@ -107,61 +107,61 @@ void OAIUserApiRequest::createUsersWithListInputRequest(){ } - emit createUsersWithListInput( oai_user); + emit createUsersWithListInput(oai_user); } void OAIUserApiRequest::deleteUserRequest(const QString& usernamestr){ qDebug() << "/v2/user/{username}"; connect(this, &OAIUserApiRequest::deleteUser, handler, &OAIUserApiHandler::deleteUser); - + QString username; fromStringValue(usernamestr, username); - emit deleteUser( username); + emit deleteUser(username); } void OAIUserApiRequest::getUserByNameRequest(const QString& usernamestr){ qDebug() << "/v2/user/{username}"; connect(this, &OAIUserApiRequest::getUserByName, handler, &OAIUserApiHandler::getUserByName); - + QString username; fromStringValue(usernamestr, username); - emit getUserByName( username); + emit getUserByName(username); } void OAIUserApiRequest::loginUserRequest(){ qDebug() << "/v2/user/login"; connect(this, &OAIUserApiRequest::loginUser, handler, &OAIUserApiHandler::loginUser); + - - QString username; + QString username; if(socket->queryString().keys().contains("username")){ fromStringValue(socket->queryString().value("username"), username); } - QString password; + QString password; if(socket->queryString().keys().contains("password")){ fromStringValue(socket->queryString().value("password"), password); } - emit loginUser( username, password); + emit loginUser(username, password); } void OAIUserApiRequest::logoutUserRequest(){ qDebug() << "/v2/user/logout"; connect(this, &OAIUserApiRequest::logoutUser, handler, &OAIUserApiHandler::logoutUser); - + @@ -172,7 +172,7 @@ void OAIUserApiRequest::logoutUserRequest(){ void OAIUserApiRequest::updateUserRequest(const QString& usernamestr){ qDebug() << "/v2/user/{username}"; connect(this, &OAIUserApiRequest::updateUser, handler, &OAIUserApiHandler::updateUser); - + QString username; fromStringValue(usernamestr, username); @@ -184,13 +184,13 @@ void OAIUserApiRequest::updateUserRequest(const QString& usernamestr){ ::OpenAPI::fromJsonValue(oai_user, obj); - emit updateUser( username, oai_user); + emit updateUser(username, oai_user); } - + void OAIUserApiRequest::createUserResponse(){ - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::OK); if(socket->isOpen()){ socket->close(); @@ -198,7 +198,7 @@ void OAIUserApiRequest::createUserResponse(){ } void OAIUserApiRequest::createUsersWithArrayInputResponse(){ - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::OK); if(socket->isOpen()){ socket->close(); @@ -206,7 +206,7 @@ void OAIUserApiRequest::createUsersWithArrayInputResponse(){ } void OAIUserApiRequest::createUsersWithListInputResponse(){ - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::OK); if(socket->isOpen()){ socket->close(); @@ -214,7 +214,7 @@ void OAIUserApiRequest::createUsersWithListInputResponse(){ } void OAIUserApiRequest::deleteUserResponse(){ - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::OK); if(socket->isOpen()){ socket->close(); @@ -232,15 +232,14 @@ void OAIUserApiRequest::getUserByNameResponse(const OAIUser& res){ void OAIUserApiRequest::loginUserResponse(const QString& res){ writeResponseHeaders(); - QJsonDocument resDoc(::OpenAPI::toJsonValue(res).toObject()); - socket->writeJson(resDoc); + socket->write(::OpenAPI::toStringValue(res).toUtf8()); if(socket->isOpen()){ socket->close(); } } void OAIUserApiRequest::logoutUserResponse(){ - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::OK); if(socket->isOpen()){ socket->close(); @@ -248,7 +247,7 @@ void OAIUserApiRequest::logoutUserResponse(){ } void OAIUserApiRequest::updateUserResponse(){ - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::OK); if(socket->isOpen()){ socket->close(); @@ -258,7 +257,7 @@ void OAIUserApiRequest::updateUserResponse(){ void OAIUserApiRequest::createUserError(QNetworkReply::NetworkError error_type, QString& error_str){ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::NotFound); socket->write(error_str.toUtf8()); if(socket->isOpen()){ @@ -268,7 +267,7 @@ void OAIUserApiRequest::createUserError(QNetworkReply::NetworkError error_type, void OAIUserApiRequest::createUsersWithArrayInputError(QNetworkReply::NetworkError error_type, QString& error_str){ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::NotFound); socket->write(error_str.toUtf8()); if(socket->isOpen()){ @@ -278,7 +277,7 @@ void OAIUserApiRequest::createUsersWithArrayInputError(QNetworkReply::NetworkErr void OAIUserApiRequest::createUsersWithListInputError(QNetworkReply::NetworkError error_type, QString& error_str){ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::NotFound); socket->write(error_str.toUtf8()); if(socket->isOpen()){ @@ -288,7 +287,7 @@ void OAIUserApiRequest::createUsersWithListInputError(QNetworkReply::NetworkErro void OAIUserApiRequest::deleteUserError(QNetworkReply::NetworkError error_type, QString& error_str){ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::NotFound); socket->write(error_str.toUtf8()); if(socket->isOpen()){ @@ -311,8 +310,7 @@ void OAIUserApiRequest::loginUserError(const QString& res, QNetworkReply::Networ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors writeResponseHeaders(); Q_UNUSED(error_str); // response will be used instead of error string - QJsonDocument resDoc(::OpenAPI::toJsonValue(res).toObject()); - socket->writeJson(resDoc); + socket->write(::OpenAPI::toStringValue(res).toUtf8()); if(socket->isOpen()){ socket->close(); } @@ -320,7 +318,7 @@ void OAIUserApiRequest::loginUserError(const QString& res, QNetworkReply::Networ void OAIUserApiRequest::logoutUserError(QNetworkReply::NetworkError error_type, QString& error_str){ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::NotFound); socket->write(error_str.toUtf8()); if(socket->isOpen()){ @@ -330,7 +328,7 @@ void OAIUserApiRequest::logoutUserError(QNetworkReply::NetworkError error_type, void OAIUserApiRequest::updateUserError(QNetworkReply::NetworkError error_type, QString& error_str){ Q_UNUSED(error_type); // TODO: Remap error_type to QHttpEngine::Socket errors - writeResponseHeaders(); + writeResponseHeaders(); socket->setStatusCode(QHttpEngine::Socket::NotFound); socket->write(error_str.toUtf8()); if(socket->isOpen()){ @@ -343,7 +341,7 @@ void OAIUserApiRequest::sendCustomResponse(QByteArray & res, QNetworkReply::Netw Q_UNUSED(res); // TODO Q_UNUSED(error_type); // TODO } - + void OAIUserApiRequest::sendCustomResponse(QIODevice *res, QNetworkReply::NetworkError error_type){ Q_UNUSED(res); // TODO Q_UNUSED(error_type); // TODO diff --git a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIUserApiRequest.h b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIUserApiRequest.h index d1b30ef196d..f7733473304 100644 --- a/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIUserApiRequest.h +++ b/samples/server/petstore/cpp-qt5-qhttpengine-server/server/src/requests/OAIUserApiRequest.h @@ -30,7 +30,7 @@ namespace OpenAPI { class OAIUserApiRequest : public QObject { Q_OBJECT - + public: OAIUserApiRequest(QHttpEngine::Socket *s, OAIUserApiHandler* handler); virtual ~OAIUserApiRequest(); @@ -98,7 +98,7 @@ private: resHeaders.insert(itr.key().toUtf8(), itr.value().toUtf8()); } socket->setHeaders(resHeaders); - socket->writeHeaders(); + socket->writeHeaders(); } }; diff --git a/samples/server/petstore/cpp-restbed/.openapi-generator/VERSION b/samples/server/petstore/cpp-restbed/.openapi-generator/VERSION index 14900cee60e..f4cb97d56ce 100644 --- a/samples/server/petstore/cpp-restbed/.openapi-generator/VERSION +++ b/samples/server/petstore/cpp-restbed/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.1-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/cpp-restbed/api/PetApi.cpp b/samples/server/petstore/cpp-restbed/api/PetApi.cpp index 2d25c503385..2545c223e88 100644 --- a/samples/server/petstore/cpp-restbed/api/PetApi.cpp +++ b/samples/server/petstore/cpp-restbed/api/PetApi.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -118,7 +118,7 @@ void PetApiPetResource::PUT_method_handler(const std::shared_ptrget_path_parameter("petId", 0L); - + // Change the value of this variable to the appropriate response before sending the response int status_code = 200; @@ -225,7 +225,7 @@ void PetApiPetPetIdResource::POST_method_handler(const std::shared_ptrget_path_parameter("petId", 0L); - + // Change the value of this variable to the appropriate response before sending the response int status_code = 200; diff --git a/samples/server/petstore/cpp-restbed/api/PetApi.h b/samples/server/petstore/cpp-restbed/api/PetApi.h index 116e9f93d65..b4dcc65ae10 100644 --- a/samples/server/petstore/cpp-restbed/api/PetApi.h +++ b/samples/server/petstore/cpp-restbed/api/PetApi.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/api/StoreApi.cpp b/samples/server/petstore/cpp-restbed/api/StoreApi.cpp index b3e0a63e85c..7e044021d2f 100644 --- a/samples/server/petstore/cpp-restbed/api/StoreApi.cpp +++ b/samples/server/petstore/cpp-restbed/api/StoreApi.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -100,7 +100,7 @@ void StoreApiStoreOrderOrderIdResource::GET_method_handler(const std::shared_ptr // Getting the path params const int64_t orderId = request->get_path_parameter("orderId", 0L); - + // Change the value of this variable to the appropriate response before sending the response int status_code = 200; diff --git a/samples/server/petstore/cpp-restbed/api/StoreApi.h b/samples/server/petstore/cpp-restbed/api/StoreApi.h index 4e38fab61d3..322417638ef 100644 --- a/samples/server/petstore/cpp-restbed/api/StoreApi.h +++ b/samples/server/petstore/cpp-restbed/api/StoreApi.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/api/UserApi.cpp b/samples/server/petstore/cpp-restbed/api/UserApi.cpp index 74dadb906bd..3d96d375f0b 100644 --- a/samples/server/petstore/cpp-restbed/api/UserApi.cpp +++ b/samples/server/petstore/cpp-restbed/api/UserApi.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ @@ -253,7 +253,7 @@ void UserApiUserUsernameResource::GET_method_handler(const std::shared_ptrget_path_parameter("username", ""); - + // Change the value of this variable to the appropriate response before sending the response int status_code = 200; @@ -292,7 +292,7 @@ void UserApiUserUsernameResource::PUT_method_handler(const std::shared_ptrget_path_parameter("username", ""); - + // Change the value of this variable to the appropriate response before sending the response int status_code = 200; diff --git a/samples/server/petstore/cpp-restbed/api/UserApi.h b/samples/server/petstore/cpp-restbed/api/UserApi.h index 0d2716f37b0..67739965b43 100644 --- a/samples/server/petstore/cpp-restbed/api/UserApi.h +++ b/samples/server/petstore/cpp-restbed/api/UserApi.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/model/ApiResponse.cpp b/samples/server/petstore/cpp-restbed/model/ApiResponse.cpp index 2b1862b84de..00b5c04d033 100644 --- a/samples/server/petstore/cpp-restbed/model/ApiResponse.cpp +++ b/samples/server/petstore/cpp-restbed/model/ApiResponse.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/model/ApiResponse.h b/samples/server/petstore/cpp-restbed/model/ApiResponse.h index 746bfb890fb..0db8875b00a 100644 --- a/samples/server/petstore/cpp-restbed/model/ApiResponse.h +++ b/samples/server/petstore/cpp-restbed/model/ApiResponse.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/model/Category.cpp b/samples/server/petstore/cpp-restbed/model/Category.cpp index d0e1898b235..4812be665e6 100644 --- a/samples/server/petstore/cpp-restbed/model/Category.cpp +++ b/samples/server/petstore/cpp-restbed/model/Category.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/model/Category.h b/samples/server/petstore/cpp-restbed/model/Category.h index 3a0060698e5..0af819d6bb3 100644 --- a/samples/server/petstore/cpp-restbed/model/Category.h +++ b/samples/server/petstore/cpp-restbed/model/Category.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/model/Order.cpp b/samples/server/petstore/cpp-restbed/model/Order.cpp index ef339d7a66b..58b55ca9092 100644 --- a/samples/server/petstore/cpp-restbed/model/Order.cpp +++ b/samples/server/petstore/cpp-restbed/model/Order.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/model/Order.h b/samples/server/petstore/cpp-restbed/model/Order.h index d964c84226b..9094086b354 100644 --- a/samples/server/petstore/cpp-restbed/model/Order.h +++ b/samples/server/petstore/cpp-restbed/model/Order.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/model/Pet.cpp b/samples/server/petstore/cpp-restbed/model/Pet.cpp index f56f2b45b51..c4ca4da2277 100644 --- a/samples/server/petstore/cpp-restbed/model/Pet.cpp +++ b/samples/server/petstore/cpp-restbed/model/Pet.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/model/Pet.h b/samples/server/petstore/cpp-restbed/model/Pet.h index 8dab50f9295..10a9a0f02b9 100644 --- a/samples/server/petstore/cpp-restbed/model/Pet.h +++ b/samples/server/petstore/cpp-restbed/model/Pet.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/model/Tag.cpp b/samples/server/petstore/cpp-restbed/model/Tag.cpp index 9a6acfb4c49..e7f8372e8f3 100644 --- a/samples/server/petstore/cpp-restbed/model/Tag.cpp +++ b/samples/server/petstore/cpp-restbed/model/Tag.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/model/Tag.h b/samples/server/petstore/cpp-restbed/model/Tag.h index 5239be20809..4969930f60e 100644 --- a/samples/server/petstore/cpp-restbed/model/Tag.h +++ b/samples/server/petstore/cpp-restbed/model/Tag.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/model/User.cpp b/samples/server/petstore/cpp-restbed/model/User.cpp index 1eca66674f8..417f76d557f 100644 --- a/samples/server/petstore/cpp-restbed/model/User.cpp +++ b/samples/server/petstore/cpp-restbed/model/User.cpp @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/cpp-restbed/model/User.h b/samples/server/petstore/cpp-restbed/model/User.h index b557e5e42d8..462bd2abb00 100644 --- a/samples/server/petstore/cpp-restbed/model/User.h +++ b/samples/server/petstore/cpp-restbed/model/User.h @@ -5,7 +5,7 @@ * OpenAPI spec version: 1.0.0 * * - * NOTE: This class is auto generated by OpenAPI-Generator 3.2.1-SNAPSHOT. + * NOTE: This class is auto generated by OpenAPI-Generator 3.3.1-SNAPSHOT. * https://openapi-generator.tech * Do not edit the class manually. */ diff --git a/samples/server/petstore/flaskConnexion-python2/.openapi-generator/VERSION b/samples/server/petstore/flaskConnexion-python2/.openapi-generator/VERSION index 096bf47efe3..f4cb97d56ce 100644 --- a/samples/server/petstore/flaskConnexion-python2/.openapi-generator/VERSION +++ b/samples/server/petstore/flaskConnexion-python2/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/flaskConnexion-python2/openapi_server/models/api_response.py b/samples/server/petstore/flaskConnexion-python2/openapi_server/models/api_response.py index f4f26e834a2..1b740655f7d 100644 --- a/samples/server/petstore/flaskConnexion-python2/openapi_server/models/api_response.py +++ b/samples/server/petstore/flaskConnexion-python2/openapi_server/models/api_response.py @@ -26,9 +26,9 @@ class ApiResponse(Model): :type message: str """ self.openapi_types = { - 'code': int, - 'type': str, - 'message': str + 'code': 'int', + 'type': 'str', + 'message': 'str' } self.attribute_map = { diff --git a/samples/server/petstore/flaskConnexion-python2/openapi_server/models/category.py b/samples/server/petstore/flaskConnexion-python2/openapi_server/models/category.py index fc2b224078a..b11afbf6641 100644 --- a/samples/server/petstore/flaskConnexion-python2/openapi_server/models/category.py +++ b/samples/server/petstore/flaskConnexion-python2/openapi_server/models/category.py @@ -24,8 +24,8 @@ class Category(Model): :type name: str """ self.openapi_types = { - 'id': long, - 'name': str + 'id': 'long', + 'name': 'str' } self.attribute_map = { diff --git a/samples/server/petstore/flaskConnexion-python2/openapi_server/models/order.py b/samples/server/petstore/flaskConnexion-python2/openapi_server/models/order.py index 02ea8c4fd72..d63b9e1d009 100644 --- a/samples/server/petstore/flaskConnexion-python2/openapi_server/models/order.py +++ b/samples/server/petstore/flaskConnexion-python2/openapi_server/models/order.py @@ -32,12 +32,12 @@ class Order(Model): :type complete: bool """ self.openapi_types = { - 'id': long, - 'pet_id': long, - 'quantity': int, - 'ship_date': datetime, - 'status': str, - 'complete': bool + 'id': 'long', + 'pet_id': 'long', + 'quantity': 'int', + 'ship_date': 'datetime', + 'status': 'str', + 'complete': 'bool' } self.attribute_map = { diff --git a/samples/server/petstore/flaskConnexion-python2/openapi_server/models/pet.py b/samples/server/petstore/flaskConnexion-python2/openapi_server/models/pet.py index 411e9e12f52..aa880e600f8 100644 --- a/samples/server/petstore/flaskConnexion-python2/openapi_server/models/pet.py +++ b/samples/server/petstore/flaskConnexion-python2/openapi_server/models/pet.py @@ -6,8 +6,6 @@ from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from openapi_server.models.base_model_ import Model -from openapi_server.models.category import Category # noqa: F401,E501 -from openapi_server.models.tag import Tag # noqa: F401,E501 from openapi_server import util @@ -34,12 +32,12 @@ class Pet(Model): :type status: str """ self.openapi_types = { - 'id': long, - 'category': Category, - 'name': str, - 'photo_urls': List[str], - 'tags': List[Tag], - 'status': str + 'id': 'long', + 'category': 'Category', + 'name': 'str', + 'photo_urls': 'List[str]', + 'tags': 'List[Tag]', + 'status': 'str' } self.attribute_map = { diff --git a/samples/server/petstore/flaskConnexion-python2/openapi_server/models/tag.py b/samples/server/petstore/flaskConnexion-python2/openapi_server/models/tag.py index 24a262951ed..0dc7e32f4f1 100644 --- a/samples/server/petstore/flaskConnexion-python2/openapi_server/models/tag.py +++ b/samples/server/petstore/flaskConnexion-python2/openapi_server/models/tag.py @@ -24,8 +24,8 @@ class Tag(Model): :type name: str """ self.openapi_types = { - 'id': long, - 'name': str + 'id': 'long', + 'name': 'str' } self.attribute_map = { diff --git a/samples/server/petstore/flaskConnexion-python2/openapi_server/models/user.py b/samples/server/petstore/flaskConnexion-python2/openapi_server/models/user.py index 3807bfe9978..c13e40f518c 100644 --- a/samples/server/petstore/flaskConnexion-python2/openapi_server/models/user.py +++ b/samples/server/petstore/flaskConnexion-python2/openapi_server/models/user.py @@ -36,14 +36,14 @@ class User(Model): :type user_status: int """ self.openapi_types = { - 'id': long, - 'username': str, - 'first_name': str, - 'last_name': str, - 'email': str, - 'password': str, - 'phone': str, - 'user_status': int + 'id': 'long', + 'username': 'str', + 'first_name': 'str', + 'last_name': 'str', + 'email': 'str', + 'password': 'str', + 'phone': 'str', + 'user_status': 'int' } self.attribute_map = { diff --git a/samples/server/petstore/flaskConnexion-python2/openapi_server/openapi/openapi.yaml b/samples/server/petstore/flaskConnexion-python2/openapi_server/openapi/openapi.yaml index cc02c545f9a..dca523e5557 100644 --- a/samples/server/petstore/flaskConnexion-python2/openapi_server/openapi/openapi.yaml +++ b/samples/server/petstore/flaskConnexion-python2/openapi_server/openapi/openapi.yaml @@ -1,304 +1,325 @@ -openapi: 3.0.0 +openapi: 3.0.1 info: - title: OpenAPI Petstore description: This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. license: name: Apache-2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore version: 1.0.0 -externalDocs: - description: Find out more about Swagger - url: http://swagger.io servers: - url: http://petstore.swagger.io/v2 tags: -- name: pet - description: Everything about your Pets -- name: store - description: Access to Petstore orders -- name: user - description: Operations about user +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user paths: /pet: - put: + post: + operationId: add_pet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store tags: - pet - summary: Update an existing pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + put: operationId: update_pet requestBody: - $ref: '#/components/requestBodies/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 responses: 400: + content: {} description: Invalid ID supplied 404: + content: {} description: Pet not found 405: + content: {} description: Validation exception security: - petstore_auth: - write:pets - read:pets - x-openapi-router-controller: openapi_server.controllers.pet_controller - post: + summary: Update an existing pet tags: - pet - summary: Add a new pet to the store - operationId: add_pet - requestBody: - $ref: '#/components/requestBodies/Pet' - responses: - 405: - description: Invalid input - security: - - petstore_auth: - - write:pets - - read:pets x-openapi-router-controller: openapi_server.controllers.pet_controller /pet/findByStatus: get: - tags: - - pet - summary: Finds Pets by status description: Multiple status values can be provided with comma separated strings operationId: find_pets_by_status parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - style: form + - description: Status values that need to be considered for filter explode: false + in: query + name: status + required: true schema: - type: array items: - type: string default: available enum: - available - pending - sold + type: string + type: array + style: form responses: 200: - description: successful operation content: application/xml: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array application/json: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array + description: successful operation 400: + content: {} description: Invalid status value security: - petstore_auth: - write:pets - read:pets + summary: Finds Pets by status + tags: + - pet x-openapi-router-controller: openapi_server.controllers.pet_controller /pet/findByTags: get: - tags: - - pet - summary: Finds Pets by tags + deprecated: true description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. operationId: find_pets_by_tags parameters: - - name: tags - in: query - description: Tags to filter by - required: true - style: form + - description: Tags to filter by explode: false + in: query + name: tags + required: true schema: - type: array items: type: string + type: array + style: form responses: 200: - description: successful operation content: application/xml: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array application/json: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array + description: successful operation 400: + content: {} description: Invalid tag value - deprecated: true security: - petstore_auth: - write:pets - read:pets + summary: Finds Pets by tags + tags: + - pet x-openapi-router-controller: openapi_server.controllers.pet_controller /pet/{petId}: - get: - tags: - - pet - summary: Find pet by ID - description: Returns a single pet - operationId: get_pet_by_id - parameters: - - name: petId - in: path - description: ID of pet to return - required: true - style: simple - explode: false - 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: [] - x-openapi-router-controller: openapi_server.controllers.pet_controller - post: - tags: - - pet - summary: Updates a pet in the store with form data - operationId: update_pet_with_form - parameters: - - name: petId - in: path - description: ID of pet that needs to be updated - required: true - style: simple - explode: false - schema: - type: integer - format: int64 - requestBody: - content: - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/body' - responses: - 405: - description: Invalid input - security: - - petstore_auth: - - write:pets - - read:pets - x-openapi-router-controller: openapi_server.controllers.pet_controller delete: - tags: - - pet - summary: Deletes a pet operationId: delete_pet parameters: - - name: api_key - in: header - required: false - style: simple - explode: false + - in: header + name: api_key schema: type: string - - name: petId + - description: Pet id to delete in: path - description: Pet id to delete + name: petId required: true - style: simple - explode: false schema: - type: integer format: int64 + type: integer responses: 400: + content: {} description: Invalid pet value security: - petstore_auth: - write:pets - read:pets - x-openapi-router-controller: openapi_server.controllers.pet_controller - /pet/{petId}/uploadImage: - post: + summary: Deletes a pet tags: - pet - summary: uploads an image - operationId: upload_file + x-openapi-router-controller: openapi_server.controllers.pet_controller + get: + description: Returns a single pet + operationId: get_pet_by_id parameters: - - name: petId + - description: ID of pet to return in: path - description: ID of pet to update + name: petId required: true - style: simple - explode: false schema: - type: integer format: int64 - requestBody: - content: - multipart/form-data: - schema: - $ref: '#/components/schemas/body_1' + type: integer responses: 200: - description: successful operation content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' application/json: schema: - $ref: '#/components/schemas/ApiResponse' + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + post: + operationId: update_pet_with_form + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + 405: + content: {} + description: Invalid input security: - petstore_auth: - write:pets - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/{petId}/uploadImage: + post: + operationId: upload_file + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet x-openapi-router-controller: openapi_server.controllers.pet_controller /store/inventory: get: - tags: - - store - summary: Returns pet inventories by status description: Returns a map of status codes to quantities operationId: get_inventory responses: 200: - description: successful operation content: application/json: schema: - type: object additionalProperties: - type: integer format: int32 + type: integer + type: object + description: successful operation security: - api_key: [] + summary: Returns pet inventories by status + tags: + - store x-openapi-router-controller: openapi_server.controllers.store_controller /store/order: post: - tags: - - store - summary: Place an order for a pet operationId: place_order requestBody: - description: order placed for purchasing the pet content: - application/json: + '*/*': schema: $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet required: true responses: 200: - description: successful operation content: application/xml: schema: @@ -306,185 +327,216 @@ paths: application/json: schema: $ref: '#/components/schemas/Order' + description: successful operation 400: + content: {} description: Invalid Order + summary: Place an order for a pet + tags: + - store x-openapi-router-controller: openapi_server.controllers.store_controller /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: get_order_by_id - parameters: - - name: orderId - in: path - description: ID of pet that needs to be fetched - required: true - style: simple - explode: false - schema: - maximum: 5 - minimum: 1 - type: integer - format: int64 - 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 - x-openapi-router-controller: openapi_server.controllers.store_controller 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: delete_order parameters: - - name: orderId + - description: ID of the order that needs to be deleted in: path - description: ID of the order that needs to be deleted + name: orderId required: true - style: simple - explode: false schema: type: string responses: 400: + content: {} description: Invalid ID supplied 404: + content: {} description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: get_order_by_id + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store x-openapi-router-controller: openapi_server.controllers.store_controller /user: post: - tags: - - user - summary: Create user description: This can only be done by the logged in user. operationId: create_user requestBody: - description: Created user object content: - application/json: + '*/*': schema: $ref: '#/components/schemas/User' + description: Created user object required: true responses: default: + content: {} description: successful operation + summary: Create user + tags: + - user x-openapi-router-controller: openapi_server.controllers.user_controller /user/createWithArray: post: - tags: - - user - summary: Creates list of users with given input array operationId: create_users_with_array_input requestBody: - $ref: '#/components/requestBodies/UserArray' + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true responses: default: + content: {} description: successful operation + summary: Creates list of users with given input array + tags: + - user x-openapi-router-controller: openapi_server.controllers.user_controller /user/createWithList: post: - tags: - - user - summary: Creates list of users with given input array operationId: create_users_with_list_input requestBody: - $ref: '#/components/requestBodies/UserArray' + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true responses: default: + content: {} description: successful operation + summary: Creates list of users with given input array + tags: + - user x-openapi-router-controller: openapi_server.controllers.user_controller /user/login: get: - tags: - - user - summary: Logs user into the system operationId: login_user parameters: - - name: username + - description: The user name for login in: query - description: The user name for login + name: username required: true - style: form - explode: true schema: type: string - - name: password + - description: The password for login in clear text in: query - description: The password for login in clear text + name: password required: true - style: form - explode: true schema: type: string responses: 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string description: successful operation headers: X-Rate-Limit: description: calls per hour allowed by the user - style: simple - explode: false schema: - type: integer format: int32 + type: integer X-Expires-After: description: date in UTC when toekn expires - style: simple - explode: false schema: - type: string format: date-time - content: - application/xml: - schema: - type: string - application/json: - schema: type: string 400: + content: {} description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user x-openapi-router-controller: openapi_server.controllers.user_controller /user/logout: get: - tags: - - user - summary: Logs out current logged in user session operationId: logout_user responses: default: + content: {} description: successful operation - x-openapi-router-controller: openapi_server.controllers.user_controller - /user/{username}: - get: + summary: Logs out current logged in user session tags: - user - summary: Get user by user name + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: delete_user + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Delete user + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + get: operationId: get_user_by_name parameters: - - name: username + - description: The name that needs to be fetched. Use user1 for testing. in: path - description: The name that needs to be fetched. Use user1 for testing. + name: username required: true - style: simple - explode: false schema: type: string responses: 200: - description: successful operation content: application/xml: schema: @@ -492,88 +544,48 @@ paths: application/json: schema: $ref: '#/components/schemas/User' + description: successful operation 400: + content: {} description: Invalid username supplied 404: + content: {} description: User not found - x-openapi-router-controller: openapi_server.controllers.user_controller - put: + summary: Get user by user name tags: - user - summary: Updated user + x-openapi-router-controller: openapi_server.controllers.user_controller + put: description: This can only be done by the logged in user. operationId: update_user parameters: - - name: username + - description: name that need to be deleted in: path - description: name that need to be deleted + name: username required: true - style: simple - explode: false schema: type: string requestBody: - description: Updated user object content: - application/json: + '*/*': schema: $ref: '#/components/schemas/User' + description: Updated user object required: true responses: 400: + content: {} description: Invalid user supplied 404: + content: {} description: User not found - x-openapi-router-controller: openapi_server.controllers.user_controller - delete: + summary: Updated user tags: - user - summary: Delete user - description: This can only be done by the logged in user. - operationId: delete_user - parameters: - - name: username - in: path - description: The name that needs to be deleted - required: true - style: simple - explode: false - schema: - type: string - responses: - 400: - description: Invalid username supplied - 404: - description: User not found x-openapi-router-controller: openapi_server.controllers.user_controller components: schemas: Order: - title: Pet Order - type: object - properties: - id: - type: integer - format: int64 - petId: - type: integer - format: int64 - quantity: - type: integer - format: int32 - shipDate: - type: string - format: date-time - status: - type: string - description: Order Status - enum: - - placed - - approved - - delivered - complete: - type: boolean - default: false description: An order for a pets from the pet store example: petId: 6 @@ -582,30 +594,63 @@ components: shipDate: 2000-01-23T04:56:07.000+00:00 complete: false status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object xml: name: Order Category: - title: Pet category - type: object - properties: - id: - type: integer - format: int64 - name: - type: string description: A category for a pet example: name: name id: 6 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet category + type: object xml: name: Category User: - title: a User - type: object + description: A User who is purchasing from the pet store + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username properties: id: - type: integer format: int64 + type: integer username: type: string firstName: @@ -619,72 +664,29 @@ components: phone: type: string userStatus: - type: integer description: User Status format: int32 - description: A User who is purchasing from the pet store - example: - firstName: firstName - lastName: lastName - password: password - userStatus: 6 - phone: phone - id: 0 - email: email - username: username + type: integer + title: a User + type: object xml: name: User Tag: - title: Pet Tag - type: object - properties: - id: - type: integer - format: int64 - name: - type: string description: A tag for a pet example: name: name id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object xml: name: Tag Pet: - title: a Pet - required: - - name - - photoUrls - type: object - properties: - id: - type: integer - format: int64 - category: - $ref: '#/components/schemas/Category' - name: - type: string - example: doggie - photoUrls: - type: array - xml: - name: photoUrl - wrapped: true - items: - type: string - tags: - type: array - xml: - name: tag - wrapped: true - items: - $ref: '#/components/schemas/Tag' - status: - type: string - description: pet status in the store - enum: - - available - - pending - - sold description: A pet for sale in the pet store example: photoUrls: @@ -701,73 +703,69 @@ components: - name: name id: 1 status: available + properties: + id: + format: int64 + type: integer + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object xml: name: Pet ApiResponse: - title: An uploaded response - type: object - properties: - code: - type: integer - format: int32 - type: - type: string - message: - type: string description: Describes the result of uploading an image resource example: code: 0 type: type message: message - body: - type: object properties: - name: + code: + format: int32 + type: integer + type: type: string - description: Updated name of the pet - status: + message: type: string - description: Updated status of the pet - body_1: + title: An uploaded response type: object - properties: - additionalMetadata: - type: string - description: Additional data to pass to server - file: - type: string - description: file to upload - format: binary - requestBodies: - UserArray: - description: List of user object - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/User' - required: true - Pet: - description: Pet object that needs to be added to the store - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - application/xml: - schema: - $ref: '#/components/schemas/Pet' - required: true securitySchemes: petstore_auth: - type: oauth2 flows: implicit: authorizationUrl: http://petstore.swagger.io/api/oauth/dialog scopes: write:pets: modify pets in your account read:pets: read your pets + type: oauth2 api_key: - type: apiKey - name: api_key in: header + name: api_key + type: apiKey diff --git a/samples/server/petstore/flaskConnexion-python2/openapi_server/util.py b/samples/server/petstore/flaskConnexion-python2/openapi_server/util.py index 4321570d5a0..c7340cd0005 100644 --- a/samples/server/petstore/flaskConnexion-python2/openapi_server/util.py +++ b/samples/server/petstore/flaskConnexion-python2/openapi_server/util.py @@ -51,7 +51,7 @@ def _deserialize_primitive(data, klass): def _deserialize_object(value): - """Return a original value. + """Return an original value. :return: object. """ diff --git a/samples/server/petstore/flaskConnexion-python2/requirements.txt b/samples/server/petstore/flaskConnexion-python2/requirements.txt index 87876f969e9..27cb3a2fb7f 100644 --- a/samples/server/petstore/flaskConnexion-python2/requirements.txt +++ b/samples/server/petstore/flaskConnexion-python2/requirements.txt @@ -1,4 +1,5 @@ -connexion == 1.1.15 +connexion == 2.0.0rc3 +swagger-ui-bundle == 0.0.2 python_dateutil == 2.6.0 typing == 3.5.2.2 setuptools >= 21.0.0 diff --git a/samples/server/petstore/flaskConnexion/.openapi-generator/VERSION b/samples/server/petstore/flaskConnexion/.openapi-generator/VERSION index 096bf47efe3..f4cb97d56ce 100644 --- a/samples/server/petstore/flaskConnexion/.openapi-generator/VERSION +++ b/samples/server/petstore/flaskConnexion/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.1-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/flaskConnexion/openapi_server/models/api_response.py b/samples/server/petstore/flaskConnexion/openapi_server/models/api_response.py index 8d4483699ef..974c29c6a55 100644 --- a/samples/server/petstore/flaskConnexion/openapi_server/models/api_response.py +++ b/samples/server/petstore/flaskConnexion/openapi_server/models/api_response.py @@ -15,7 +15,7 @@ class ApiResponse(Model): Do not edit the class manually. """ - def __init__(self, code: int=None, type: str=None, message: str=None): # noqa: E501 + def __init__(self, code=None, type=None, message=None): # noqa: E501 """ApiResponse - a model defined in OpenAPI :param code: The code of this ApiResponse. # noqa: E501 @@ -26,9 +26,9 @@ class ApiResponse(Model): :type message: str """ self.openapi_types = { - 'code': int, - 'type': str, - 'message': str + 'code': 'int', + 'type': 'str', + 'message': 'str' } self.attribute_map = { @@ -53,7 +53,7 @@ class ApiResponse(Model): return util.deserialize_model(dikt, cls) @property - def code(self) -> int: + def code(self): """Gets the code of this ApiResponse. @@ -63,7 +63,7 @@ class ApiResponse(Model): return self._code @code.setter - def code(self, code: int): + def code(self, code): """Sets the code of this ApiResponse. @@ -74,7 +74,7 @@ class ApiResponse(Model): self._code = code @property - def type(self) -> str: + def type(self): """Gets the type of this ApiResponse. @@ -84,7 +84,7 @@ class ApiResponse(Model): return self._type @type.setter - def type(self, type: str): + def type(self, type): """Sets the type of this ApiResponse. @@ -95,7 +95,7 @@ class ApiResponse(Model): self._type = type @property - def message(self) -> str: + def message(self): """Gets the message of this ApiResponse. @@ -105,7 +105,7 @@ class ApiResponse(Model): return self._message @message.setter - def message(self, message: str): + def message(self, message): """Sets the message of this ApiResponse. diff --git a/samples/server/petstore/flaskConnexion/openapi_server/models/category.py b/samples/server/petstore/flaskConnexion/openapi_server/models/category.py index 5f4ecd5c8ac..65ec5bd3886 100644 --- a/samples/server/petstore/flaskConnexion/openapi_server/models/category.py +++ b/samples/server/petstore/flaskConnexion/openapi_server/models/category.py @@ -15,7 +15,7 @@ class Category(Model): Do not edit the class manually. """ - def __init__(self, id: int=None, name: str=None): # noqa: E501 + def __init__(self, id=None, name=None): # noqa: E501 """Category - a model defined in OpenAPI :param id: The id of this Category. # noqa: E501 @@ -24,8 +24,8 @@ class Category(Model): :type name: str """ self.openapi_types = { - 'id': int, - 'name': str + 'id': 'int', + 'name': 'str' } self.attribute_map = { @@ -48,7 +48,7 @@ class Category(Model): return util.deserialize_model(dikt, cls) @property - def id(self) -> int: + def id(self): """Gets the id of this Category. @@ -58,7 +58,7 @@ class Category(Model): return self._id @id.setter - def id(self, id: int): + def id(self, id): """Sets the id of this Category. @@ -69,7 +69,7 @@ class Category(Model): self._id = id @property - def name(self) -> str: + def name(self): """Gets the name of this Category. @@ -79,7 +79,7 @@ class Category(Model): return self._name @name.setter - def name(self, name: str): + def name(self, name): """Sets the name of this Category. diff --git a/samples/server/petstore/flaskConnexion/openapi_server/models/order.py b/samples/server/petstore/flaskConnexion/openapi_server/models/order.py index b0587cbe685..b0bbdd9d503 100644 --- a/samples/server/petstore/flaskConnexion/openapi_server/models/order.py +++ b/samples/server/petstore/flaskConnexion/openapi_server/models/order.py @@ -15,7 +15,7 @@ class Order(Model): Do not edit the class manually. """ - def __init__(self, id: int=None, pet_id: int=None, quantity: int=None, ship_date: datetime=None, status: str=None, complete: bool=False): # noqa: E501 + def __init__(self, id=None, pet_id=None, quantity=None, ship_date=None, status=None, complete=False): # noqa: E501 """Order - a model defined in OpenAPI :param id: The id of this Order. # noqa: E501 @@ -32,12 +32,12 @@ class Order(Model): :type complete: bool """ self.openapi_types = { - 'id': int, - 'pet_id': int, - 'quantity': int, - 'ship_date': datetime, - 'status': str, - 'complete': bool + 'id': 'int', + 'pet_id': 'int', + 'quantity': 'int', + 'ship_date': 'datetime', + 'status': 'str', + 'complete': 'bool' } self.attribute_map = { @@ -68,7 +68,7 @@ class Order(Model): return util.deserialize_model(dikt, cls) @property - def id(self) -> int: + def id(self): """Gets the id of this Order. @@ -78,7 +78,7 @@ class Order(Model): return self._id @id.setter - def id(self, id: int): + def id(self, id): """Sets the id of this Order. @@ -89,7 +89,7 @@ class Order(Model): self._id = id @property - def pet_id(self) -> int: + def pet_id(self): """Gets the pet_id of this Order. @@ -99,7 +99,7 @@ class Order(Model): return self._pet_id @pet_id.setter - def pet_id(self, pet_id: int): + def pet_id(self, pet_id): """Sets the pet_id of this Order. @@ -110,7 +110,7 @@ class Order(Model): self._pet_id = pet_id @property - def quantity(self) -> int: + def quantity(self): """Gets the quantity of this Order. @@ -120,7 +120,7 @@ class Order(Model): return self._quantity @quantity.setter - def quantity(self, quantity: int): + def quantity(self, quantity): """Sets the quantity of this Order. @@ -131,7 +131,7 @@ class Order(Model): self._quantity = quantity @property - def ship_date(self) -> datetime: + def ship_date(self): """Gets the ship_date of this Order. @@ -141,7 +141,7 @@ class Order(Model): return self._ship_date @ship_date.setter - def ship_date(self, ship_date: datetime): + def ship_date(self, ship_date): """Sets the ship_date of this Order. @@ -152,7 +152,7 @@ class Order(Model): self._ship_date = ship_date @property - def status(self) -> str: + def status(self): """Gets the status of this Order. Order Status # noqa: E501 @@ -163,7 +163,7 @@ class Order(Model): return self._status @status.setter - def status(self, status: str): + def status(self, status): """Sets the status of this Order. Order Status # noqa: E501 @@ -181,7 +181,7 @@ class Order(Model): self._status = status @property - def complete(self) -> bool: + def complete(self): """Gets the complete of this Order. @@ -191,7 +191,7 @@ class Order(Model): return self._complete @complete.setter - def complete(self, complete: bool): + def complete(self, complete): """Sets the complete of this Order. diff --git a/samples/server/petstore/flaskConnexion/openapi_server/models/pet.py b/samples/server/petstore/flaskConnexion/openapi_server/models/pet.py index 7557b576150..7b384ad983f 100644 --- a/samples/server/petstore/flaskConnexion/openapi_server/models/pet.py +++ b/samples/server/petstore/flaskConnexion/openapi_server/models/pet.py @@ -6,8 +6,6 @@ from datetime import date, datetime # noqa: F401 from typing import List, Dict # noqa: F401 from openapi_server.models.base_model_ import Model -from openapi_server.models.category import Category # noqa: F401,E501 -from openapi_server.models.tag import Tag # noqa: F401,E501 from openapi_server import util @@ -17,7 +15,7 @@ class Pet(Model): Do not edit the class manually. """ - def __init__(self, id: int=None, category: Category=None, name: str=None, photo_urls: List[str]=None, tags: List[Tag]=None, status: str=None): # noqa: E501 + def __init__(self, id=None, category=None, name=None, photo_urls=None, tags=None, status=None): # noqa: E501 """Pet - a model defined in OpenAPI :param id: The id of this Pet. # noqa: E501 @@ -34,12 +32,12 @@ class Pet(Model): :type status: str """ self.openapi_types = { - 'id': int, - 'category': Category, - 'name': str, - 'photo_urls': List[str], - 'tags': List[Tag], - 'status': str + 'id': 'int', + 'category': 'Category', + 'name': 'str', + 'photo_urls': 'List[str]', + 'tags': 'List[Tag]', + 'status': 'str' } self.attribute_map = { @@ -70,7 +68,7 @@ class Pet(Model): return util.deserialize_model(dikt, cls) @property - def id(self) -> int: + def id(self): """Gets the id of this Pet. @@ -80,7 +78,7 @@ class Pet(Model): return self._id @id.setter - def id(self, id: int): + def id(self, id): """Sets the id of this Pet. @@ -91,7 +89,7 @@ class Pet(Model): self._id = id @property - def category(self) -> Category: + def category(self): """Gets the category of this Pet. @@ -101,7 +99,7 @@ class Pet(Model): return self._category @category.setter - def category(self, category: Category): + def category(self, category): """Sets the category of this Pet. @@ -112,7 +110,7 @@ class Pet(Model): self._category = category @property - def name(self) -> str: + def name(self): """Gets the name of this Pet. @@ -122,7 +120,7 @@ class Pet(Model): return self._name @name.setter - def name(self, name: str): + def name(self, name): """Sets the name of this Pet. @@ -135,7 +133,7 @@ class Pet(Model): self._name = name @property - def photo_urls(self) -> List[str]: + def photo_urls(self): """Gets the photo_urls of this Pet. @@ -145,7 +143,7 @@ class Pet(Model): return self._photo_urls @photo_urls.setter - def photo_urls(self, photo_urls: List[str]): + def photo_urls(self, photo_urls): """Sets the photo_urls of this Pet. @@ -158,7 +156,7 @@ class Pet(Model): self._photo_urls = photo_urls @property - def tags(self) -> List[Tag]: + def tags(self): """Gets the tags of this Pet. @@ -168,7 +166,7 @@ class Pet(Model): return self._tags @tags.setter - def tags(self, tags: List[Tag]): + def tags(self, tags): """Sets the tags of this Pet. @@ -179,7 +177,7 @@ class Pet(Model): self._tags = tags @property - def status(self) -> str: + def status(self): """Gets the status of this Pet. pet status in the store # noqa: E501 @@ -190,7 +188,7 @@ class Pet(Model): return self._status @status.setter - def status(self, status: str): + def status(self, status): """Sets the status of this Pet. pet status in the store # noqa: E501 diff --git a/samples/server/petstore/flaskConnexion/openapi_server/models/tag.py b/samples/server/petstore/flaskConnexion/openapi_server/models/tag.py index dbf79c3a2af..06063ede934 100644 --- a/samples/server/petstore/flaskConnexion/openapi_server/models/tag.py +++ b/samples/server/petstore/flaskConnexion/openapi_server/models/tag.py @@ -15,7 +15,7 @@ class Tag(Model): Do not edit the class manually. """ - def __init__(self, id: int=None, name: str=None): # noqa: E501 + def __init__(self, id=None, name=None): # noqa: E501 """Tag - a model defined in OpenAPI :param id: The id of this Tag. # noqa: E501 @@ -24,8 +24,8 @@ class Tag(Model): :type name: str """ self.openapi_types = { - 'id': int, - 'name': str + 'id': 'int', + 'name': 'str' } self.attribute_map = { @@ -48,7 +48,7 @@ class Tag(Model): return util.deserialize_model(dikt, cls) @property - def id(self) -> int: + def id(self): """Gets the id of this Tag. @@ -58,7 +58,7 @@ class Tag(Model): return self._id @id.setter - def id(self, id: int): + def id(self, id): """Sets the id of this Tag. @@ -69,7 +69,7 @@ class Tag(Model): self._id = id @property - def name(self) -> str: + def name(self): """Gets the name of this Tag. @@ -79,7 +79,7 @@ class Tag(Model): return self._name @name.setter - def name(self, name: str): + def name(self, name): """Sets the name of this Tag. diff --git a/samples/server/petstore/flaskConnexion/openapi_server/models/user.py b/samples/server/petstore/flaskConnexion/openapi_server/models/user.py index 048551da85c..59b3c6a50b8 100644 --- a/samples/server/petstore/flaskConnexion/openapi_server/models/user.py +++ b/samples/server/petstore/flaskConnexion/openapi_server/models/user.py @@ -15,7 +15,7 @@ class User(Model): Do not edit the class manually. """ - def __init__(self, id: int=None, username: str=None, first_name: str=None, last_name: str=None, email: str=None, password: str=None, phone: str=None, user_status: int=None): # noqa: E501 + def __init__(self, id=None, username=None, first_name=None, last_name=None, email=None, password=None, phone=None, user_status=None): # noqa: E501 """User - a model defined in OpenAPI :param id: The id of this User. # noqa: E501 @@ -36,14 +36,14 @@ class User(Model): :type user_status: int """ self.openapi_types = { - 'id': int, - 'username': str, - 'first_name': str, - 'last_name': str, - 'email': str, - 'password': str, - 'phone': str, - 'user_status': int + 'id': 'int', + 'username': 'str', + 'first_name': 'str', + 'last_name': 'str', + 'email': 'str', + 'password': 'str', + 'phone': 'str', + 'user_status': 'int' } self.attribute_map = { @@ -78,7 +78,7 @@ class User(Model): return util.deserialize_model(dikt, cls) @property - def id(self) -> int: + def id(self): """Gets the id of this User. @@ -88,7 +88,7 @@ class User(Model): return self._id @id.setter - def id(self, id: int): + def id(self, id): """Sets the id of this User. @@ -99,7 +99,7 @@ class User(Model): self._id = id @property - def username(self) -> str: + def username(self): """Gets the username of this User. @@ -109,7 +109,7 @@ class User(Model): return self._username @username.setter - def username(self, username: str): + def username(self, username): """Sets the username of this User. @@ -120,7 +120,7 @@ class User(Model): self._username = username @property - def first_name(self) -> str: + def first_name(self): """Gets the first_name of this User. @@ -130,7 +130,7 @@ class User(Model): return self._first_name @first_name.setter - def first_name(self, first_name: str): + def first_name(self, first_name): """Sets the first_name of this User. @@ -141,7 +141,7 @@ class User(Model): self._first_name = first_name @property - def last_name(self) -> str: + def last_name(self): """Gets the last_name of this User. @@ -151,7 +151,7 @@ class User(Model): return self._last_name @last_name.setter - def last_name(self, last_name: str): + def last_name(self, last_name): """Sets the last_name of this User. @@ -162,7 +162,7 @@ class User(Model): self._last_name = last_name @property - def email(self) -> str: + def email(self): """Gets the email of this User. @@ -172,7 +172,7 @@ class User(Model): return self._email @email.setter - def email(self, email: str): + def email(self, email): """Sets the email of this User. @@ -183,7 +183,7 @@ class User(Model): self._email = email @property - def password(self) -> str: + def password(self): """Gets the password of this User. @@ -193,7 +193,7 @@ class User(Model): return self._password @password.setter - def password(self, password: str): + def password(self, password): """Sets the password of this User. @@ -204,7 +204,7 @@ class User(Model): self._password = password @property - def phone(self) -> str: + def phone(self): """Gets the phone of this User. @@ -214,7 +214,7 @@ class User(Model): return self._phone @phone.setter - def phone(self, phone: str): + def phone(self, phone): """Sets the phone of this User. @@ -225,7 +225,7 @@ class User(Model): self._phone = phone @property - def user_status(self) -> int: + def user_status(self): """Gets the user_status of this User. User Status # noqa: E501 @@ -236,7 +236,7 @@ class User(Model): return self._user_status @user_status.setter - def user_status(self, user_status: int): + def user_status(self, user_status): """Sets the user_status of this User. User Status # noqa: E501 diff --git a/samples/server/petstore/flaskConnexion/openapi_server/openapi/openapi.yaml b/samples/server/petstore/flaskConnexion/openapi_server/openapi/openapi.yaml index cc02c545f9a..dca523e5557 100644 --- a/samples/server/petstore/flaskConnexion/openapi_server/openapi/openapi.yaml +++ b/samples/server/petstore/flaskConnexion/openapi_server/openapi/openapi.yaml @@ -1,304 +1,325 @@ -openapi: 3.0.0 +openapi: 3.0.1 info: - title: OpenAPI Petstore description: This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. license: name: Apache-2.0 url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore version: 1.0.0 -externalDocs: - description: Find out more about Swagger - url: http://swagger.io servers: - url: http://petstore.swagger.io/v2 tags: -- name: pet - description: Everything about your Pets -- name: store - description: Access to Petstore orders -- name: user - description: Operations about user +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user paths: /pet: - put: + post: + operationId: add_pet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store tags: - pet - summary: Update an existing pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + put: operationId: update_pet requestBody: - $ref: '#/components/requestBodies/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 responses: 400: + content: {} description: Invalid ID supplied 404: + content: {} description: Pet not found 405: + content: {} description: Validation exception security: - petstore_auth: - write:pets - read:pets - x-openapi-router-controller: openapi_server.controllers.pet_controller - post: + summary: Update an existing pet tags: - pet - summary: Add a new pet to the store - operationId: add_pet - requestBody: - $ref: '#/components/requestBodies/Pet' - responses: - 405: - description: Invalid input - security: - - petstore_auth: - - write:pets - - read:pets x-openapi-router-controller: openapi_server.controllers.pet_controller /pet/findByStatus: get: - tags: - - pet - summary: Finds Pets by status description: Multiple status values can be provided with comma separated strings operationId: find_pets_by_status parameters: - - name: status - in: query - description: Status values that need to be considered for filter - required: true - style: form + - description: Status values that need to be considered for filter explode: false + in: query + name: status + required: true schema: - type: array items: - type: string default: available enum: - available - pending - sold + type: string + type: array + style: form responses: 200: - description: successful operation content: application/xml: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array application/json: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array + description: successful operation 400: + content: {} description: Invalid status value security: - petstore_auth: - write:pets - read:pets + summary: Finds Pets by status + tags: + - pet x-openapi-router-controller: openapi_server.controllers.pet_controller /pet/findByTags: get: - tags: - - pet - summary: Finds Pets by tags + deprecated: true description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. operationId: find_pets_by_tags parameters: - - name: tags - in: query - description: Tags to filter by - required: true - style: form + - description: Tags to filter by explode: false + in: query + name: tags + required: true schema: - type: array items: type: string + type: array + style: form responses: 200: - description: successful operation content: application/xml: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array application/json: schema: - type: array items: $ref: '#/components/schemas/Pet' + type: array + description: successful operation 400: + content: {} description: Invalid tag value - deprecated: true security: - petstore_auth: - write:pets - read:pets + summary: Finds Pets by tags + tags: + - pet x-openapi-router-controller: openapi_server.controllers.pet_controller /pet/{petId}: - get: - tags: - - pet - summary: Find pet by ID - description: Returns a single pet - operationId: get_pet_by_id - parameters: - - name: petId - in: path - description: ID of pet to return - required: true - style: simple - explode: false - 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: [] - x-openapi-router-controller: openapi_server.controllers.pet_controller - post: - tags: - - pet - summary: Updates a pet in the store with form data - operationId: update_pet_with_form - parameters: - - name: petId - in: path - description: ID of pet that needs to be updated - required: true - style: simple - explode: false - schema: - type: integer - format: int64 - requestBody: - content: - application/x-www-form-urlencoded: - schema: - $ref: '#/components/schemas/body' - responses: - 405: - description: Invalid input - security: - - petstore_auth: - - write:pets - - read:pets - x-openapi-router-controller: openapi_server.controllers.pet_controller delete: - tags: - - pet - summary: Deletes a pet operationId: delete_pet parameters: - - name: api_key - in: header - required: false - style: simple - explode: false + - in: header + name: api_key schema: type: string - - name: petId + - description: Pet id to delete in: path - description: Pet id to delete + name: petId required: true - style: simple - explode: false schema: - type: integer format: int64 + type: integer responses: 400: + content: {} description: Invalid pet value security: - petstore_auth: - write:pets - read:pets - x-openapi-router-controller: openapi_server.controllers.pet_controller - /pet/{petId}/uploadImage: - post: + summary: Deletes a pet tags: - pet - summary: uploads an image - operationId: upload_file + x-openapi-router-controller: openapi_server.controllers.pet_controller + get: + description: Returns a single pet + operationId: get_pet_by_id parameters: - - name: petId + - description: ID of pet to return in: path - description: ID of pet to update + name: petId required: true - style: simple - explode: false schema: - type: integer format: int64 - requestBody: - content: - multipart/form-data: - schema: - $ref: '#/components/schemas/body_1' + type: integer responses: 200: - description: successful operation content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' application/json: schema: - $ref: '#/components/schemas/ApiResponse' + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + post: + operationId: update_pet_with_form + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + 405: + content: {} + description: Invalid input security: - petstore_auth: - write:pets - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + x-openapi-router-controller: openapi_server.controllers.pet_controller + /pet/{petId}/uploadImage: + post: + operationId: upload_file + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet x-openapi-router-controller: openapi_server.controllers.pet_controller /store/inventory: get: - tags: - - store - summary: Returns pet inventories by status description: Returns a map of status codes to quantities operationId: get_inventory responses: 200: - description: successful operation content: application/json: schema: - type: object additionalProperties: - type: integer format: int32 + type: integer + type: object + description: successful operation security: - api_key: [] + summary: Returns pet inventories by status + tags: + - store x-openapi-router-controller: openapi_server.controllers.store_controller /store/order: post: - tags: - - store - summary: Place an order for a pet operationId: place_order requestBody: - description: order placed for purchasing the pet content: - application/json: + '*/*': schema: $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet required: true responses: 200: - description: successful operation content: application/xml: schema: @@ -306,185 +327,216 @@ paths: application/json: schema: $ref: '#/components/schemas/Order' + description: successful operation 400: + content: {} description: Invalid Order + summary: Place an order for a pet + tags: + - store x-openapi-router-controller: openapi_server.controllers.store_controller /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: get_order_by_id - parameters: - - name: orderId - in: path - description: ID of pet that needs to be fetched - required: true - style: simple - explode: false - schema: - maximum: 5 - minimum: 1 - type: integer - format: int64 - 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 - x-openapi-router-controller: openapi_server.controllers.store_controller 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: delete_order parameters: - - name: orderId + - description: ID of the order that needs to be deleted in: path - description: ID of the order that needs to be deleted + name: orderId required: true - style: simple - explode: false schema: type: string responses: 400: + content: {} description: Invalid ID supplied 404: + content: {} description: Order not found + summary: Delete purchase order by ID + tags: + - store + x-openapi-router-controller: openapi_server.controllers.store_controller + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: get_order_by_id + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store x-openapi-router-controller: openapi_server.controllers.store_controller /user: post: - tags: - - user - summary: Create user description: This can only be done by the logged in user. operationId: create_user requestBody: - description: Created user object content: - application/json: + '*/*': schema: $ref: '#/components/schemas/User' + description: Created user object required: true responses: default: + content: {} description: successful operation + summary: Create user + tags: + - user x-openapi-router-controller: openapi_server.controllers.user_controller /user/createWithArray: post: - tags: - - user - summary: Creates list of users with given input array operationId: create_users_with_array_input requestBody: - $ref: '#/components/requestBodies/UserArray' + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true responses: default: + content: {} description: successful operation + summary: Creates list of users with given input array + tags: + - user x-openapi-router-controller: openapi_server.controllers.user_controller /user/createWithList: post: - tags: - - user - summary: Creates list of users with given input array operationId: create_users_with_list_input requestBody: - $ref: '#/components/requestBodies/UserArray' + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true responses: default: + content: {} description: successful operation + summary: Creates list of users with given input array + tags: + - user x-openapi-router-controller: openapi_server.controllers.user_controller /user/login: get: - tags: - - user - summary: Logs user into the system operationId: login_user parameters: - - name: username + - description: The user name for login in: query - description: The user name for login + name: username required: true - style: form - explode: true schema: type: string - - name: password + - description: The password for login in clear text in: query - description: The password for login in clear text + name: password required: true - style: form - explode: true schema: type: string responses: 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string description: successful operation headers: X-Rate-Limit: description: calls per hour allowed by the user - style: simple - explode: false schema: - type: integer format: int32 + type: integer X-Expires-After: description: date in UTC when toekn expires - style: simple - explode: false schema: - type: string format: date-time - content: - application/xml: - schema: - type: string - application/json: - schema: type: string 400: + content: {} description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user x-openapi-router-controller: openapi_server.controllers.user_controller /user/logout: get: - tags: - - user - summary: Logs out current logged in user session operationId: logout_user responses: default: + content: {} description: successful operation - x-openapi-router-controller: openapi_server.controllers.user_controller - /user/{username}: - get: + summary: Logs out current logged in user session tags: - user - summary: Get user by user name + x-openapi-router-controller: openapi_server.controllers.user_controller + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: delete_user + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Delete user + tags: + - user + x-openapi-router-controller: openapi_server.controllers.user_controller + get: operationId: get_user_by_name parameters: - - name: username + - description: The name that needs to be fetched. Use user1 for testing. in: path - description: The name that needs to be fetched. Use user1 for testing. + name: username required: true - style: simple - explode: false schema: type: string responses: 200: - description: successful operation content: application/xml: schema: @@ -492,88 +544,48 @@ paths: application/json: schema: $ref: '#/components/schemas/User' + description: successful operation 400: + content: {} description: Invalid username supplied 404: + content: {} description: User not found - x-openapi-router-controller: openapi_server.controllers.user_controller - put: + summary: Get user by user name tags: - user - summary: Updated user + x-openapi-router-controller: openapi_server.controllers.user_controller + put: description: This can only be done by the logged in user. operationId: update_user parameters: - - name: username + - description: name that need to be deleted in: path - description: name that need to be deleted + name: username required: true - style: simple - explode: false schema: type: string requestBody: - description: Updated user object content: - application/json: + '*/*': schema: $ref: '#/components/schemas/User' + description: Updated user object required: true responses: 400: + content: {} description: Invalid user supplied 404: + content: {} description: User not found - x-openapi-router-controller: openapi_server.controllers.user_controller - delete: + summary: Updated user tags: - user - summary: Delete user - description: This can only be done by the logged in user. - operationId: delete_user - parameters: - - name: username - in: path - description: The name that needs to be deleted - required: true - style: simple - explode: false - schema: - type: string - responses: - 400: - description: Invalid username supplied - 404: - description: User not found x-openapi-router-controller: openapi_server.controllers.user_controller components: schemas: Order: - title: Pet Order - type: object - properties: - id: - type: integer - format: int64 - petId: - type: integer - format: int64 - quantity: - type: integer - format: int32 - shipDate: - type: string - format: date-time - status: - type: string - description: Order Status - enum: - - placed - - approved - - delivered - complete: - type: boolean - default: false description: An order for a pets from the pet store example: petId: 6 @@ -582,30 +594,63 @@ components: shipDate: 2000-01-23T04:56:07.000+00:00 complete: false status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object xml: name: Order Category: - title: Pet category - type: object - properties: - id: - type: integer - format: int64 - name: - type: string description: A category for a pet example: name: name id: 6 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet category + type: object xml: name: Category User: - title: a User - type: object + description: A User who is purchasing from the pet store + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username properties: id: - type: integer format: int64 + type: integer username: type: string firstName: @@ -619,72 +664,29 @@ components: phone: type: string userStatus: - type: integer description: User Status format: int32 - description: A User who is purchasing from the pet store - example: - firstName: firstName - lastName: lastName - password: password - userStatus: 6 - phone: phone - id: 0 - email: email - username: username + type: integer + title: a User + type: object xml: name: User Tag: - title: Pet Tag - type: object - properties: - id: - type: integer - format: int64 - name: - type: string description: A tag for a pet example: name: name id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object xml: name: Tag Pet: - title: a Pet - required: - - name - - photoUrls - type: object - properties: - id: - type: integer - format: int64 - category: - $ref: '#/components/schemas/Category' - name: - type: string - example: doggie - photoUrls: - type: array - xml: - name: photoUrl - wrapped: true - items: - type: string - tags: - type: array - xml: - name: tag - wrapped: true - items: - $ref: '#/components/schemas/Tag' - status: - type: string - description: pet status in the store - enum: - - available - - pending - - sold description: A pet for sale in the pet store example: photoUrls: @@ -701,73 +703,69 @@ components: - name: name id: 1 status: available + properties: + id: + format: int64 + type: integer + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object xml: name: Pet ApiResponse: - title: An uploaded response - type: object - properties: - code: - type: integer - format: int32 - type: - type: string - message: - type: string description: Describes the result of uploading an image resource example: code: 0 type: type message: message - body: - type: object properties: - name: + code: + format: int32 + type: integer + type: type: string - description: Updated name of the pet - status: + message: type: string - description: Updated status of the pet - body_1: + title: An uploaded response type: object - properties: - additionalMetadata: - type: string - description: Additional data to pass to server - file: - type: string - description: file to upload - format: binary - requestBodies: - UserArray: - description: List of user object - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/User' - required: true - Pet: - description: Pet object that needs to be added to the store - content: - application/json: - schema: - $ref: '#/components/schemas/Pet' - application/xml: - schema: - $ref: '#/components/schemas/Pet' - required: true securitySchemes: petstore_auth: - type: oauth2 flows: implicit: authorizationUrl: http://petstore.swagger.io/api/oauth/dialog scopes: write:pets: modify pets in your account read:pets: read your pets + type: oauth2 api_key: - type: apiKey - name: api_key in: header + name: api_key + type: apiKey diff --git a/samples/server/petstore/flaskConnexion/openapi_server/util.py b/samples/server/petstore/flaskConnexion/openapi_server/util.py index 4321570d5a0..c7340cd0005 100644 --- a/samples/server/petstore/flaskConnexion/openapi_server/util.py +++ b/samples/server/petstore/flaskConnexion/openapi_server/util.py @@ -51,7 +51,7 @@ def _deserialize_primitive(data, klass): def _deserialize_object(value): - """Return a original value. + """Return an original value. :return: object. """ diff --git a/samples/server/petstore/flaskConnexion/requirements.txt b/samples/server/petstore/flaskConnexion/requirements.txt index 1cf2462510b..0e74fd81c3e 100644 --- a/samples/server/petstore/flaskConnexion/requirements.txt +++ b/samples/server/petstore/flaskConnexion/requirements.txt @@ -1,3 +1,4 @@ -connexion == 1.1.15 +connexion == 2.0.0rc3 +swagger-ui-bundle == 0.0.2 python_dateutil == 2.6.0 setuptools >= 21.0.0 diff --git a/samples/server/petstore/go-api-server/.openapi-generator/VERSION b/samples/server/petstore/go-api-server/.openapi-generator/VERSION index 82602aa4190..6d94c9c2e12 100644 --- a/samples/server/petstore/go-api-server/.openapi-generator/VERSION +++ b/samples/server/petstore/go-api-server/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.3-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/go-api-server/go/model_api_response.go b/samples/server/petstore/go-api-server/go/model_api_response.go index 2379e169080..d2cbaed56b4 100644 --- a/samples/server/petstore/go-api-server/go/model_api_response.go +++ b/samples/server/petstore/go-api-server/go/model_api_response.go @@ -11,7 +11,6 @@ package petstoreserver // ApiResponse - Describes the result of uploading an image resource type ApiResponse struct { - Code int32 `json:"code,omitempty"` Type string `json:"type,omitempty"` diff --git a/samples/server/petstore/go-api-server/go/model_category.go b/samples/server/petstore/go-api-server/go/model_category.go index 5e6f9d247fa..4f7ca371b42 100644 --- a/samples/server/petstore/go-api-server/go/model_category.go +++ b/samples/server/petstore/go-api-server/go/model_category.go @@ -11,7 +11,6 @@ package petstoreserver // Category - A category for a pet type Category struct { - Id int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` diff --git a/samples/server/petstore/go-api-server/go/model_order.go b/samples/server/petstore/go-api-server/go/model_order.go index a9d8dbb7957..45c20b64543 100644 --- a/samples/server/petstore/go-api-server/go/model_order.go +++ b/samples/server/petstore/go-api-server/go/model_order.go @@ -15,7 +15,6 @@ import ( // Order - An order for a pets from the pet store type Order struct { - Id int64 `json:"id,omitempty"` PetId int64 `json:"petId,omitempty"` diff --git a/samples/server/petstore/go-api-server/go/model_pet.go b/samples/server/petstore/go-api-server/go/model_pet.go index ff09e500be5..a085e97ab58 100644 --- a/samples/server/petstore/go-api-server/go/model_pet.go +++ b/samples/server/petstore/go-api-server/go/model_pet.go @@ -11,7 +11,6 @@ package petstoreserver // Pet - A pet for sale in the pet store type Pet struct { - Id int64 `json:"id,omitempty"` Category *Category `json:"category,omitempty"` diff --git a/samples/server/petstore/go-api-server/go/model_tag.go b/samples/server/petstore/go-api-server/go/model_tag.go index 2fb07fb32c4..1fd6437e34b 100644 --- a/samples/server/petstore/go-api-server/go/model_tag.go +++ b/samples/server/petstore/go-api-server/go/model_tag.go @@ -11,7 +11,6 @@ package petstoreserver // Tag - A tag for a pet type Tag struct { - Id int64 `json:"id,omitempty"` Name string `json:"name,omitempty"` diff --git a/samples/server/petstore/go-api-server/go/model_user.go b/samples/server/petstore/go-api-server/go/model_user.go index 8f40d0ac04c..304d910ec64 100644 --- a/samples/server/petstore/go-api-server/go/model_user.go +++ b/samples/server/petstore/go-api-server/go/model_user.go @@ -11,7 +11,6 @@ package petstoreserver // User - A User who is purchasing from the pet store type User struct { - Id int64 `json:"id,omitempty"` Username string `json:"username,omitempty"` diff --git a/samples/server/petstore/go-gin-api-server/.openapi-generator-ignore b/samples/server/petstore/go-gin-api-server/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/.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/go-gin-api-server/.openapi-generator/VERSION b/samples/server/petstore/go-gin-api-server/.openapi-generator/VERSION new file mode 100644 index 00000000000..afa63656064 --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/go-gin-api-server/Dockerfile b/samples/server/petstore/go-gin-api-server/Dockerfile new file mode 100644 index 00000000000..cfdfbaed080 --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/Dockerfile @@ -0,0 +1,14 @@ +FROM golang:1.10 AS build +WORKDIR /go/src +COPY go ./go +COPY main.go . + +ENV CGO_ENABLED=0 +RUN go get -d -v ./... + +RUN go build -a -installsuffix cgo -o petstoreserver . + +FROM scratch AS runtime +COPY --from=build /go/src/petstoreserver ./ +EXPOSE 8080/tcp +ENTRYPOINT ["./petstoreserver"] diff --git a/samples/server/petstore/go-gin-api-server/api/openapi.yaml b/samples/server/petstore/go-gin-api-server/api/openapi.yaml new file mode 100644 index 00000000000..c0b60f85dde --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/api/openapi.yaml @@ -0,0 +1,751 @@ +openapi: 3.0.1 +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. + license: + name: Apache-2.0 + url: http://www.apache.org/licenses/LICENSE-2.0.html + title: OpenAPI Petstore + version: 1.0.0 +servers: +- url: http://petstore.swagger.io/v2 +tags: +- description: Everything about your Pets + name: pet +- description: Access to Petstore orders + name: store +- description: Operations about user + name: user +paths: + /pet: + post: + operationId: addPet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Add a new pet to the store + tags: + - pet + put: + operationId: updatePet + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/Pet' + application/xml: + schema: + $ref: '#/components/schemas/Pet' + description: Pet object that needs to be added to the store + required: true + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + 405: + content: {} + description: Validation exception + security: + - petstore_auth: + - write:pets + - read:pets + summary: Update an existing pet + tags: + - pet + /pet/findByStatus: + get: + description: Multiple status values can be provided with comma separated strings + operationId: findPetsByStatus + parameters: + - description: Status values that need to be considered for filter + explode: false + in: query + name: status + required: true + schema: + items: + default: available + enum: + - available + - pending + - sold + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid status value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by status + tags: + - pet + /pet/findByTags: + get: + deprecated: true + description: Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. + operationId: findPetsByTags + parameters: + - description: Tags to filter by + explode: false + in: query + name: tags + required: true + schema: + items: + type: string + type: array + style: form + responses: + 200: + content: + application/xml: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + application/json: + schema: + items: + $ref: '#/components/schemas/Pet' + type: array + description: successful operation + 400: + content: {} + description: Invalid tag value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Finds Pets by tags + tags: + - pet + /pet/{petId}: + delete: + operationId: deletePet + parameters: + - in: header + name: api_key + schema: + type: string + - description: Pet id to delete + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 400: + content: {} + description: Invalid pet value + security: + - petstore_auth: + - write:pets + - read:pets + summary: Deletes a pet + tags: + - pet + get: + description: Returns a single pet + operationId: getPetById + parameters: + - description: ID of pet to return + in: path + name: petId + required: true + schema: + format: int64 + type: integer + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Pet' + application/json: + schema: + $ref: '#/components/schemas/Pet' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Pet not found + security: + - api_key: [] + summary: Find pet by ID + tags: + - pet + post: + operationId: updatePetWithForm + parameters: + - description: ID of pet that needs to be updated + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + application/x-www-form-urlencoded: + schema: + properties: + name: + description: Updated name of the pet + type: string + status: + description: Updated status of the pet + type: string + responses: + 405: + content: {} + description: Invalid input + security: + - petstore_auth: + - write:pets + - read:pets + summary: Updates a pet in the store with form data + tags: + - pet + /pet/{petId}/uploadImage: + post: + operationId: uploadFile + parameters: + - description: ID of pet to update + in: path + name: petId + required: true + schema: + format: int64 + type: integer + requestBody: + content: + multipart/form-data: + schema: + properties: + additionalMetadata: + description: Additional data to pass to server + type: string + file: + description: file to upload + format: binary + type: string + responses: + 200: + content: + application/json: + schema: + $ref: '#/components/schemas/ApiResponse' + description: successful operation + security: + - petstore_auth: + - write:pets + - read:pets + summary: uploads an image + tags: + - pet + /store/inventory: + get: + description: Returns a map of status codes to quantities + operationId: getInventory + responses: + 200: + content: + application/json: + schema: + additionalProperties: + format: int32 + type: integer + type: object + description: successful operation + security: + - api_key: [] + summary: Returns pet inventories by status + tags: + - store + /store/order: + post: + operationId: placeOrder + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/Order' + description: order placed for purchasing the pet + required: true + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid Order + summary: Place an order for a pet + tags: + - store + /store/order/{orderId}: + delete: + description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors + operationId: deleteOrder + parameters: + - description: ID of the order that needs to be deleted + in: path + name: orderId + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Delete purchase order by ID + tags: + - store + get: + description: For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions + operationId: getOrderById + parameters: + - description: ID of pet that needs to be fetched + in: path + name: orderId + required: true + schema: + format: int64 + maximum: 5 + minimum: 1 + type: integer + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/Order' + application/json: + schema: + $ref: '#/components/schemas/Order' + description: successful operation + 400: + content: {} + description: Invalid ID supplied + 404: + content: {} + description: Order not found + summary: Find purchase order by ID + tags: + - store + /user: + post: + description: This can only be done by the logged in user. + operationId: createUser + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Created user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Create user + tags: + - user + /user/createWithArray: + post: + operationId: createUsersWithArrayInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/createWithList: + post: + operationId: createUsersWithListInput + requestBody: + content: + '*/*': + schema: + items: + $ref: '#/components/schemas/User' + type: array + description: List of user object + required: true + responses: + default: + content: {} + description: successful operation + summary: Creates list of users with given input array + tags: + - user + /user/login: + get: + operationId: loginUser + parameters: + - description: The user name for login + in: query + name: username + required: true + schema: + type: string + - description: The password for login in clear text + in: query + name: password + required: true + schema: + type: string + responses: + 200: + content: + application/xml: + schema: + type: string + application/json: + schema: + type: string + description: successful operation + headers: + X-Rate-Limit: + description: calls per hour allowed by the user + schema: + format: int32 + type: integer + X-Expires-After: + description: date in UTC when toekn expires + schema: + format: date-time + type: string + 400: + content: {} + description: Invalid username/password supplied + summary: Logs user into the system + tags: + - user + /user/logout: + get: + operationId: logoutUser + responses: + default: + content: {} + description: successful operation + summary: Logs out current logged in user session + tags: + - user + /user/{username}: + delete: + description: This can only be done by the logged in user. + operationId: deleteUser + parameters: + - description: The name that needs to be deleted + in: path + name: username + required: true + schema: + type: string + responses: + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Delete user + tags: + - user + get: + operationId: getUserByName + parameters: + - description: The name that needs to be fetched. Use user1 for testing. + in: path + name: username + required: true + schema: + type: string + responses: + 200: + content: + application/xml: + schema: + $ref: '#/components/schemas/User' + application/json: + schema: + $ref: '#/components/schemas/User' + description: successful operation + 400: + content: {} + description: Invalid username supplied + 404: + content: {} + description: User not found + summary: Get user by user name + tags: + - user + put: + description: This can only be done by the logged in user. + operationId: updateUser + parameters: + - description: name that need to be deleted + in: path + name: username + required: true + schema: + type: string + requestBody: + content: + '*/*': + schema: + $ref: '#/components/schemas/User' + description: Updated user object + required: true + responses: + 400: + content: {} + description: Invalid user supplied + 404: + content: {} + description: User not found + summary: Updated user + tags: + - user +components: + schemas: + Order: + description: An order for a pets from the pet store + example: + petId: 6 + quantity: 1 + id: 0 + shipDate: 2000-01-23T04:56:07.000+00:00 + complete: false + status: placed + properties: + id: + format: int64 + type: integer + petId: + format: int64 + type: integer + quantity: + format: int32 + type: integer + shipDate: + format: date-time + type: string + status: + description: Order Status + enum: + - placed + - approved + - delivered + type: string + complete: + default: false + type: boolean + title: Pet Order + type: object + xml: + name: Order + Category: + description: A category for a pet + example: + name: name + id: 6 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet category + type: object + xml: + name: Category + User: + description: A User who is purchasing from the pet store + example: + firstName: firstName + lastName: lastName + password: password + userStatus: 6 + phone: phone + id: 0 + email: email + username: username + properties: + id: + format: int64 + type: integer + username: + type: string + firstName: + type: string + lastName: + type: string + email: + type: string + password: + type: string + phone: + type: string + userStatus: + description: User Status + format: int32 + type: integer + title: a User + type: object + xml: + name: User + Tag: + description: A tag for a pet + example: + name: name + id: 1 + properties: + id: + format: int64 + type: integer + name: + type: string + title: Pet Tag + type: object + xml: + name: Tag + Pet: + description: A pet for sale in the pet store + example: + photoUrls: + - photoUrls + - photoUrls + name: doggie + id: 0 + category: + name: name + id: 6 + tags: + - name: name + id: 1 + - name: name + id: 1 + status: available + properties: + id: + format: int64 + type: integer + category: + $ref: '#/components/schemas/Category' + name: + example: doggie + type: string + photoUrls: + items: + type: string + type: array + xml: + name: photoUrl + wrapped: true + tags: + items: + $ref: '#/components/schemas/Tag' + type: array + xml: + name: tag + wrapped: true + status: + description: pet status in the store + enum: + - available + - pending + - sold + type: string + required: + - name + - photoUrls + title: a Pet + type: object + xml: + name: Pet + ApiResponse: + description: Describes the result of uploading an image resource + example: + code: 0 + type: type + message: message + properties: + code: + format: int32 + type: integer + type: + type: string + message: + type: string + title: An uploaded response + type: object + securitySchemes: + petstore_auth: + flows: + implicit: + authorizationUrl: http://petstore.swagger.io/api/oauth/dialog + scopes: + write:pets: modify pets in your account + read:pets: read your pets + type: oauth2 + api_key: + in: header + name: api_key + type: apiKey diff --git a/samples/server/petstore/go-gin-api-server/go/README.md b/samples/server/petstore/go-gin-api-server/go/README.md new file mode 100644 index 00000000000..d29353f16c7 --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/go/README.md @@ -0,0 +1,84 @@ +# Go API Server for petstoreserver + +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 server was generated by the [openapi-generator] +(https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub. +- + +To see how to make this your own, look here: + +[README](https://openapi-generator.tech) + +- API version: 1.0.0 + + +### Running the server +To run the server, follow these simple steps: + +``` +go run main.go +``` + +To run the server in a docker container +``` +docker build --network=host -t petstoreserver . +``` + +Once image is built use +``` +docker run --rm -it petstoreserver +``` + +### Known Issue + +The endpoint `/v2/pet/findByTags` and `/v2/pet/:petId` are conflict with gin. +This is a known issue of gin. Please refer [gin-gonic/gin#388](https://github.com/gin-gonic/gin/issues/388) + +You can manually fix it by updating the path and handler. Please refer [gin-gonic/gin/issues/205#issuecomment-296155497](https://github.com/gin-gonic/gin/issues/205#issuecomment-296155497) and an example below. + + +`routers.go` + +```diff +var routes = Routes{ + { + "Index", + "GET", + "/v2/", + Index, + }, + +- { +- "FindPetsByTags", +- strings.ToUpper("Get"), +- "/v2/pet/findByTags", +- FindPetsByTags, +- }, + + { + "GetPetById", + strings.ToUpper("Get"), + "/v2/pet/:petId", + GetPetById, + }, +} +``` + +`api_pet.go` + +```diff +// GetPetById - Find pet by ID +func GetPetById(c *gin.Context) { +- c.JSON(http.StatusOK, gin.H{}) ++ petId := c.Param("petId") ++ ++ if petId == "findByTags" { ++ FindPetsByTags(c) ++ } else { ++ c.JSON(http.StatusOK, gin.H{}) ++ } +} +``` \ No newline at end of file diff --git a/samples/server/petstore/go-gin-api-server/go/api_pet.go b/samples/server/petstore/go-gin-api-server/go/api_pet.go new file mode 100644 index 00000000000..851a3ef5e88 --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/go/api_pet.go @@ -0,0 +1,56 @@ +/* + * 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. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +// AddPet - Add a new pet to the store +func AddPet(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// DeletePet - Deletes a pet +func DeletePet(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// FindPetsByStatus - Finds Pets by status +func FindPetsByStatus(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// FindPetsByTags - Finds Pets by tags +func FindPetsByTags(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// GetPetById - Find pet by ID +func GetPetById(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// UpdatePet - Update an existing pet +func UpdatePet(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// UpdatePetWithForm - Updates a pet in the store with form data +func UpdatePetWithForm(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// UploadFile - uploads an image +func UploadFile(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} diff --git a/samples/server/petstore/go-gin-api-server/go/api_store.go b/samples/server/petstore/go-gin-api-server/go/api_store.go new file mode 100644 index 00000000000..565a2a2336d --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/go/api_store.go @@ -0,0 +1,36 @@ +/* + * 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. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +// DeleteOrder - Delete purchase order by ID +func DeleteOrder(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// GetInventory - Returns pet inventories by status +func GetInventory(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// GetOrderById - Find purchase order by ID +func GetOrderById(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// PlaceOrder - Place an order for a pet +func PlaceOrder(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} diff --git a/samples/server/petstore/go-gin-api-server/go/api_user.go b/samples/server/petstore/go-gin-api-server/go/api_user.go new file mode 100644 index 00000000000..1e6c5a8ad87 --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/go/api_user.go @@ -0,0 +1,56 @@ +/* + * 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. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" + + "github.com/gin-gonic/gin" +) + +// CreateUser - Create user +func CreateUser(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// CreateUsersWithArrayInput - Creates list of users with given input array +func CreateUsersWithArrayInput(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// CreateUsersWithListInput - Creates list of users with given input array +func CreateUsersWithListInput(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// DeleteUser - Delete user +func DeleteUser(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// GetUserByName - Get user by user name +func GetUserByName(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// LoginUser - Logs user into the system +func LoginUser(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// LogoutUser - Logs out current logged in user session +func LogoutUser(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} + +// UpdateUser - Updated user +func UpdateUser(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{}) +} diff --git a/samples/server/petstore/go-gin-api-server/go/model_api_response.go b/samples/server/petstore/go-gin-api-server/go/model_api_response.go new file mode 100644 index 00000000000..2379e169080 --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/go/model_api_response.go @@ -0,0 +1,20 @@ +/* + * 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. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// ApiResponse - Describes the result of uploading an image resource +type ApiResponse struct { + + Code int32 `json:"code,omitempty"` + + Type string `json:"type,omitempty"` + + Message string `json:"message,omitempty"` +} diff --git a/samples/server/petstore/go-gin-api-server/go/model_category.go b/samples/server/petstore/go-gin-api-server/go/model_category.go new file mode 100644 index 00000000000..5e6f9d247fa --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/go/model_category.go @@ -0,0 +1,18 @@ +/* + * 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. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// Category - A category for a pet +type Category struct { + + Id int64 `json:"id,omitempty"` + + Name string `json:"name,omitempty"` +} diff --git a/samples/server/petstore/go-gin-api-server/go/model_order.go b/samples/server/petstore/go-gin-api-server/go/model_order.go new file mode 100644 index 00000000000..a9d8dbb7957 --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/go/model_order.go @@ -0,0 +1,31 @@ +/* + * 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. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "time" +) + +// Order - An order for a pets from the pet store +type Order struct { + + Id int64 `json:"id,omitempty"` + + PetId int64 `json:"petId,omitempty"` + + Quantity int32 `json:"quantity,omitempty"` + + ShipDate time.Time `json:"shipDate,omitempty"` + + // Order Status + Status string `json:"status,omitempty"` + + Complete bool `json:"complete,omitempty"` +} diff --git a/samples/server/petstore/go-gin-api-server/go/model_pet.go b/samples/server/petstore/go-gin-api-server/go/model_pet.go new file mode 100644 index 00000000000..ff09e500be5 --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/go/model_pet.go @@ -0,0 +1,27 @@ +/* + * 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. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// Pet - A pet for sale in the pet store +type Pet struct { + + Id int64 `json:"id,omitempty"` + + Category *Category `json:"category,omitempty"` + + Name string `json:"name"` + + PhotoUrls []string `json:"photoUrls"` + + Tags []Tag `json:"tags,omitempty"` + + // pet status in the store + Status string `json:"status,omitempty"` +} diff --git a/samples/server/petstore/go-gin-api-server/go/model_tag.go b/samples/server/petstore/go-gin-api-server/go/model_tag.go new file mode 100644 index 00000000000..2fb07fb32c4 --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/go/model_tag.go @@ -0,0 +1,18 @@ +/* + * 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. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// Tag - A tag for a pet +type Tag struct { + + Id int64 `json:"id,omitempty"` + + Name string `json:"name,omitempty"` +} diff --git a/samples/server/petstore/go-gin-api-server/go/model_user.go b/samples/server/petstore/go-gin-api-server/go/model_user.go new file mode 100644 index 00000000000..8f40d0ac04c --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/go/model_user.go @@ -0,0 +1,31 @@ +/* + * 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. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +// User - A User who is purchasing from the pet store +type User struct { + + Id int64 `json:"id,omitempty"` + + Username string `json:"username,omitempty"` + + FirstName string `json:"firstName,omitempty"` + + LastName string `json:"lastName,omitempty"` + + Email string `json:"email,omitempty"` + + Password string `json:"password,omitempty"` + + Phone string `json:"phone,omitempty"` + + // User Status + UserStatus int32 `json:"userStatus,omitempty"` +} diff --git a/samples/server/petstore/go-gin-api-server/go/routers.go b/samples/server/petstore/go-gin-api-server/go/routers.go new file mode 100644 index 00000000000..a36d0b09731 --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/go/routers.go @@ -0,0 +1,205 @@ +/* + * 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. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package petstoreserver + +import ( + "net/http" + "strings" + + "github.com/gin-gonic/gin" +) + +// Route is the information for every URI. +type Route struct { + // Name is the name of this Route. + Name string + // Method is the string for the HTTP method. ex) GET, POST etc.. + Method string + // Pattern is the pattern of the URI. + Pattern string + // HandlerFunc is the handler function of this route. + HandlerFunc gin.HandlerFunc +} + +// Routes is the list of the generated Route. +type Routes []Route + +// NewRouter returns a new router. +func NewRouter() *gin.Engine { + router := gin.Default() + for _, route := range routes { + switch route.Method { + case "GET": + router.GET(route.Pattern, route.HandlerFunc) + case "POST": + router.POST(route.Pattern, route.HandlerFunc) + case "PUT": + router.PUT(route.Pattern, route.HandlerFunc) + case "DELETE": + router.DELETE(route.Pattern, route.HandlerFunc) + } + } + + return router +} + +// Index is the index handler. +func Index(c *gin.Context) { + c.String(http.StatusOK, "Hello World!") +} + +var routes = Routes{ + { + "Index", + "GET", + "/v2/", + Index, + }, + + { + "AddPet", + strings.ToUpper("Post"), + "/v2/pet", + AddPet, + }, + + { + "DeletePet", + strings.ToUpper("Delete"), + "/v2/pet/:petId", + DeletePet, + }, + + { + "FindPetsByStatus", + strings.ToUpper("Get"), + "/v2/pet/findByStatus", + FindPetsByStatus, + }, + + { + "FindPetsByTags", + strings.ToUpper("Get"), + "/v2/pet/findByTags", + FindPetsByTags, + }, + + { + "GetPetById", + strings.ToUpper("Get"), + "/v2/pet/:petId", + GetPetById, + }, + + { + "UpdatePet", + strings.ToUpper("Put"), + "/v2/pet", + UpdatePet, + }, + + { + "UpdatePetWithForm", + strings.ToUpper("Post"), + "/v2/pet/:petId", + UpdatePetWithForm, + }, + + { + "UploadFile", + strings.ToUpper("Post"), + "/v2/pet/:petId/uploadImage", + UploadFile, + }, + + { + "DeleteOrder", + strings.ToUpper("Delete"), + "/v2/store/order/:orderId", + DeleteOrder, + }, + + { + "GetInventory", + strings.ToUpper("Get"), + "/v2/store/inventory", + GetInventory, + }, + + { + "GetOrderById", + strings.ToUpper("Get"), + "/v2/store/order/:orderId", + GetOrderById, + }, + + { + "PlaceOrder", + strings.ToUpper("Post"), + "/v2/store/order", + PlaceOrder, + }, + + { + "CreateUser", + strings.ToUpper("Post"), + "/v2/user", + CreateUser, + }, + + { + "CreateUsersWithArrayInput", + strings.ToUpper("Post"), + "/v2/user/createWithArray", + CreateUsersWithArrayInput, + }, + + { + "CreateUsersWithListInput", + strings.ToUpper("Post"), + "/v2/user/createWithList", + CreateUsersWithListInput, + }, + + { + "DeleteUser", + strings.ToUpper("Delete"), + "/v2/user/:username", + DeleteUser, + }, + + { + "GetUserByName", + strings.ToUpper("Get"), + "/v2/user/:username", + GetUserByName, + }, + + { + "LoginUser", + strings.ToUpper("Get"), + "/v2/user/login", + LoginUser, + }, + + { + "LogoutUser", + strings.ToUpper("Get"), + "/v2/user/logout", + LogoutUser, + }, + + { + "UpdateUser", + strings.ToUpper("Put"), + "/v2/user/:username", + UpdateUser, + }, +} diff --git a/samples/server/petstore/go-gin-api-server/main.go b/samples/server/petstore/go-gin-api-server/main.go new file mode 100644 index 00000000000..b4e76173bfd --- /dev/null +++ b/samples/server/petstore/go-gin-api-server/main.go @@ -0,0 +1,31 @@ +/* + * 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. + * + * API version: 1.0.0 + * Generated by: OpenAPI Generator (https://openapi-generator.tech) + */ + +package main + +import ( + "log" + + // 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" + // + sw "./go" +) + +func main() { + log.Printf("Server started") + + router := sw.NewRouter() + + log.Fatal(router.Run(":8080")) +} diff --git a/samples/server/petstore/haskell-servant/.openapi-generator/VERSION b/samples/server/petstore/haskell-servant/.openapi-generator/VERSION index 096bf47efe3..6d94c9c2e12 100644 --- a/samples/server/petstore/haskell-servant/.openapi-generator/VERSION +++ b/samples/server/petstore/haskell-servant/.openapi-generator/VERSION @@ -1 +1 @@ -3.0.0-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/api/PetApi.java index 9c03e01a173..bd837fb23bc 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/api/PetApi.java @@ -67,7 +67,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid status value") }) - public List findPetsByStatus(@QueryParam("status") @NotNull List status); + public List findPetsByStatus(@QueryParam("status") @NotNull @DefaultValue("new ArrayList()") List status); /** * Finds Pets by tags @@ -82,7 +82,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid tag value") }) - public List findPetsByTags(@QueryParam("tags") @NotNull List tags); + public List findPetsByTags(@QueryParam("tags") @NotNull @DefaultValue("new ArrayList()") List tags); /** * Find pet by ID diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Category.java index e03374a55ce..2a9c50e8ab8 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Category.java @@ -21,10 +21,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Category { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") - private String name = null; + private String name; /** * Get id * @return id diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/ModelApiResponse.java index d9d7952c04f..8e0b124af4d 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -21,13 +21,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class ModelApiResponse { @ApiModelProperty(value = "") - private Integer code = null; + private Integer code; @ApiModelProperty(value = "") - private String type = null; + private String type; @ApiModelProperty(value = "") - private String message = null; + private String message; /** * Get code * @return code diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Order.java index e6983066f1e..4f6eeafcec0 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Order.java @@ -22,16 +22,16 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Order { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") - private Long petId = null; + private Long petId; @ApiModelProperty(value = "") - private Integer quantity = null; + private Integer quantity; @ApiModelProperty(value = "") - private Date shipDate = null; + private Date shipDate; @XmlType(name="StatusEnum") @XmlEnum(String.class) @@ -69,7 +69,7 @@ public enum StatusEnum { /** * Order Status **/ - private StatusEnum status = null; + private StatusEnum status; @ApiModelProperty(value = "") private Boolean complete = false; diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Pet.java index 2341695a97e..84422141410 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Pet.java @@ -25,14 +25,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Pet { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") @Valid private Category category = null; @ApiModelProperty(example = "doggie", required = true, value = "") - private String name = null; + private String name; @ApiModelProperty(required = true, value = "") private List photoUrls = new ArrayList(); @@ -77,7 +77,7 @@ public enum StatusEnum { /** * pet status in the store **/ - private StatusEnum status = null; + private StatusEnum status; /** * Get id * @return id diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Tag.java index c1e32d60216..10cbeef0e0a 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/Tag.java @@ -21,10 +21,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Tag { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") - private String name = null; + private String name; /** * Get id * @return id diff --git a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/User.java index b81bc0c6251..b1d7d8b0251 100644 --- a/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-cxf-annotated-base-path/src/gen/java/org/openapitools/model/User.java @@ -21,31 +21,31 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class User { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") - private String username = null; + private String username; @ApiModelProperty(value = "") - private String firstName = null; + private String firstName; @ApiModelProperty(value = "") - private String lastName = null; + private String lastName; @ApiModelProperty(value = "") - private String email = null; + private String email; @ApiModelProperty(value = "") - private String password = null; + private String password; @ApiModelProperty(value = "") - private String phone = null; + private String phone; @ApiModelProperty(value = "User Status") /** * User Status **/ - private Integer userStatus = null; + private Integer userStatus; /** * Get id * @return id diff --git a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApi.java index 6b63b7750de..a2b931ff390 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/api/PetApi.java @@ -81,7 +81,7 @@ public class PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) - public Response findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold") @QueryParam("status") List status) { + public Response findPetsByStatus( @NotNull @ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("status") List status) { return delegate.findPetsByStatus(status, securityContext); } @@ -98,7 +98,7 @@ public class PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) - public Response findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List tags) { + public Response findPetsByTags( @NotNull @ApiParam(value = "Tags to filter by",required=true, defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("tags") List tags) { return delegate.findPetsByTags(tags, securityContext); } diff --git a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Category.java index 0015ac2d81d..72d953c5334 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Category.java @@ -19,9 +19,9 @@ import javax.xml.bind.annotation.*; public class Category { - private Long id = null; + private Long id; - private String name = null; + private String name; /** diff --git a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/ModelApiResponse.java index f05d1f51756..32301e9a946 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -19,11 +19,11 @@ import javax.xml.bind.annotation.*; public class ModelApiResponse { - private Integer code = null; + private Integer code; - private String type = null; + private String type; - private String message = null; + private String message; /** diff --git a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Order.java index 3764470fe32..70b230d5a54 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Order.java @@ -19,13 +19,13 @@ import javax.xml.bind.annotation.*; public class Order { - private Long id = null; + private Long id; - private Long petId = null; + private Long petId; - private Integer quantity = null; + private Integer quantity; - private java.util.Date shipDate = null; + private java.util.Date shipDate; @XmlType(name="StatusEnum") @@ -60,7 +60,7 @@ public enum StatusEnum { } } - private StatusEnum status = null; + private StatusEnum status; private Boolean complete = false; diff --git a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Pet.java index 2f8c5b0511f..a319b514493 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Pet.java @@ -23,11 +23,11 @@ import javax.xml.bind.annotation.*; public class Pet { - private Long id = null; + private Long id; private Category category = null; - private String name = null; + private String name; private List photoUrls = new ArrayList(); @@ -66,7 +66,7 @@ public enum StatusEnum { } } - private StatusEnum status = null; + private StatusEnum status; /** diff --git a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Tag.java index 990f5f85e23..553b8a681b5 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/Tag.java @@ -19,9 +19,9 @@ import javax.xml.bind.annotation.*; public class Tag { - private Long id = null; + private Long id; - private String name = null; + private String name; /** diff --git a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/User.java index c46cb076628..ffdbe74dfc8 100644 --- a/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-cxf-cdi/src/gen/java/org/openapitools/model/User.java @@ -19,21 +19,21 @@ import javax.xml.bind.annotation.*; public class User { - private Long id = null; + private Long id; - private String username = null; + private String username; - private String firstName = null; + private String firstName; - private String lastName = null; + private String lastName; - private String email = null; + private String email; - private String password = null; + private String password; - private String phone = null; + private String phone; - private Integer userStatus = null; + private Integer userStatus; /** diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/api/PetApi.java index 40e8ba74d73..0c0d257e784 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/api/PetApi.java @@ -67,7 +67,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid status value") }) - public List findPetsByStatus(@QueryParam("status") @NotNull List status); + public List findPetsByStatus(@QueryParam("status") @NotNull @DefaultValue("new ArrayList()") List status); /** * Finds Pets by tags @@ -82,7 +82,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid tag value") }) - public List findPetsByTags(@QueryParam("tags") @NotNull List tags); + public List findPetsByTags(@QueryParam("tags") @NotNull @DefaultValue("new ArrayList()") List tags); /** * Find pet by ID diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Category.java index e03374a55ce..2a9c50e8ab8 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Category.java @@ -21,10 +21,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Category { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") - private String name = null; + private String name; /** * Get id * @return id diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/ModelApiResponse.java index d9d7952c04f..8e0b124af4d 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -21,13 +21,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class ModelApiResponse { @ApiModelProperty(value = "") - private Integer code = null; + private Integer code; @ApiModelProperty(value = "") - private String type = null; + private String type; @ApiModelProperty(value = "") - private String message = null; + private String message; /** * Get code * @return code diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Order.java index e6983066f1e..4f6eeafcec0 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Order.java @@ -22,16 +22,16 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Order { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") - private Long petId = null; + private Long petId; @ApiModelProperty(value = "") - private Integer quantity = null; + private Integer quantity; @ApiModelProperty(value = "") - private Date shipDate = null; + private Date shipDate; @XmlType(name="StatusEnum") @XmlEnum(String.class) @@ -69,7 +69,7 @@ public enum StatusEnum { /** * Order Status **/ - private StatusEnum status = null; + private StatusEnum status; @ApiModelProperty(value = "") private Boolean complete = false; diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Pet.java index 2341695a97e..84422141410 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Pet.java @@ -25,14 +25,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Pet { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") @Valid private Category category = null; @ApiModelProperty(example = "doggie", required = true, value = "") - private String name = null; + private String name; @ApiModelProperty(required = true, value = "") private List photoUrls = new ArrayList(); @@ -77,7 +77,7 @@ public enum StatusEnum { /** * pet status in the store **/ - private StatusEnum status = null; + private StatusEnum status; /** * Get id * @return id diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Tag.java index c1e32d60216..10cbeef0e0a 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/Tag.java @@ -21,10 +21,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Tag { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") - private String name = null; + private String name; /** * Get id * @return id diff --git a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/User.java index b81bc0c6251..b1d7d8b0251 100644 --- a/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-cxf-non-spring-app/src/gen/java/org/openapitools/model/User.java @@ -21,31 +21,31 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class User { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") - private String username = null; + private String username; @ApiModelProperty(value = "") - private String firstName = null; + private String firstName; @ApiModelProperty(value = "") - private String lastName = null; + private String lastName; @ApiModelProperty(value = "") - private String email = null; + private String email; @ApiModelProperty(value = "") - private String password = null; + private String password; @ApiModelProperty(value = "") - private String phone = null; + private String phone; @ApiModelProperty(value = "User Status") /** * User Status **/ - private Integer userStatus = null; + private Integer userStatus; /** * Get id * @return id diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/api/FakeApi.java index 9a8dc4f6f46..dc4ad757c7b 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/api/FakeApi.java @@ -128,7 +128,7 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request"), @ApiResponse(code = 404, message = "Not found") }) - public void testEnumParameters(@HeaderParam("enum_header_string_array") List enumHeaderStringArray, @HeaderParam("enum_header_string") String enumHeaderString, @QueryParam("enum_query_string_array") List enumQueryStringArray, @QueryParam("enum_query_string") @DefaultValue("-efg") String enumQueryString, @QueryParam("enum_query_integer") Integer enumQueryInteger, @QueryParam("enum_query_double") Double enumQueryDouble, @Multipart(value = "enum_form_string_array", required = false) List enumFormStringArray, @Multipart(value = "enum_form_string", required = false) String enumFormString); + public void testEnumParameters(@HeaderParam("enum_header_string_array") List enumHeaderStringArray, @HeaderParam("enum_header_string") String enumHeaderString, @QueryParam("enum_query_string_array") @DefaultValue("new ArrayList()") List enumQueryStringArray, @QueryParam("enum_query_string") @DefaultValue("-efg") String enumQueryString, @QueryParam("enum_query_integer") Integer enumQueryInteger, @QueryParam("enum_query_double") Double enumQueryDouble, @Multipart(value = "enum_form_string_array", required = false) List enumFormStringArray, @Multipart(value = "enum_form_string", required = false) String enumFormString); /** * test inline additionalProperties diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/api/PetApi.java index d32fbdd1b08..ec4d271343f 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/api/PetApi.java @@ -67,7 +67,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid status value") }) - public List findPetsByStatus(@QueryParam("status") @NotNull List status); + public List findPetsByStatus(@QueryParam("status") @NotNull @DefaultValue("new ArrayList()") List status); /** * Finds Pets by tags @@ -82,7 +82,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid tag value") }) - public List findPetsByTags(@QueryParam("tags") @NotNull List tags); + public List findPetsByTags(@QueryParam("tags") @NotNull @DefaultValue("new ArrayList()") List tags); /** * Find pet by ID diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Animal.java index 3ddc9f4a1dd..8385160df62 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Animal.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Animal { @ApiModelProperty(required = true, value = "") - private String className = null; + private String className; @ApiModelProperty(value = "") private String color = "red"; diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Capitalization.java index 23f6518587d..28121b91cb7 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Capitalization.java @@ -16,25 +16,25 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Capitalization { @ApiModelProperty(value = "") - private String smallCamel = null; + private String smallCamel; @ApiModelProperty(value = "") - private String capitalCamel = null; + private String capitalCamel; @ApiModelProperty(value = "") - private String smallSnake = null; + private String smallSnake; @ApiModelProperty(value = "") - private String capitalSnake = null; + private String capitalSnake; @ApiModelProperty(value = "") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @ApiModelProperty(value = "Name of the pet ") /** * Name of the pet **/ - private String ATT_NAME = null; + private String ATT_NAME; /** * Get smallCamel * @return smallCamel diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Cat.java index e9c204b68e3..2c3ff248c42 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Cat.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Cat extends Animal { @ApiModelProperty(value = "") - private Boolean declawed = null; + private Boolean declawed; /** * Get declawed * @return declawed diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Category.java index 7e35b0e8e7b..6f3826edef0 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Category.java @@ -16,10 +16,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Category { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") - private String name = null; + private String name; /** * Get id * @return id diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ClassModel.java index 789e164db0d..7002f7449b6 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ClassModel.java @@ -21,7 +21,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class ClassModel { @ApiModelProperty(value = "") - private String propertyClass = null; + private String propertyClass; /** * Get propertyClass * @return propertyClass diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Client.java index b079876c795..6741eddce5c 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Client.java @@ -16,7 +16,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Client { @ApiModelProperty(value = "") - private String client = null; + private String client; /** * Get client * @return client diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Dog.java index 062891c899d..efaf4c488b2 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Dog.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Dog extends Animal { @ApiModelProperty(value = "") - private String breed = null; + private String breed; /** * Get breed * @return breed diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/EnumArrays.java index 3897a2465d2..5128bac7068 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/EnumArrays.java @@ -50,7 +50,7 @@ public enum JustSymbolEnum { } @ApiModelProperty(value = "") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; @XmlType(name="ArrayEnumEnum") @XmlEnum(String.class) diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/EnumTest.java index 653aa6d3225..e43caf57a76 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/EnumTest.java @@ -49,7 +49,7 @@ public enum EnumStringEnum { } @ApiModelProperty(value = "") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; @XmlType(name="EnumStringRequiredEnum") @XmlEnum(String.class) @@ -84,7 +84,7 @@ public enum EnumStringRequiredEnum { } @ApiModelProperty(required = true, value = "") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; @XmlType(name="EnumIntegerEnum") @XmlEnum(Integer.class) @@ -119,7 +119,7 @@ public enum EnumIntegerEnum { } @ApiModelProperty(value = "") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; @XmlType(name="EnumNumberEnum") @XmlEnum(Double.class) @@ -154,7 +154,7 @@ public enum EnumNumberEnum { } @ApiModelProperty(value = "") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @ApiModelProperty(value = "") @Valid diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/FormatTest.java index f49d8331357..2849ff20ae8 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/FormatTest.java @@ -21,44 +21,44 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class FormatTest { @ApiModelProperty(value = "") - private Integer integer = null; + private Integer integer; @ApiModelProperty(value = "") - private Integer int32 = null; + private Integer int32; @ApiModelProperty(value = "") - private Long int64 = null; + private Long int64; @ApiModelProperty(required = true, value = "") @Valid - private BigDecimal number = null; + private BigDecimal number; @ApiModelProperty(value = "") - private Float _float = null; + private Float _float; @ApiModelProperty(value = "") - private Double _double = null; + private Double _double; @ApiModelProperty(value = "") - private String string = null; + private String string; @ApiModelProperty(required = true, value = "") - private byte[] _byte = null; + private byte[] _byte; @ApiModelProperty(value = "") - private File binary = null; + private File binary; @ApiModelProperty(required = true, value = "") - private LocalDate date = null; + private LocalDate date; @ApiModelProperty(value = "") - private Date dateTime = null; + private Date dateTime; @ApiModelProperty(value = "") - private UUID uuid = null; + private UUID uuid; @ApiModelProperty(required = true, value = "") - private String password = null; + private String password; /** * Get integer * minimum: 10 diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java index 704dd6e8f8d..4323df53511 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -16,10 +16,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class HasOnlyReadOnly { @ApiModelProperty(value = "") - private String bar = null; + private String bar; @ApiModelProperty(value = "") - private String foo = null; + private String foo; /** * Get bar * @return bar diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/MapTest.java index 2a726dc538a..783e05935f5 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/MapTest.java @@ -3,7 +3,6 @@ package org.openapitools.model; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.constraints.*; import javax.validation.Valid; @@ -62,8 +61,7 @@ public enum InnerEnum { private Map directMap = null; @ApiModelProperty(value = "") - @Valid - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; /** * Get mapMapOfString * @return mapMapOfString @@ -138,19 +136,24 @@ public enum InnerEnum { * @return indirectMap **/ @JsonProperty("indirect_map") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + this.indirectMap.put(key, indirectMapItem); + return this; + } + @Override public String toString() { diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index ada14ed2bf6..9210f0d5db6 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -22,10 +22,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") - private UUID uuid = null; + private UUID uuid; @ApiModelProperty(value = "") - private Date dateTime = null; + private Date dateTime; @ApiModelProperty(value = "") @Valid diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Model200Response.java index 0a4b0546c24..acfc8f9dfe2 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Model200Response.java @@ -21,10 +21,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Model200Response { @ApiModelProperty(value = "") - private Integer name = null; + private Integer name; @ApiModelProperty(value = "") - private String propertyClass = null; + private String propertyClass; /** * Get name * @return name diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ModelApiResponse.java index 016f396ced5..339319ddc2b 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -16,13 +16,13 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class ModelApiResponse { @ApiModelProperty(value = "") - private Integer code = null; + private Integer code; @ApiModelProperty(value = "") - private String type = null; + private String type; @ApiModelProperty(value = "") - private String message = null; + private String message; /** * Get code * @return code diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ModelReturn.java index 8162d879d08..75dbf706c58 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ModelReturn.java @@ -21,7 +21,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class ModelReturn { @ApiModelProperty(value = "") - private Integer _return = null; + private Integer _return; /** * Get _return * @return _return diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Name.java index feaa49e7438..2f9750b4f38 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Name.java @@ -21,16 +21,16 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Name { @ApiModelProperty(required = true, value = "") - private Integer name = null; + private Integer name; @ApiModelProperty(value = "") - private Integer snakeCase = null; + private Integer snakeCase; @ApiModelProperty(value = "") - private String property = null; + private String property; @ApiModelProperty(value = "") - private Integer _123number = null; + private Integer _123number; /** * Get name * @return name diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/NumberOnly.java index 948d2004702..3d61c8c76f2 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/NumberOnly.java @@ -18,7 +18,7 @@ public class NumberOnly { @ApiModelProperty(value = "") @Valid - private BigDecimal justNumber = null; + private BigDecimal justNumber; /** * Get justNumber * @return justNumber diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Order.java index 90d771bd787..a0d2bb55149 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Order.java @@ -17,16 +17,16 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Order { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") - private Long petId = null; + private Long petId; @ApiModelProperty(value = "") - private Integer quantity = null; + private Integer quantity; @ApiModelProperty(value = "") - private Date shipDate = null; + private Date shipDate; @XmlType(name="StatusEnum") @XmlEnum(String.class) @@ -64,7 +64,7 @@ public enum StatusEnum { /** * Order Status **/ - private StatusEnum status = null; + private StatusEnum status; @ApiModelProperty(value = "") private Boolean complete = false; diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/OuterComposite.java index 3feb1375665..02e622d85fb 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/OuterComposite.java @@ -18,13 +18,13 @@ public class OuterComposite { @ApiModelProperty(value = "") @Valid - private BigDecimal myNumber = null; + private BigDecimal myNumber; @ApiModelProperty(value = "") - private String myString = null; + private String myString; @ApiModelProperty(value = "") - private Boolean myBoolean = null; + private Boolean myBoolean; /** * Get myNumber * @return myNumber diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Pet.java index 2dfa5ef5319..309fa43ffc9 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Pet.java @@ -20,14 +20,14 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Pet { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") @Valid private Category category = null; @ApiModelProperty(example = "doggie", required = true, value = "") - private String name = null; + private String name; @ApiModelProperty(required = true, value = "") private List photoUrls = new ArrayList(); @@ -72,7 +72,7 @@ public enum StatusEnum { /** * pet status in the store **/ - private StatusEnum status = null; + private StatusEnum status; /** * Get id * @return id diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ReadOnlyFirst.java index df0053c0207..fd9bd949729 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -16,10 +16,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class ReadOnlyFirst { @ApiModelProperty(value = "") - private String bar = null; + private String bar; @ApiModelProperty(value = "") - private String baz = null; + private String baz; /** * Get bar * @return bar diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/SpecialModelName.java index 6a80cf97854..ef23af3fecc 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -16,7 +16,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class SpecialModelName { @ApiModelProperty(value = "") - private Long $specialPropertyName = null; + private Long $specialPropertyName; /** * Get $specialPropertyName * @return $specialPropertyName diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Tag.java index 19b0967479f..268e6f27211 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/Tag.java @@ -16,10 +16,10 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class Tag { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") - private String name = null; + private String name; /** * Get id * @return id diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/User.java index 2225938e637..af204eab8a8 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/org/openapitools/model/User.java @@ -16,31 +16,31 @@ import com.fasterxml.jackson.annotation.JsonProperty; public class User { @ApiModelProperty(value = "") - private Long id = null; + private Long id; @ApiModelProperty(value = "") - private String username = null; + private String username; @ApiModelProperty(value = "") - private String firstName = null; + private String firstName; @ApiModelProperty(value = "") - private String lastName = null; + private String lastName; @ApiModelProperty(value = "") - private String email = null; + private String email; @ApiModelProperty(value = "") - private String password = null; + private String password; @ApiModelProperty(value = "") - private String phone = null; + private String phone; @ApiModelProperty(value = "User Status") /** * User Status **/ - private Integer userStatus = null; + private Integer userStatus; /** * Get id * @return id diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/AnotherFakeApi.java index c1eb8b88c3c..09cd0e9c47c 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -24,6 +24,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/another-fake") @@ -61,7 +62,7 @@ public class AnotherFakeApi { @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response call123testSpecialTags(@ApiParam(value = "client model" ,required=true) Client client + public Response call123testSpecialTags(@ApiParam(value = "client model" ,required=true) @Valid Client client ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.call123testSpecialTags(client,securityContext); diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeApi.java index ddcc88022f4..431bc556bc4 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeApi.java @@ -33,6 +33,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/fake") @@ -70,7 +71,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) - public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) Boolean body + public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid Boolean body ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterBooleanSerialize(body,securityContext); @@ -82,7 +83,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) - public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) OuterComposite outerComposite + public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid OuterComposite outerComposite ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterCompositeSerialize(outerComposite,securityContext); @@ -94,7 +95,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) - public Response fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) BigDecimal body + public Response fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid BigDecimal body ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterNumberSerialize(body,securityContext); @@ -106,7 +107,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) }) - public Response fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) String body + public Response fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid String body ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterStringSerialize(body,securityContext); @@ -118,7 +119,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) - public Response testBodyWithFileSchema(@ApiParam(value = "" ,required=true) FileSchemaTestClass fileSchemaTestClass + public Response testBodyWithFileSchema(@ApiParam(value = "" ,required=true) @Valid FileSchemaTestClass fileSchemaTestClass ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithFileSchema(fileSchemaTestClass,securityContext); @@ -131,7 +132,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) public Response testBodyWithQueryParams(@ApiParam(value = "",required=true) @QueryParam("query") String query -,@ApiParam(value = "" ,required=true) User user +,@ApiParam(value = "" ,required=true) @Valid User user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithQueryParams(query,user,securityContext); @@ -143,7 +144,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response testClientModel(@ApiParam(value = "client model" ,required=true) Client client + public Response testClientModel(@ApiParam(value = "client model" ,required=true) @Valid Client client ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClientModel(client,securityContext); @@ -159,22 +160,22 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) - public Response testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("number") BigDecimal number -,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("double") Double _double -,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("pattern_without_delimiter") String patternWithoutDelimiter -,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("byte") byte[] _byte -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("integer") Integer integer -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int32") Integer int32 -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int64") Long int64 -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("float") Float _float -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("string") String string + public Response testEndpointParameters(@ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number +,@ApiParam(value = "None", required=true) @FormParam("double") Double _double +,@ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter +,@ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte +,@ApiParam(value = "None") @FormParam("integer") Integer integer +,@ApiParam(value = "None") @FormParam("int32") Integer int32 +,@ApiParam(value = "None") @FormParam("int64") Long int64 +,@ApiParam(value = "None") @FormParam("float") Float _float +,@ApiParam(value = "None") @FormParam("string") String string , @FormDataParam("binary") InputStream binaryInputStream, @FormDataParam("binary") FormDataContentDisposition binaryDetail -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("date") LocalDate date -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("dateTime") OffsetDateTime dateTime -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("password") String password -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("callback") String paramCallback +,@ApiParam(value = "None") @FormParam("date") LocalDate date +,@ApiParam(value = "None") @FormParam("dateTime") OffsetDateTime dateTime +,@ApiParam(value = "None") @FormParam("password") String password +,@ApiParam(value = "None") @FormParam("callback") String paramCallback ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testEndpointParameters(number,_double,patternWithoutDelimiter,_byte,integer,int32,int64,_float,string,binaryInputStream, binaryDetail,date,dateTime,password,paramCallback,securityContext); @@ -188,9 +189,9 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) }) - public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List enumHeaderStringArray + public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<>()")@HeaderParam("enum_header_string_array") List enumHeaderStringArray ,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString -,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $") @QueryParam("enum_query_string_array") List enumQueryStringArray +,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $", defaultValue="new ArrayList<>()") @DefaultValue("new ArrayList<>()") @QueryParam("enum_query_string_array") List enumQueryStringArray ,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString ,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger ,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble @@ -207,7 +208,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) Map requestBody + public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) @Valid Map requestBody ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testInlineAdditionalProperties(requestBody,securityContext); @@ -219,8 +220,8 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param") String param -,@ApiParam(value = "field2", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param2") String param2 + public Response testJsonFormData(@ApiParam(value = "field1", required=true) @FormParam("param") String param +,@ApiParam(value = "field2", required=true) @FormParam("param2") String param2 ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testJsonFormData(param,param2,securityContext); @@ -241,7 +242,7 @@ public class FakeApi { , @FormDataParam("requiredFile") InputStream requiredFileInputStream, @FormDataParam("requiredFile") FormDataContentDisposition requiredFileDetail -,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata +,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.uploadFileWithRequiredFile(petId,requiredFileInputStream, requiredFileDetail,additionalMetadata,securityContext); diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java index 26f71f89a8d..f2552f7d08c 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -24,6 +24,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/fake_classname_test") @@ -63,7 +64,7 @@ public class FakeClassnameTestApi { }, tags={ "fake_classname_tags 123#$%^", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response testClassname(@ApiParam(value = "client model" ,required=true) Client client + public Response testClassname(@ApiParam(value = "client model" ,required=true) @Valid Client client ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClassname(client,securityContext); diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/PetApi.java index c915d919bab..16a168541a5 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/PetApi.java @@ -26,6 +26,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/pet") @@ -68,7 +69,7 @@ public class PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @Valid Pet pet ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.addPet(pet,securityContext); @@ -105,7 +106,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) - public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold") @QueryParam("status") List status + public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold", defaultValue="new ArrayList<>()") @DefaultValue("new ArrayList<>()") @QueryParam("status") List status ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByStatus(status,securityContext); @@ -124,7 +125,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) - public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List tags + public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true, defaultValue="new ArrayList<>()") @DefaultValue("new ArrayList<>()") @QueryParam("tags") List tags ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByTags(tags,securityContext); @@ -163,7 +164,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @Valid Pet pet ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePet(pet,securityContext); @@ -181,8 +182,8 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId -,@ApiParam(value = "Updated name of the pet", defaultValue="null") @DefaultValue("null") @FormParam("name") String name -,@ApiParam(value = "Updated status of the pet", defaultValue="null") @DefaultValue("null") @FormParam("status") String status +,@ApiParam(value = "Updated name of the pet") @FormParam("name") String name +,@ApiParam(value = "Updated status of the pet") @FormParam("status") String status ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePetWithForm(petId,name,status,securityContext); @@ -200,7 +201,7 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId -,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata +,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata , @FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/StoreApi.java index 5cb8bfffd76..953b54fdc1f 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/StoreApi.java @@ -25,6 +25,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/store") @@ -107,7 +108,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) - public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order order + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) @Valid Order order ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.placeOrder(order,securityContext); diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApi.java index bdc79d307f6..92191994db5 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/api/UserApi.java @@ -25,6 +25,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/user") @@ -62,7 +63,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUser(@ApiParam(value = "Created user object" ,required=true) User user + public Response createUser(@ApiParam(value = "Created user object" ,required=true) @Valid User user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUser(user,securityContext); @@ -74,7 +75,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List user + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) @Valid List user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithArrayInput(user,securityContext); @@ -86,7 +87,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List user + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) @Valid List user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithListInput(user,securityContext); @@ -157,7 +158,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) public Response updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username -,@ApiParam(value = "Updated user object" ,required=true) User user +,@ApiParam(value = "Updated user object" ,required=true) @Valid User user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updateUser(username,user,securityContext); diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index 9626bee4f16..e9975e4d548 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Map; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * AdditionalPropertiesClass @@ -54,6 +55,7 @@ public class AdditionalPropertiesClass implements Serializable { **/ @JsonProperty("map_property") @ApiModelProperty(value = "") + public Map getMapProperty() { return mapProperty; } @@ -81,6 +83,7 @@ public class AdditionalPropertiesClass implements Serializable { **/ @JsonProperty("map_of_map_property") @ApiModelProperty(value = "") + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Animal.java index 92eeef79cad..f56685cd634 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Animal.java @@ -22,6 +22,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Animal @@ -29,7 +30,7 @@ import javax.validation.constraints.*; public class Animal implements Serializable { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; @@ -45,7 +46,8 @@ public class Animal implements Serializable { **/ @JsonProperty("className") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public String getClassName() { return className; } @@ -65,6 +67,7 @@ public class Animal implements Serializable { **/ @JsonProperty("color") @ApiModelProperty(value = "") + public String getColor() { return color; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/AnimalFarm.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/AnimalFarm.java index e52fcedac3a..dcffe04e929 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/AnimalFarm.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/AnimalFarm.java @@ -19,6 +19,7 @@ import java.util.List; import org.openapitools.model.Animal; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * AnimalFarm diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java index e2f72384eb2..fd82d64952f 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.List; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayOfArrayOfNumberOnly @@ -51,6 +52,7 @@ public class ArrayOfArrayOfNumberOnly implements Serializable { **/ @JsonProperty("ArrayArrayNumber") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java index 7c0eb56dd22..6ccd0ef9652 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.List; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayOfNumberOnly @@ -51,6 +52,7 @@ public class ArrayOfNumberOnly implements Serializable { **/ @JsonProperty("ArrayNumber") @ApiModelProperty(value = "") + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ArrayTest.java index 226f99a261e..69442303b58 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ArrayTest.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ArrayTest.java @@ -23,6 +23,7 @@ import java.util.List; import org.openapitools.model.ReadOnlyFirst; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayTest @@ -57,6 +58,7 @@ public class ArrayTest implements Serializable { **/ @JsonProperty("array_of_string") @ApiModelProperty(value = "") + public List getArrayOfString() { return arrayOfString; } @@ -84,6 +86,7 @@ public class ArrayTest implements Serializable { **/ @JsonProperty("array_array_of_integer") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -111,6 +114,7 @@ public class ArrayTest implements Serializable { **/ @JsonProperty("array_array_of_model") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Capitalization.java index 9d73a61b4f4..303b6d395c7 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Capitalization.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Capitalization @@ -27,22 +28,22 @@ import javax.validation.constraints.*; public class Capitalization implements Serializable { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; @@ -55,6 +56,7 @@ public class Capitalization implements Serializable { **/ @JsonProperty("smallCamel") @ApiModelProperty(value = "") + public String getSmallCamel() { return smallCamel; } @@ -74,6 +76,7 @@ public class Capitalization implements Serializable { **/ @JsonProperty("CapitalCamel") @ApiModelProperty(value = "") + public String getCapitalCamel() { return capitalCamel; } @@ -93,6 +96,7 @@ public class Capitalization implements Serializable { **/ @JsonProperty("small_Snake") @ApiModelProperty(value = "") + public String getSmallSnake() { return smallSnake; } @@ -112,6 +116,7 @@ public class Capitalization implements Serializable { **/ @JsonProperty("Capital_Snake") @ApiModelProperty(value = "") + public String getCapitalSnake() { return capitalSnake; } @@ -131,6 +136,7 @@ public class Capitalization implements Serializable { **/ @JsonProperty("SCA_ETH_Flow_Points") @ApiModelProperty(value = "") + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -150,6 +156,7 @@ public class Capitalization implements Serializable { **/ @JsonProperty("ATT_NAME") @ApiModelProperty(value = "Name of the pet ") + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Cat.java index 4740292ec21..dc94638a39a 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Cat.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.Animal; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Cat @@ -28,7 +29,7 @@ import javax.validation.constraints.*; public class Cat extends Animal implements Serializable { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; @@ -41,6 +42,7 @@ public class Cat extends Animal implements Serializable { **/ @JsonProperty("declawed") @ApiModelProperty(value = "") + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Category.java index 78c0259bbf1..873177ad9e3 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Category.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Category @@ -27,10 +28,10 @@ import javax.validation.constraints.*; public class Category implements Serializable { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; @@ -43,6 +44,7 @@ public class Category implements Serializable { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -62,6 +64,7 @@ public class Category implements Serializable { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ClassModel.java index b826b136616..164603957a6 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ClassModel.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model with \"_class\" property @@ -28,7 +29,7 @@ import javax.validation.constraints.*; public class ClassModel implements Serializable { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; @@ -41,6 +42,7 @@ public class ClassModel implements Serializable { **/ @JsonProperty("_class") @ApiModelProperty(value = "") + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Client.java index 143c99e08c0..dd00b74727a 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Client.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Client @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class Client implements Serializable { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; @@ -40,6 +41,7 @@ public class Client implements Serializable { **/ @JsonProperty("client") @ApiModelProperty(value = "") + public String getClient() { return client; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Dog.java index ff3bc2f068e..e60c3005f6e 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Dog.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.Animal; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Dog @@ -28,7 +29,7 @@ import javax.validation.constraints.*; public class Dog extends Animal implements Serializable { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; @@ -41,6 +42,7 @@ public class Dog extends Animal implements Serializable { **/ @JsonProperty("breed") @ApiModelProperty(value = "") + public String getBreed() { return breed; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/EnumArrays.java index 4a709992b81..e14a3496586 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/EnumArrays.java @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.List; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * EnumArrays @@ -61,7 +62,7 @@ public class EnumArrays implements Serializable { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum @@ -108,6 +109,7 @@ public class EnumArrays implements Serializable { **/ @JsonProperty("just_symbol") @ApiModelProperty(value = "") + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -135,6 +137,7 @@ public class EnumArrays implements Serializable { **/ @JsonProperty("array_enum") @ApiModelProperty(value = "") + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/EnumClass.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/EnumClass.java index 83dcddfcec6..ee069ce6527 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/EnumClass.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/EnumClass.java @@ -17,6 +17,7 @@ import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/EnumTest.java index c38bfc4a033..65964de9b5c 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/EnumTest.java @@ -22,6 +22,7 @@ import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.OuterEnum; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * EnumTest @@ -62,7 +63,7 @@ public class EnumTest implements Serializable { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -98,7 +99,7 @@ public class EnumTest implements Serializable { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -132,7 +133,7 @@ public class EnumTest implements Serializable { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -166,7 +167,7 @@ public class EnumTest implements Serializable { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; @@ -182,6 +183,7 @@ public class EnumTest implements Serializable { **/ @JsonProperty("enum_string") @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { return enumString; } @@ -201,7 +203,8 @@ public class EnumTest implements Serializable { **/ @JsonProperty("enum_string_required") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public EnumStringRequiredEnum getEnumStringRequired() { return enumStringRequired; } @@ -221,6 +224,7 @@ public class EnumTest implements Serializable { **/ @JsonProperty("enum_integer") @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -240,6 +244,7 @@ public class EnumTest implements Serializable { **/ @JsonProperty("enum_number") @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -259,6 +264,7 @@ public class EnumTest implements Serializable { **/ @JsonProperty("outerEnum") @ApiModelProperty(value = "") + @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/FileSchemaTestClass.java index c842f94d60a..42c691c2c67 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/FileSchemaTestClass.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * FileSchemaTestClass @@ -45,6 +46,7 @@ public class FileSchemaTestClass implements Serializable { **/ @JsonProperty("file") @ApiModelProperty(value = "") + @Valid public java.io.File getFile() { return file; } @@ -72,6 +74,7 @@ public class FileSchemaTestClass implements Serializable { **/ @JsonProperty("files") @ApiModelProperty(value = "") + @Valid public List getFiles() { return files; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/FormatTest.java index 08532377f73..1052805de98 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/FormatTest.java @@ -25,6 +25,7 @@ import java.time.OffsetDateTime; import java.util.UUID; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * FormatTest @@ -32,43 +33,43 @@ import javax.validation.constraints.*; public class FormatTest implements Serializable { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; @@ -83,7 +84,8 @@ public class FormatTest implements Serializable { **/ @JsonProperty("integer") @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + public Integer getInteger() { return integer; } @@ -104,7 +106,8 @@ public class FormatTest implements Serializable { **/ @JsonProperty("int32") @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + public Integer getInt32() { return int32; } @@ -123,6 +126,7 @@ public class FormatTest implements Serializable { **/ @JsonProperty("int64") @ApiModelProperty(value = "") + public Long getInt64() { return int64; } @@ -144,8 +148,9 @@ public class FormatTest implements Serializable { **/ @JsonProperty("number") @ApiModelProperty(required = true, value = "") - @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @NotNull + @DecimalMin("32.1") @DecimalMax("543.2")@Valid + public BigDecimal getNumber() { return number; } @@ -166,7 +171,8 @@ public class FormatTest implements Serializable { **/ @JsonProperty("float") @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + public Float getFloat() { return _float; } @@ -187,7 +193,8 @@ public class FormatTest implements Serializable { **/ @JsonProperty("double") @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + public Double getDouble() { return _double; } @@ -206,7 +213,8 @@ public class FormatTest implements Serializable { **/ @JsonProperty("string") @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + public String getString() { return string; } @@ -225,8 +233,9 @@ public class FormatTest implements Serializable { **/ @JsonProperty("byte") @ApiModelProperty(required = true, value = "") - @NotNull - @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") public byte[] getByte() { + @NotNull + @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") + public byte[] getByte() { return _byte; } @@ -245,6 +254,7 @@ public class FormatTest implements Serializable { **/ @JsonProperty("binary") @ApiModelProperty(value = "") + public File getBinary() { return binary; } @@ -264,7 +274,8 @@ public class FormatTest implements Serializable { **/ @JsonProperty("date") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public LocalDate getDate() { return date; } @@ -284,6 +295,7 @@ public class FormatTest implements Serializable { **/ @JsonProperty("dateTime") @ApiModelProperty(value = "") + public OffsetDateTime getDateTime() { return dateTime; } @@ -303,6 +315,7 @@ public class FormatTest implements Serializable { **/ @JsonProperty("uuid") @ApiModelProperty(value = "") + public UUID getUuid() { return uuid; } @@ -322,8 +335,9 @@ public class FormatTest implements Serializable { **/ @JsonProperty("password") @ApiModelProperty(required = true, value = "") - @NotNull - @Size(min=10,max=64) public String getPassword() { + @NotNull + @Size(min=10,max=64) + public String getPassword() { return password; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java index 408caba9463..6707536246b 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * HasOnlyReadOnly @@ -27,10 +28,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly implements Serializable { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar @@ -38,6 +39,7 @@ public class HasOnlyReadOnly implements Serializable { **/ @JsonProperty("bar") @ApiModelProperty(value = "") + public String getBar() { return bar; } @@ -48,6 +50,7 @@ public class HasOnlyReadOnly implements Serializable { **/ @JsonProperty("foo") @ApiModelProperty(value = "") + public String getFoo() { return foo; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/MapTest.java index 0251adcbad1..6cbf32c87eb 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/MapTest.java @@ -22,9 +22,9 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * MapTest @@ -72,7 +72,7 @@ public class MapTest implements Serializable { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -93,6 +93,7 @@ public class MapTest implements Serializable { **/ @JsonProperty("map_map_of_string") @ApiModelProperty(value = "") + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -120,6 +121,7 @@ public class MapTest implements Serializable { **/ @JsonProperty("map_of_enum_string") @ApiModelProperty(value = "") + public Map getMapOfEnumString() { return mapOfEnumString; } @@ -147,6 +149,7 @@ public class MapTest implements Serializable { **/ @JsonProperty("direct_map") @ApiModelProperty(value = "") + public Map getDirectMap() { return directMap; } @@ -155,22 +158,31 @@ public class MapTest implements Serializable { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @JsonProperty("indirect_map") @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 70e21bd87a3..88ba5317c3b 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -26,6 +26,7 @@ import java.util.UUID; import org.openapitools.model.Animal; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * MixedPropertiesAndAdditionalPropertiesClass @@ -33,10 +34,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass implements Serializable { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") private Map map = null; @@ -52,6 +53,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass implements Serializabl **/ @JsonProperty("uuid") @ApiModelProperty(value = "") + public UUID getUuid() { return uuid; } @@ -71,6 +73,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass implements Serializabl **/ @JsonProperty("dateTime") @ApiModelProperty(value = "") + public OffsetDateTime getDateTime() { return dateTime; } @@ -98,6 +101,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass implements Serializabl **/ @JsonProperty("map") @ApiModelProperty(value = "") + @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Model200Response.java index 39186c4cb2d..97fae1354d3 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Model200Response.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model name starting with number @@ -28,10 +29,10 @@ import javax.validation.constraints.*; public class Model200Response implements Serializable { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; @@ -44,6 +45,7 @@ public class Model200Response implements Serializable { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public Integer getName() { return name; } @@ -63,6 +65,7 @@ public class Model200Response implements Serializable { **/ @JsonProperty("class") @ApiModelProperty(value = "") + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ModelApiResponse.java index f359aa5fa33..bcd30806afe 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ModelApiResponse @@ -27,13 +28,13 @@ import javax.validation.constraints.*; public class ModelApiResponse implements Serializable { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; @@ -46,6 +47,7 @@ public class ModelApiResponse implements Serializable { **/ @JsonProperty("code") @ApiModelProperty(value = "") + public Integer getCode() { return code; } @@ -65,6 +67,7 @@ public class ModelApiResponse implements Serializable { **/ @JsonProperty("type") @ApiModelProperty(value = "") + public String getType() { return type; } @@ -84,6 +87,7 @@ public class ModelApiResponse implements Serializable { **/ @JsonProperty("message") @ApiModelProperty(value = "") + public String getMessage() { return message; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ModelReturn.java index 5bbe0961e32..7243fed4355 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ModelReturn.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing reserved words @@ -28,7 +29,7 @@ import javax.validation.constraints.*; public class ModelReturn implements Serializable { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; @@ -41,6 +42,7 @@ public class ModelReturn implements Serializable { **/ @JsonProperty("return") @ApiModelProperty(value = "") + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Name.java index 92b5b496221..74308f54525 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Name.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model name same as property name @@ -28,16 +29,16 @@ import javax.validation.constraints.*; public class Name implements Serializable { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; @@ -50,7 +51,8 @@ public class Name implements Serializable { **/ @JsonProperty("name") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public Integer getName() { return name; } @@ -65,6 +67,7 @@ public class Name implements Serializable { **/ @JsonProperty("snake_case") @ApiModelProperty(value = "") + public Integer getSnakeCase() { return snakeCase; } @@ -80,6 +83,7 @@ public class Name implements Serializable { **/ @JsonProperty("property") @ApiModelProperty(value = "") + public String getProperty() { return property; } @@ -94,6 +98,7 @@ public class Name implements Serializable { **/ @JsonProperty("123Number") @ApiModelProperty(value = "") + public Integer get123number() { return _123number; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/NumberOnly.java index 34bdb652d38..df51a1dad7b 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/NumberOnly.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * NumberOnly @@ -28,7 +29,7 @@ import javax.validation.constraints.*; public class NumberOnly implements Serializable { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; @@ -41,6 +42,7 @@ public class NumberOnly implements Serializable { **/ @JsonProperty("JustNumber") @ApiModelProperty(value = "") + @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Order.java index 0bdc587ef74..5cafda42692 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Order.java @@ -22,6 +22,7 @@ import io.swagger.annotations.ApiModelProperty; import java.time.OffsetDateTime; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Order @@ -29,16 +30,16 @@ import javax.validation.constraints.*; public class Order implements Serializable { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -74,7 +75,7 @@ public class Order implements Serializable { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; @@ -90,6 +91,7 @@ public class Order implements Serializable { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -109,6 +111,7 @@ public class Order implements Serializable { **/ @JsonProperty("petId") @ApiModelProperty(value = "") + public Long getPetId() { return petId; } @@ -128,6 +131,7 @@ public class Order implements Serializable { **/ @JsonProperty("quantity") @ApiModelProperty(value = "") + public Integer getQuantity() { return quantity; } @@ -147,6 +151,7 @@ public class Order implements Serializable { **/ @JsonProperty("shipDate") @ApiModelProperty(value = "") + public OffsetDateTime getShipDate() { return shipDate; } @@ -166,6 +171,7 @@ public class Order implements Serializable { **/ @JsonProperty("status") @ApiModelProperty(value = "Order Status") + public StatusEnum getStatus() { return status; } @@ -185,6 +191,7 @@ public class Order implements Serializable { **/ @JsonProperty("complete") @ApiModelProperty(value = "") + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/OuterComposite.java index 5da708d5e19..2103e9b7eac 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/OuterComposite.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * OuterComposite @@ -28,13 +29,13 @@ import javax.validation.constraints.*; public class OuterComposite implements Serializable { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; @@ -47,6 +48,7 @@ public class OuterComposite implements Serializable { **/ @JsonProperty("my_number") @ApiModelProperty(value = "") + @Valid public BigDecimal getMyNumber() { return myNumber; } @@ -66,6 +68,7 @@ public class OuterComposite implements Serializable { **/ @JsonProperty("my_string") @ApiModelProperty(value = "") + public String getMyString() { return myString; } @@ -85,6 +88,7 @@ public class OuterComposite implements Serializable { **/ @JsonProperty("my_boolean") @ApiModelProperty(value = "") + public Boolean getMyBoolean() { return myBoolean; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/OuterEnum.java index 9c005ba7a8f..9e030ddb990 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/OuterEnum.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/OuterEnum.java @@ -17,6 +17,7 @@ import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Pet.java index 69db3d88c39..e1d46e4a771 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Pet.java @@ -25,6 +25,7 @@ import org.openapitools.model.Category; import org.openapitools.model.Tag; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Pet @@ -32,13 +33,13 @@ import javax.validation.constraints.*; public class Pet implements Serializable { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList<>(); @@ -80,7 +81,7 @@ public class Pet implements Serializable { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; @@ -93,6 +94,7 @@ public class Pet implements Serializable { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -112,6 +114,7 @@ public class Pet implements Serializable { **/ @JsonProperty("category") @ApiModelProperty(value = "") + @Valid public Category getCategory() { return category; } @@ -131,7 +134,8 @@ public class Pet implements Serializable { **/ @JsonProperty("name") @ApiModelProperty(example = "doggie", required = true, value = "") - @NotNull + @NotNull + public String getName() { return name; } @@ -156,7 +160,8 @@ public class Pet implements Serializable { **/ @JsonProperty("photoUrls") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public List getPhotoUrls() { return photoUrls; } @@ -184,6 +189,7 @@ public class Pet implements Serializable { **/ @JsonProperty("tags") @ApiModelProperty(value = "") + @Valid public List getTags() { return tags; } @@ -203,6 +209,7 @@ public class Pet implements Serializable { **/ @JsonProperty("status") @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ReadOnlyFirst.java index 9c2db843337..46ca8d946ff 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ReadOnlyFirst @@ -27,10 +28,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst implements Serializable { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar @@ -38,6 +39,7 @@ public class ReadOnlyFirst implements Serializable { **/ @JsonProperty("bar") @ApiModelProperty(value = "") + public String getBar() { return bar; } @@ -53,6 +55,7 @@ public class ReadOnlyFirst implements Serializable { **/ @JsonProperty("baz") @ApiModelProperty(value = "") + public String getBaz() { return baz; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/SpecialModelName.java index eb46a21f6be..6696f205eba 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * SpecialModelName @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class SpecialModelName implements Serializable { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; @@ -40,6 +41,7 @@ public class SpecialModelName implements Serializable { **/ @JsonProperty("$special[property.name]") @ApiModelProperty(value = "") + public Long get$SpecialPropertyName() { return $specialPropertyName; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/StringBooleanMap.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/StringBooleanMap.java index 3ea93308ddc..fedd22e5a96 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/StringBooleanMap.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/StringBooleanMap.java @@ -18,6 +18,7 @@ import java.util.HashMap; import java.util.Map; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * StringBooleanMap diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Tag.java index b9157219afa..ef03e90a44a 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/Tag.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Tag @@ -27,10 +28,10 @@ import javax.validation.constraints.*; public class Tag implements Serializable { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; @@ -43,6 +44,7 @@ public class Tag implements Serializable { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -62,6 +64,7 @@ public class Tag implements Serializable { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/User.java index cf35a9d3f72..df5e005968a 100644 --- a/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-datelib-j8/src/gen/java/org/openapitools/model/User.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; import javax.validation.constraints.*; +import javax.validation.Valid; /** * User @@ -27,28 +28,28 @@ import javax.validation.constraints.*; public class User implements Serializable { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; @@ -61,6 +62,7 @@ public class User implements Serializable { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -80,6 +82,7 @@ public class User implements Serializable { **/ @JsonProperty("username") @ApiModelProperty(value = "") + public String getUsername() { return username; } @@ -99,6 +102,7 @@ public class User implements Serializable { **/ @JsonProperty("firstName") @ApiModelProperty(value = "") + public String getFirstName() { return firstName; } @@ -118,6 +122,7 @@ public class User implements Serializable { **/ @JsonProperty("lastName") @ApiModelProperty(value = "") + public String getLastName() { return lastName; } @@ -137,6 +142,7 @@ public class User implements Serializable { **/ @JsonProperty("email") @ApiModelProperty(value = "") + public String getEmail() { return email; } @@ -156,6 +162,7 @@ public class User implements Serializable { **/ @JsonProperty("password") @ApiModelProperty(value = "") + public String getPassword() { return password; } @@ -175,6 +182,7 @@ public class User implements Serializable { **/ @JsonProperty("phone") @ApiModelProperty(value = "") + public String getPhone() { return phone; } @@ -194,6 +202,7 @@ public class User implements Serializable { **/ @JsonProperty("userStatus") @ApiModelProperty(value = "User Status") + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/jaxrs-jersey/.openapi-generator/VERSION b/samples/server/petstore/jaxrs-jersey/.openapi-generator/VERSION index 14900cee60e..6d94c9c2e12 100644 --- a/samples/server/petstore/jaxrs-jersey/.openapi-generator/VERSION +++ b/samples/server/petstore/jaxrs-jersey/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.1-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/jaxrs-jersey/README.md b/samples/server/petstore/jaxrs-jersey/README.md index ed004204491..64a6c60dc38 100644 --- a/samples/server/petstore/jaxrs-jersey/README.md +++ b/samples/server/petstore/jaxrs-jersey/README.md @@ -1,11 +1,12 @@ -# Swagger Jersey generated server +# JAX-RS/Jersey server with OpenAPI ## 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 JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. +Jersey is used as JAX-RS implementation, `io.swagger:swagger-jersey2-jaxrs` is used to derive the OpenAPI Specification from the annotated code. To run the server, please execute the following: @@ -13,10 +14,10 @@ To run the server, please execute the following: mvn clean package jetty:run ``` -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:8080/v2/openapi.json +http://localhost:8080/v2/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiException.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiException.java index 2d2990bc7f0..e7399cb6037 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiException.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiException.java @@ -1,6 +1,6 @@ package org.openapitools.api; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class ApiException extends Exception{ private int code; public ApiException (int code, String msg) { diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiOriginFilter.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiOriginFilter.java index 96f2e348300..1846c44a429 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiOriginFilter.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiOriginFilter.java @@ -5,7 +5,7 @@ import java.io.IOException; import javax.servlet.*; import javax.servlet.http.HttpServletResponse; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class ApiOriginFilter implements javax.servlet.Filter { public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiResponseMessage.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiResponseMessage.java index d25a2f4d834..42922f13af9 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiResponseMessage.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/ApiResponseMessage.java @@ -3,7 +3,7 @@ package org.openapitools.api; import javax.xml.bind.annotation.XmlTransient; @javax.xml.bind.annotation.XmlRootElement -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class ApiResponseMessage { public static final int ERROR = 1; public static final int WARNING = 2; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/NotFoundException.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/NotFoundException.java index edfc4e392a8..9a192077229 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/NotFoundException.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/NotFoundException.java @@ -1,6 +1,6 @@ package org.openapitools.api; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class NotFoundException extends ApiException { private int code; public NotFoundException (int code, String msg) { diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java index c65b8d422e2..c95d7d206eb 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApi.java @@ -26,12 +26,13 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/pet") @io.swagger.annotations.Api(description = "the pet API") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class PetApi { private final PetApiService delegate; @@ -68,7 +69,7 @@ public class PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @Valid Pet pet ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.addPet(pet,securityContext); @@ -163,7 +164,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @Valid Pet pet ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePet(pet,securityContext); diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java index 95bf11d9b09..ebef4c84276 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/PetApiService.java @@ -17,7 +17,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public abstract class PetApiService { public abstract Response addPet(Pet pet,SecurityContext securityContext) throws NotFoundException; public abstract Response deletePet(Long petId,String apiKey,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApi.java index d0f12395db8..baf6acac6ce 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApi.java @@ -25,12 +25,13 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/store") @io.swagger.annotations.Api(description = "the store API") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class StoreApi { private final StoreApiService delegate; @@ -107,7 +108,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) - public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order order + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) @Valid Order order ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.placeOrder(order,securityContext); diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApiService.java index 13698d783a9..fdcf8c32150 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StoreApiService.java @@ -16,7 +16,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public abstract class StoreApiService { public abstract Response deleteOrder(String orderId,SecurityContext securityContext) throws NotFoundException; public abstract Response getInventory(SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StringUtil.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StringUtil.java index 8810d4383bd..4a37c59f65c 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StringUtil.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/StringUtil.java @@ -1,6 +1,6 @@ package org.openapitools.api; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class StringUtil { /** * Check if the given array contains the given value (with case-insensitive comparison). diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java index 2c5625c2fe4..4dc93d626da 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApi.java @@ -25,12 +25,13 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/user") @io.swagger.annotations.Api(description = "the user API") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class UserApi { private final UserApiService delegate; @@ -62,7 +63,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUser(@ApiParam(value = "Created user object" ,required=true) User user + public Response createUser(@ApiParam(value = "Created user object" ,required=true) @Valid User user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUser(user,securityContext); @@ -74,7 +75,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List user + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) @Valid List user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithArrayInput(user,securityContext); @@ -86,7 +87,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List user + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) @Valid List user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithListInput(user,securityContext); @@ -157,7 +158,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) public Response updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username -,@ApiParam(value = "Updated user object" ,required=true) User user +,@ApiParam(value = "Updated user object" ,required=true) @Valid User user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updateUser(username,user,securityContext); diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApiService.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApiService.java index e5919ae31cb..89ce3629726 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApiService.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/api/UserApiService.java @@ -16,7 +16,7 @@ import java.io.InputStream; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public abstract class UserApiService { public abstract Response createUser(User user,SecurityContext securityContext) throws NotFoundException; public abstract Response createUsersWithArrayInput(List user,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Body.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Body.java new file mode 100644 index 00000000000..bfa9ea3e1ab --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Body.java @@ -0,0 +1,117 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Body + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") +public class Body { + @JsonProperty("name") + private String name = null; + + @JsonProperty("status") + private String status = null; + + public Body name(String name) { + this.name = name; + return this; + } + + /** + * Updated name of the pet + * @return name + **/ + @JsonProperty("name") + @ApiModelProperty(value = "Updated name of the pet") + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Body status(String status) { + this.status = status; + return this; + } + + /** + * Updated status of the pet + * @return status + **/ + @JsonProperty("status") + @ApiModelProperty(value = "Updated status of the pet") + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Body body = (Body) o; + return Objects.equals(this.name, body.name) && + Objects.equals(this.status, body.status); + } + + @Override + public int hashCode() { + return Objects.hash(name, status); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Body {\n"); + + sb.append(" name: ").append(toIndentedString(name)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Body1.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Body1.java new file mode 100644 index 00000000000..51b689445a1 --- /dev/null +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Body1.java @@ -0,0 +1,118 @@ +/* + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * OpenAPI spec version: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.io.File; +import javax.validation.constraints.*; +import javax.validation.Valid; + +/** + * Body1 + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") +public class Body1 { + @JsonProperty("additionalMetadata") + private String additionalMetadata = null; + + @JsonProperty("file") + private File file = null; + + public Body1 additionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + return this; + } + + /** + * Additional data to pass to server + * @return additionalMetadata + **/ + @JsonProperty("additionalMetadata") + @ApiModelProperty(value = "Additional data to pass to server") + + public String getAdditionalMetadata() { + return additionalMetadata; + } + + public void setAdditionalMetadata(String additionalMetadata) { + this.additionalMetadata = additionalMetadata; + } + + public Body1 file(File file) { + this.file = file; + return this; + } + + /** + * file to upload + * @return file + **/ + @JsonProperty("file") + @ApiModelProperty(value = "file to upload") + + public File getFile() { + return file; + } + + public void setFile(File file) { + this.file = file; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Body1 body1 = (Body1) o; + return Objects.equals(this.additionalMetadata, body1.additionalMetadata) && + Objects.equals(this.file, body1.file); + } + + @Override + public int hashCode() { + return Objects.hash(additionalMetadata, file); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Body1 {\n"); + + sb.append(" additionalMetadata: ").append(toIndentedString(additionalMetadata)).append("\n"); + sb.append(" file: ").append(toIndentedString(file)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Category.java index 76cf0f87956..2786cc540c3 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Category.java @@ -19,12 +19,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * A category for a pet */ @ApiModel(description = "A category for a pet") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class Category { @JsonProperty("id") private Long id = null; @@ -43,6 +44,7 @@ public class Category { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -62,6 +64,7 @@ public class Category { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ModelApiResponse.java index 45069447901..2314bbb1aa3 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -19,12 +19,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Describes the result of uploading an image resource */ @ApiModel(description = "Describes the result of uploading an image resource") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class ModelApiResponse { @JsonProperty("code") private Integer code = null; @@ -46,6 +47,7 @@ public class ModelApiResponse { **/ @JsonProperty("code") @ApiModelProperty(value = "") + public Integer getCode() { return code; } @@ -65,6 +67,7 @@ public class ModelApiResponse { **/ @JsonProperty("type") @ApiModelProperty(value = "") + public String getType() { return type; } @@ -84,6 +87,7 @@ public class ModelApiResponse { **/ @JsonProperty("message") @ApiModelProperty(value = "") + public String getMessage() { return message; } diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Order.java index 1f1c23188d1..3b5b04cbaea 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Order.java @@ -21,12 +21,13 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.Date; import javax.validation.constraints.*; +import javax.validation.Valid; /** * An order for a pets from the pet store */ @ApiModel(description = "An order for a pets from the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class Order { @JsonProperty("id") private Long id = null; @@ -90,6 +91,7 @@ public class Order { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -109,6 +111,7 @@ public class Order { **/ @JsonProperty("petId") @ApiModelProperty(value = "") + public Long getPetId() { return petId; } @@ -128,6 +131,7 @@ public class Order { **/ @JsonProperty("quantity") @ApiModelProperty(value = "") + public Integer getQuantity() { return quantity; } @@ -147,6 +151,7 @@ public class Order { **/ @JsonProperty("shipDate") @ApiModelProperty(value = "") + public Date getShipDate() { return shipDate; } @@ -166,6 +171,7 @@ public class Order { **/ @JsonProperty("status") @ApiModelProperty(value = "Order Status") + public StatusEnum getStatus() { return status; } @@ -185,6 +191,7 @@ public class Order { **/ @JsonProperty("complete") @ApiModelProperty(value = "") + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Pet.java index 96271292913..40c15af5f23 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Pet.java @@ -24,12 +24,13 @@ import java.util.List; import org.openapitools.model.Category; import org.openapitools.model.Tag; import javax.validation.constraints.*; +import javax.validation.Valid; /** * A pet for sale in the pet store */ @ApiModel(description = "A pet for sale in the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class Pet { @JsonProperty("id") private Long id = null; @@ -93,6 +94,7 @@ public class Pet { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -112,6 +114,7 @@ public class Pet { **/ @JsonProperty("category") @ApiModelProperty(value = "") + @Valid public Category getCategory() { return category; } @@ -131,7 +134,8 @@ public class Pet { **/ @JsonProperty("name") @ApiModelProperty(example = "doggie", required = true, value = "") - @NotNull + @NotNull + public String getName() { return name; } @@ -156,7 +160,8 @@ public class Pet { **/ @JsonProperty("photoUrls") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public List getPhotoUrls() { return photoUrls; } @@ -184,6 +189,7 @@ public class Pet { **/ @JsonProperty("tags") @ApiModelProperty(value = "") + @Valid public List getTags() { return tags; } @@ -203,6 +209,7 @@ public class Pet { **/ @JsonProperty("status") @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Tag.java index 5d78706d8f4..0e3d096b04f 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/Tag.java @@ -19,12 +19,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * A tag for a pet */ @ApiModel(description = "A tag for a pet") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class Tag { @JsonProperty("id") private Long id = null; @@ -43,6 +44,7 @@ public class Tag { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -62,6 +64,7 @@ public class Tag { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/User.java index 3709c050508..8e573622cde 100644 --- a/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-jersey/src/gen/java/org/openapitools/model/User.java @@ -19,12 +19,13 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * A User who is purchasing from the pet store */ @ApiModel(description = "A User who is purchasing from the pet store") -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class User { @JsonProperty("id") private Long id = null; @@ -61,6 +62,7 @@ public class User { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -80,6 +82,7 @@ public class User { **/ @JsonProperty("username") @ApiModelProperty(value = "") + public String getUsername() { return username; } @@ -99,6 +102,7 @@ public class User { **/ @JsonProperty("firstName") @ApiModelProperty(value = "") + public String getFirstName() { return firstName; } @@ -118,6 +122,7 @@ public class User { **/ @JsonProperty("lastName") @ApiModelProperty(value = "") + public String getLastName() { return lastName; } @@ -137,6 +142,7 @@ public class User { **/ @JsonProperty("email") @ApiModelProperty(value = "") + public String getEmail() { return email; } @@ -156,6 +162,7 @@ public class User { **/ @JsonProperty("password") @ApiModelProperty(value = "") + public String getPassword() { return password; } @@ -175,6 +182,7 @@ public class User { **/ @JsonProperty("phone") @ApiModelProperty(value = "") + public String getPhone() { return phone; } @@ -194,6 +202,7 @@ public class User { **/ @JsonProperty("userStatus") @ApiModelProperty(value = "User Status") + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java index 5bd95e5f1c0..2c96b853f99 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/PetApiServiceFactory.java @@ -3,7 +3,7 @@ package org.openapitools.api.factories; import org.openapitools.api.PetApiService; import org.openapitools.api.impl.PetApiServiceImpl; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class PetApiServiceFactory { private final static PetApiService service = new PetApiServiceImpl(); diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java index 3a9ab3531af..f08e7e02c25 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/StoreApiServiceFactory.java @@ -3,7 +3,7 @@ package org.openapitools.api.factories; import org.openapitools.api.StoreApiService; import org.openapitools.api.impl.StoreApiServiceImpl; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class StoreApiServiceFactory { private final static StoreApiService service = new StoreApiServiceImpl(); diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java index 12540d9364c..cd4956f5e14 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/factories/UserApiServiceFactory.java @@ -3,7 +3,7 @@ package org.openapitools.api.factories; import org.openapitools.api.UserApiService; import org.openapitools.api.impl.UserApiServiceImpl; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class UserApiServiceFactory { private final static UserApiService service = new UserApiServiceImpl(); diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java index 3ef3488fe8f..47882fec694 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/PetApiServiceImpl.java @@ -17,7 +17,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class PetApiServiceImpl extends PetApiService { @Override public Response addPet(Pet pet, SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java index b4be886cf0c..b22ee3b8dd0 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/StoreApiServiceImpl.java @@ -16,7 +16,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class StoreApiServiceImpl extends StoreApiService { @Override public Response deleteOrder(String orderId, SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java index fb2e323efc6..468ea57b2b0 100644 --- a/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-jersey/src/main/java/org/openapitools/api/impl/UserApiServiceImpl.java @@ -16,7 +16,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; -@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-08-10T15:02:11.723+09:00[Asia/Tokyo]") +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaJerseyServerCodegen", date = "2018-09-12T17:34:16.225+09:00[Asia/Tokyo]") public class UserApiServiceImpl extends UserApiService { @Override public Response createUser(User user, SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs-resteasy/default/README.md b/samples/server/petstore/jaxrs-resteasy/default/README.md index 78b550b6cf3..050351dfcdb 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/README.md +++ b/samples/server/petstore/jaxrs-resteasy/default/README.md @@ -1,22 +1,23 @@ -# Swagger generated server +# JAX-RS/RESTEasy server with OpenAPI ## Overview -This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the -[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This -is an example of building a swagger-enabled JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. +RESTEasy is used as JAX-RS implementation library and is defined as dependency. To run the server, please execute the following: ``` -mvn clean package jetty:run +mvn -Djetty.http.port=8080 package org.eclipse.jetty:jetty-maven-plugin:run ``` -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:8080/v2/openapi.json +http://localhost:8080/v2/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/PetApi.java index 18ff5c22575..b33611ec267 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/api/PetApi.java @@ -80,7 +80,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) - public Response findPetsByStatus( @NotNull @QueryParam("status") List status,@Context SecurityContext securityContext) + public Response findPetsByStatus( @NotNull @DefaultValue("new ArrayList()") @QueryParam("status") List status,@Context SecurityContext securityContext) throws NotFoundException { return service.findPetsByStatus(status,securityContext); } @@ -98,7 +98,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) - public Response findPetsByTags( @NotNull @QueryParam("tags") List tags,@Context SecurityContext securityContext) + public Response findPetsByTags( @NotNull @DefaultValue("new ArrayList()") @QueryParam("tags") List tags,@Context SecurityContext securityContext) throws NotFoundException { return service.findPetsByTags(tags,securityContext); } @@ -151,7 +151,7 @@ public class PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet", defaultValue="null")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet", defaultValue="null")@FormParam("status") String status,@Context SecurityContext securityContext) + public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext) throws NotFoundException { return service.updatePetWithForm(petId,name,status,securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Category.java index 67f137a16ee..e998196f201 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Category.java @@ -12,8 +12,8 @@ import io.swagger.annotations.*; public class Category { - private Long id = null; - private String name = null; + private Long id; + private String name; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/ModelApiResponse.java index c3f9355d2bd..9b695e3abf8 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -12,9 +12,9 @@ import io.swagger.annotations.*; public class ModelApiResponse { - private Integer code = null; - private String type = null; - private String message = null; + private Integer code; + private String type; + private String message; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Order.java index c99d6b4a385..b44d7a4005f 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Order.java @@ -14,10 +14,10 @@ import io.swagger.annotations.*; public class Order { - private Long id = null; - private Long petId = null; - private Integer quantity = null; - private Date shipDate = null; + private Long id; + private Long petId; + private Integer quantity; + private Date shipDate; /** * Order Status @@ -41,7 +41,7 @@ public class Order { } } - private StatusEnum status = null; + private StatusEnum status; private Boolean complete = false; /** diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Pet.java index d749435d67a..2205c845da7 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Pet.java @@ -16,9 +16,9 @@ import io.swagger.annotations.*; public class Pet { - private Long id = null; + private Long id; private Category category = null; - private String name = null; + private String name; private List photoUrls = new ArrayList(); private List tags = new ArrayList(); @@ -44,7 +44,7 @@ public class Pet { } } - private StatusEnum status = null; + private StatusEnum status; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Tag.java index 3ed2cc6d019..d28cc50ac9a 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/Tag.java @@ -12,8 +12,8 @@ import io.swagger.annotations.*; public class Tag { - private Long id = null; - private String name = null; + private Long id; + private String name; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/User.java index 48200bde0bd..e44d59a722d 100644 --- a/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/default/src/gen/java/org/openapitools/model/User.java @@ -12,14 +12,14 @@ import io.swagger.annotations.*; public class User { - private Long id = null; - private String username = null; - private String firstName = null; - private String lastName = null; - private String email = null; - private String password = null; - private String phone = null; - private Integer userStatus = null; + private Long id; + private String username; + private String firstName; + private String lastName; + private String email; + private String password; + private String phone; + private Integer userStatus; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/README.md b/samples/server/petstore/jaxrs-resteasy/eap-java8/README.md index 7bb1cfae220..74db54ed53e 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/README.md +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/README.md @@ -1,18 +1,18 @@ -# Swagger generated server +# JAX-RS/Resteasy server with OpenAPI for Jboss EAP ## Overview -This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the -[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This -is an example of building a swagger-enabled JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework for Jboss Resteasy. You can deploy the WAR file to Jboss EAP or any other JEE server supporting Jboss Resteasy. -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:8080/v2/openapi.json +http://localhost:8080/v2/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/PetApi.java index f654fc9c6c0..0665516ced3 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/api/PetApi.java @@ -127,7 +127,7 @@ public interface PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet", defaultValue="null")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet", defaultValue="null")@FormParam("status") String status,@Context SecurityContext securityContext); + public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext); @POST @Path("/{petId}/uploadImage") @Consumes({ "multipart/form-data" }) diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Category.java index 84e51bd9b68..71c25e4a1d4 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Category.java @@ -14,9 +14,9 @@ import io.swagger.annotations.*; public class Category { - private Long id = null; + private Long id; - private String name = null; + private String name; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/ModelApiResponse.java index 3e791723c8e..8e0946781b5 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -14,11 +14,11 @@ import io.swagger.annotations.*; public class ModelApiResponse { - private Integer code = null; + private Integer code; - private String type = null; + private String type; - private String message = null; + private String message; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Order.java index 222aefce556..e908f1687fe 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Order.java @@ -16,13 +16,13 @@ import io.swagger.annotations.*; public class Order { - private Long id = null; + private Long id; - private Long petId = null; + private Long petId; - private Integer quantity = null; + private Integer quantity; - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -47,7 +47,7 @@ public class Order { } - private StatusEnum status = null; + private StatusEnum status; private Boolean complete = false; diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Pet.java index 2a6edf75d94..c955e3fe148 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Pet.java @@ -19,11 +19,11 @@ import io.swagger.annotations.*; public class Pet { - private Long id = null; + private Long id; private Category category = null; - private String name = null; + private String name; private List photoUrls = new ArrayList<>(); @@ -52,7 +52,7 @@ public class Pet { } - private StatusEnum status = null; + private StatusEnum status; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Tag.java index 0d54bc0df16..77d2c1c0335 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/Tag.java @@ -14,9 +14,9 @@ import io.swagger.annotations.*; public class Tag { - private Long id = null; + private Long id; - private String name = null; + private String name; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/User.java index 115a6b02079..5d637d47457 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-java8/src/gen/java/org/openapitools/model/User.java @@ -14,21 +14,21 @@ import io.swagger.annotations.*; public class User { - private Long id = null; + private Long id; - private String username = null; + private String username; - private String firstName = null; + private String firstName; - private String lastName = null; + private String lastName; - private String email = null; + private String email; - private String password = null; + private String password; - private String phone = null; + private String phone; - private Integer userStatus = null; + private Integer userStatus; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/README.md b/samples/server/petstore/jaxrs-resteasy/eap-joda/README.md index 7bb1cfae220..74db54ed53e 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/README.md +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/README.md @@ -1,18 +1,18 @@ -# Swagger generated server +# JAX-RS/Resteasy server with OpenAPI for Jboss EAP ## Overview -This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the -[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This -is an example of building a swagger-enabled JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework for Jboss Resteasy. You can deploy the WAR file to Jboss EAP or any other JEE server supporting Jboss Resteasy. -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:8080/v2/openapi.json +http://localhost:8080/v2/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/PetApi.java index f654fc9c6c0..0665516ced3 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/api/PetApi.java @@ -127,7 +127,7 @@ public interface PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet", defaultValue="null")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet", defaultValue="null")@FormParam("status") String status,@Context SecurityContext securityContext); + public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext); @POST @Path("/{petId}/uploadImage") @Consumes({ "multipart/form-data" }) diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Category.java index 84e51bd9b68..71c25e4a1d4 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Category.java @@ -14,9 +14,9 @@ import io.swagger.annotations.*; public class Category { - private Long id = null; + private Long id; - private String name = null; + private String name; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/ModelApiResponse.java index 3e791723c8e..8e0946781b5 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -14,11 +14,11 @@ import io.swagger.annotations.*; public class ModelApiResponse { - private Integer code = null; + private Integer code; - private String type = null; + private String type; - private String message = null; + private String message; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Order.java index 0e31589f12d..fd2f8b91c2a 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Order.java @@ -16,13 +16,13 @@ import io.swagger.annotations.*; public class Order { - private Long id = null; + private Long id; - private Long petId = null; + private Long petId; - private Integer quantity = null; + private Integer quantity; - private DateTime shipDate = null; + private DateTime shipDate; /** * Order Status @@ -47,7 +47,7 @@ public class Order { } - private StatusEnum status = null; + private StatusEnum status; private Boolean complete = false; diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Pet.java index 6a685485eb2..6db819ab829 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Pet.java @@ -19,11 +19,11 @@ import io.swagger.annotations.*; public class Pet { - private Long id = null; + private Long id; private Category category = null; - private String name = null; + private String name; private List photoUrls = new ArrayList(); @@ -52,7 +52,7 @@ public class Pet { } - private StatusEnum status = null; + private StatusEnum status; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Tag.java index 0d54bc0df16..77d2c1c0335 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/Tag.java @@ -14,9 +14,9 @@ import io.swagger.annotations.*; public class Tag { - private Long id = null; + private Long id; - private String name = null; + private String name; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/User.java index 115a6b02079..5d637d47457 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/eap-joda/src/gen/java/org/openapitools/model/User.java @@ -14,21 +14,21 @@ import io.swagger.annotations.*; public class User { - private Long id = null; + private Long id; - private String username = null; + private String username; - private String firstName = null; + private String firstName; - private String lastName = null; + private String lastName; - private String email = null; + private String email; - private String password = null; + private String password; - private String phone = null; + private String phone; - private Integer userStatus = null; + private Integer userStatus; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap/README.md b/samples/server/petstore/jaxrs-resteasy/eap/README.md index 7bb1cfae220..74db54ed53e 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/README.md +++ b/samples/server/petstore/jaxrs-resteasy/eap/README.md @@ -1,18 +1,18 @@ -# Swagger generated server +# JAX-RS/Resteasy server with OpenAPI for Jboss EAP ## Overview -This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the -[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This -is an example of building a swagger-enabled JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework for Jboss Resteasy. You can deploy the WAR file to Jboss EAP or any other JEE server supporting Jboss Resteasy. -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:8080/v2/openapi.json +http://localhost:8080/v2/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/PetApi.java index f654fc9c6c0..0665516ced3 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/api/PetApi.java @@ -127,7 +127,7 @@ public interface PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet", defaultValue="null")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet", defaultValue="null")@FormParam("status") String status,@Context SecurityContext securityContext); + public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext); @POST @Path("/{petId}/uploadImage") @Consumes({ "multipart/form-data" }) diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Category.java index 84e51bd9b68..71c25e4a1d4 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Category.java @@ -14,9 +14,9 @@ import io.swagger.annotations.*; public class Category { - private Long id = null; + private Long id; - private String name = null; + private String name; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/ModelApiResponse.java index 3e791723c8e..8e0946781b5 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -14,11 +14,11 @@ import io.swagger.annotations.*; public class ModelApiResponse { - private Integer code = null; + private Integer code; - private String type = null; + private String type; - private String message = null; + private String message; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Order.java index 9b6a7679052..c49459bd273 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Order.java @@ -16,13 +16,13 @@ import io.swagger.annotations.*; public class Order { - private Long id = null; + private Long id; - private Long petId = null; + private Long petId; - private Integer quantity = null; + private Integer quantity; - private Date shipDate = null; + private Date shipDate; /** * Order Status @@ -47,7 +47,7 @@ public class Order { } - private StatusEnum status = null; + private StatusEnum status; private Boolean complete = false; diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Pet.java index 6a685485eb2..6db819ab829 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Pet.java @@ -19,11 +19,11 @@ import io.swagger.annotations.*; public class Pet { - private Long id = null; + private Long id; private Category category = null; - private String name = null; + private String name; private List photoUrls = new ArrayList(); @@ -52,7 +52,7 @@ public class Pet { } - private StatusEnum status = null; + private StatusEnum status; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Tag.java index 0d54bc0df16..77d2c1c0335 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/Tag.java @@ -14,9 +14,9 @@ import io.swagger.annotations.*; public class Tag { - private Long id = null; + private Long id; - private String name = null; + private String name; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/User.java index 115a6b02079..5d637d47457 100644 --- a/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/eap/src/gen/java/org/openapitools/model/User.java @@ -14,21 +14,21 @@ import io.swagger.annotations.*; public class User { - private Long id = null; + private Long id; - private String username = null; + private String username; - private String firstName = null; + private String firstName; - private String lastName = null; + private String lastName; - private String email = null; + private String email; - private String password = null; + private String password; - private String phone = null; + private String phone; - private Integer userStatus = null; + private Integer userStatus; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/joda/README.md b/samples/server/petstore/jaxrs-resteasy/joda/README.md index 78b550b6cf3..050351dfcdb 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/README.md +++ b/samples/server/petstore/jaxrs-resteasy/joda/README.md @@ -1,22 +1,23 @@ -# Swagger generated server +# JAX-RS/RESTEasy server with OpenAPI ## Overview -This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the -[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This -is an example of building a swagger-enabled JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. +RESTEasy is used as JAX-RS implementation library and is defined as dependency. To run the server, please execute the following: ``` -mvn clean package jetty:run +mvn -Djetty.http.port=8080 package org.eclipse.jetty:jetty-maven-plugin:run ``` -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:8080/v2/openapi.json +http://localhost:8080/v2/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/PetApi.java index 18ff5c22575..b33611ec267 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/api/PetApi.java @@ -80,7 +80,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) - public Response findPetsByStatus( @NotNull @QueryParam("status") List status,@Context SecurityContext securityContext) + public Response findPetsByStatus( @NotNull @DefaultValue("new ArrayList()") @QueryParam("status") List status,@Context SecurityContext securityContext) throws NotFoundException { return service.findPetsByStatus(status,securityContext); } @@ -98,7 +98,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) - public Response findPetsByTags( @NotNull @QueryParam("tags") List tags,@Context SecurityContext securityContext) + public Response findPetsByTags( @NotNull @DefaultValue("new ArrayList()") @QueryParam("tags") List tags,@Context SecurityContext securityContext) throws NotFoundException { return service.findPetsByTags(tags,securityContext); } @@ -151,7 +151,7 @@ public class PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet", defaultValue="null")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet", defaultValue="null")@FormParam("status") String status,@Context SecurityContext securityContext) + public Response updatePetWithForm( @PathParam("petId") Long petId,@ApiParam(value = "Updated name of the pet")@FormParam("name") String name,@ApiParam(value = "Updated status of the pet")@FormParam("status") String status,@Context SecurityContext securityContext) throws NotFoundException { return service.updatePetWithForm(petId,name,status,securityContext); } diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Category.java index 67f137a16ee..e998196f201 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Category.java @@ -12,8 +12,8 @@ import io.swagger.annotations.*; public class Category { - private Long id = null; - private String name = null; + private Long id; + private String name; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/ModelApiResponse.java index c3f9355d2bd..9b695e3abf8 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -12,9 +12,9 @@ import io.swagger.annotations.*; public class ModelApiResponse { - private Integer code = null; - private String type = null; - private String message = null; + private Integer code; + private String type; + private String message; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Order.java index 9104901479e..2f2fe290ece 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Order.java @@ -14,10 +14,10 @@ import io.swagger.annotations.*; public class Order { - private Long id = null; - private Long petId = null; - private Integer quantity = null; - private DateTime shipDate = null; + private Long id; + private Long petId; + private Integer quantity; + private DateTime shipDate; /** * Order Status @@ -41,7 +41,7 @@ public class Order { } } - private StatusEnum status = null; + private StatusEnum status; private Boolean complete = false; /** diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Pet.java index d749435d67a..2205c845da7 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Pet.java @@ -16,9 +16,9 @@ import io.swagger.annotations.*; public class Pet { - private Long id = null; + private Long id; private Category category = null; - private String name = null; + private String name; private List photoUrls = new ArrayList(); private List tags = new ArrayList(); @@ -44,7 +44,7 @@ public class Pet { } } - private StatusEnum status = null; + private StatusEnum status; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Tag.java index 3ed2cc6d019..d28cc50ac9a 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/Tag.java @@ -12,8 +12,8 @@ import io.swagger.annotations.*; public class Tag { - private Long id = null; - private String name = null; + private Long id; + private String name; /** **/ diff --git a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/User.java index 48200bde0bd..e44d59a722d 100644 --- a/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-resteasy/joda/src/gen/java/org/openapitools/model/User.java @@ -12,14 +12,14 @@ import io.swagger.annotations.*; public class User { - private Long id = null; - private String username = null; - private String firstName = null; - private String lastName = null; - private String email = null; - private String password = null; - private String phone = null; - private Integer userStatus = null; + private Long id; + private String username; + private String firstName; + private String lastName; + private String email; + private String password; + private String phone; + private Integer userStatus; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/.openapi-generator/VERSION b/samples/server/petstore/jaxrs-spec-interface-response/.openapi-generator/VERSION index 105bb87d77b..6d94c9c2e12 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/.openapi-generator/VERSION +++ b/samples/server/petstore/jaxrs-spec-interface-response/.openapi-generator/VERSION @@ -1 +1 @@ -3.2.2-SNAPSHOT \ No newline at end of file +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/jaxrs-spec-interface-response/README.md b/samples/server/petstore/jaxrs-spec-interface-response/README.md new file mode 100644 index 00000000000..553be1f4b16 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface-response/README.md @@ -0,0 +1,12 @@ +# JAX-RS server with OpenAPI + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. + +This is an example of building a OpenAPI-enabled JAX-RS server. +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. + +This project produces a jar that defines some interfaces. +The jar can be used in combination with an other project providing the implementation. + diff --git a/samples/server/petstore/jaxrs-spec-interface-response/pom.xml b/samples/server/petstore/jaxrs-spec-interface-response/pom.xml index 85d300fd6c0..5e714682253 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/pom.xml +++ b/samples/server/petstore/jaxrs-spec-interface-response/pom.xml @@ -8,11 +8,6 @@ src/main/java - - org.apache.maven.plugins - maven-jar-plugin - 2.2 - org.codehaus.mojo build-helper-maven-plugin @@ -32,33 +27,36 @@ + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + javax.ws.rs javax.ws.rs-api - 2.1 + 2.1.1 provided + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson-version} + io.swagger swagger-annotations provided 1.5.3 - - com.fasterxml.jackson.core - jackson-annotations - ${jackson-version} - provided - - - joda-time - joda-time - ${jodatime-version} - provided - junit junit @@ -74,8 +72,7 @@ - 4.8.1 2.8.9 - 2.9.9 + 4.8.1 diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/api/FakeApi.java index f6e871ac85d..fed7bbc7f69 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/api/FakeApi.java @@ -98,7 +98,7 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) - Response testEnumParameters(@HeaderParam("enum_header_string_array") @ApiParam("Header parameter enum test (string array)") List enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") @ApiParam("Header parameter enum test (string)") String enumHeaderString,@QueryParam("enum_query_string_array") @ApiParam("Query parameter enum test (string array)") List enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString); + Response testEnumParameters(@HeaderParam("enum_header_string_array") @DefaultValue("new ArrayList()") @ApiParam("Header parameter enum test (string array)") List enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") @ApiParam("Header parameter enum test (string)") String enumHeaderString,@QueryParam("enum_query_string_array") @DefaultValue("new ArrayList()") @ApiParam("Query parameter enum test (string array)") List enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString); @POST @Path("/inline-additionalProperties") diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/api/PetApi.java index 3b9b003dc30..db4be50f07b 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/api/PetApi.java @@ -55,7 +55,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid status value", response = Void.class, responseContainer = "List") }) - Response findPetsByStatus(@QueryParam("status") @NotNull @ApiParam("Status values that need to be considered for filter") List status); + Response findPetsByStatus(@QueryParam("status") @NotNull @DefaultValue("new ArrayList()") @ApiParam("Status values that need to be considered for filter") List status); @GET @Path("/findByTags") @@ -69,7 +69,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid tag value", response = Void.class, responseContainer = "List") }) - Response findPetsByTags(@QueryParam("tags") @NotNull @ApiParam("Tags to filter by") List tags); + Response findPetsByTags(@QueryParam("tags") @NotNull @DefaultValue("new ArrayList()") @ApiParam("Tags to filter by") List tags); @GET @Path("/{petId}") diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Animal.java index 3ea215fd3de..8b2e9658341 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Animal.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Animal implements Serializable { - private @Valid String className = null; + private @Valid String className; private @Valid String color = "red"; /** diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Capitalization.java index db53f3c49bd..5ca325b2667 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Capitalization.java @@ -16,12 +16,12 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Capitalization implements Serializable { - private @Valid String smallCamel = null; - private @Valid String capitalCamel = null; - private @Valid String smallSnake = null; - private @Valid String capitalSnake = null; - private @Valid String scAETHFlowPoints = null; - private @Valid String ATT_NAME = null; + private @Valid String smallCamel; + private @Valid String capitalCamel; + private @Valid String smallSnake; + private @Valid String capitalSnake; + private @Valid String scAETHFlowPoints; + private @Valid String ATT_NAME; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Cat.java index 501e9c7d2c2..9bfcfde280c 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Cat.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Cat extends Animal implements Serializable { - private @Valid Boolean declawed = null; + private @Valid Boolean declawed; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Category.java index b31e9f551c8..4c665566958 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Category.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Category implements Serializable { - private @Valid Long id = null; - private @Valid String name = null; + private @Valid Long id; + private @Valid String name; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ClassModel.java index 87a1c546c19..5f7e3d649ce 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ClassModel.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonValue; @ApiModel(description = "Model for testing model with \"_class\" property") public class ClassModel implements Serializable { - private @Valid String propertyClass = null; + private @Valid String propertyClass; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Client.java index 56914b24020..92b6aed4de6 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Client.java @@ -16,7 +16,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Client implements Serializable { - private @Valid String client = null; + private @Valid String client; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Dog.java index 79c4f948f92..d22452d2d87 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Dog.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Dog extends Animal implements Serializable { - private @Valid String breed = null; + private @Valid String breed; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/EnumArrays.java index a2003eef8b9..ea468a71fc0 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/EnumArrays.java @@ -51,7 +51,7 @@ public enum JustSymbolEnum { } } - private @Valid JustSymbolEnum justSymbol = null; + private @Valid JustSymbolEnum justSymbol; public enum ArrayEnumEnum { diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/EnumTest.java index ce852c9d3e0..d3f41560189 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/EnumTest.java @@ -50,7 +50,7 @@ public enum EnumStringEnum { } } - private @Valid EnumStringEnum enumString = null; + private @Valid EnumStringEnum enumString; public enum EnumStringRequiredEnum { @@ -84,7 +84,7 @@ public enum EnumStringRequiredEnum { } } - private @Valid EnumStringRequiredEnum enumStringRequired = null; + private @Valid EnumStringRequiredEnum enumStringRequired; public enum EnumIntegerEnum { @@ -118,7 +118,7 @@ public enum EnumIntegerEnum { } } - private @Valid EnumIntegerEnum enumInteger = null; + private @Valid EnumIntegerEnum enumInteger; public enum EnumNumberEnum { @@ -152,7 +152,7 @@ public enum EnumNumberEnum { } } - private @Valid EnumNumberEnum enumNumber = null; + private @Valid EnumNumberEnum enumNumber; private @Valid OuterEnum outerEnum = null; /** diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/FormatTest.java index 2d4ff70310f..800fe24ff92 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/FormatTest.java @@ -21,19 +21,19 @@ import com.fasterxml.jackson.annotation.JsonValue; public class FormatTest implements Serializable { - private @Valid Integer integer = null; - private @Valid Integer int32 = null; - private @Valid Long int64 = null; - private @Valid BigDecimal number = null; - private @Valid Float _float = null; - private @Valid Double _double = null; - private @Valid String string = null; - private @Valid byte[] _byte = null; - private @Valid File binary = null; - private @Valid LocalDate date = null; - private @Valid Date dateTime = null; - private @Valid UUID uuid = null; - private @Valid String password = null; + private @Valid Integer integer; + private @Valid Integer int32; + private @Valid Long int64; + private @Valid BigDecimal number; + private @Valid Float _float; + private @Valid Double _double; + private @Valid String string; + private @Valid byte[] _byte; + private @Valid File binary; + private @Valid LocalDate date; + private @Valid Date dateTime; + private @Valid UUID uuid; + private @Valid String password; /** * minimum: 10 diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java index 22181446330..03cf3ef7aaa 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class HasOnlyReadOnly implements Serializable { - private @Valid String bar = null; - private @Valid String foo = null; + private @Valid String bar; + private @Valid String foo; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 627a928a17b..dba6f5f403f 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -22,8 +22,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class MixedPropertiesAndAdditionalPropertiesClass implements Serializable { - private @Valid UUID uuid = null; - private @Valid Date dateTime = null; + private @Valid UUID uuid; + private @Valid Date dateTime; private @Valid Map map = new HashMap(); /** diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Model200Response.java index 362ea187e75..d4122c4a2e1 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Model200Response.java @@ -18,8 +18,8 @@ import com.fasterxml.jackson.annotation.JsonValue; @ApiModel(description = "Model for testing model name starting with number") public class Model200Response implements Serializable { - private @Valid Integer name = null; - private @Valid String propertyClass = null; + private @Valid Integer name; + private @Valid String propertyClass; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ModelApiResponse.java index 57705be9cd5..ab53e369365 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -16,9 +16,9 @@ import com.fasterxml.jackson.annotation.JsonValue; public class ModelApiResponse implements Serializable { - private @Valid Integer code = null; - private @Valid String type = null; - private @Valid String message = null; + private @Valid Integer code; + private @Valid String type; + private @Valid String message; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ModelReturn.java index 4d0ad8278e4..90f40a248f2 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ModelReturn.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonValue; @ApiModel(description = "Model for testing reserved words") public class ModelReturn implements Serializable { - private @Valid Integer _return = null; + private @Valid Integer _return; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Name.java index 7dfe13b2cb9..bab48c428e6 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Name.java @@ -18,10 +18,10 @@ import com.fasterxml.jackson.annotation.JsonValue; @ApiModel(description = "Model for testing model name same as property name") public class Name implements Serializable { - private @Valid Integer name = null; - private @Valid Integer snakeCase = null; - private @Valid String property = null; - private @Valid Integer _123number = null; + private @Valid Integer name; + private @Valid Integer snakeCase; + private @Valid String property; + private @Valid Integer _123number; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/NumberOnly.java index bec8bbd4669..000db43f091 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/NumberOnly.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class NumberOnly implements Serializable { - private @Valid BigDecimal justNumber = null; + private @Valid BigDecimal justNumber; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Order.java index 4351bf39098..dc35e75e011 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Order.java @@ -17,10 +17,10 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Order implements Serializable { - private @Valid Long id = null; - private @Valid Long petId = null; - private @Valid Integer quantity = null; - private @Valid Date shipDate = null; + private @Valid Long id; + private @Valid Long petId; + private @Valid Integer quantity; + private @Valid Date shipDate; public enum StatusEnum { @@ -54,7 +54,7 @@ public enum StatusEnum { } } - private @Valid StatusEnum status = null; + private @Valid StatusEnum status; private @Valid Boolean complete = false; /** diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/OuterComposite.java index 37d163744cb..9ae89e7a285 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/OuterComposite.java @@ -17,9 +17,9 @@ import com.fasterxml.jackson.annotation.JsonValue; public class OuterComposite implements Serializable { - private @Valid BigDecimal myNumber = null; - private @Valid String myString = null; - private @Valid Boolean myBoolean = null; + private @Valid BigDecimal myNumber; + private @Valid String myString; + private @Valid Boolean myBoolean; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Pet.java index 6b669e30995..6c5f3319798 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Pet.java @@ -20,9 +20,9 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Pet implements Serializable { - private @Valid Long id = null; + private @Valid Long id; private @Valid Category category = null; - private @Valid String name = null; + private @Valid String name; private @Valid List photoUrls = new ArrayList(); private @Valid List tags = new ArrayList(); @@ -58,7 +58,7 @@ public enum StatusEnum { } } - private @Valid StatusEnum status = null; + private @Valid StatusEnum status; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ReadOnlyFirst.java index 02c8630a47f..031ee7cf9f1 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class ReadOnlyFirst implements Serializable { - private @Valid String bar = null; - private @Valid String baz = null; + private @Valid String bar; + private @Valid String baz; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/SpecialModelName.java index d57dd6da2b2..9d589d25a4b 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -16,7 +16,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class SpecialModelName implements Serializable { - private @Valid Long $specialPropertyName = null; + private @Valid Long $specialPropertyName; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Tag.java index 3c8f6153974..15e81930db2 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/Tag.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Tag implements Serializable { - private @Valid Long id = null; - private @Valid String name = null; + private @Valid Long id; + private @Valid String name; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/User.java index 2e0a3d03321..2b3123ad16b 100644 --- a/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-spec-interface-response/src/gen/java/org/openapitools/model/User.java @@ -16,14 +16,14 @@ import com.fasterxml.jackson.annotation.JsonValue; public class User implements Serializable { - private @Valid Long id = null; - private @Valid String username = null; - private @Valid String firstName = null; - private @Valid String lastName = null; - private @Valid String email = null; - private @Valid String password = null; - private @Valid String phone = null; - private @Valid Integer userStatus = null; + private @Valid Long id; + private @Valid String username; + private @Valid String firstName; + private @Valid String lastName; + private @Valid String email; + private @Valid String password; + private @Valid String phone; + private @Valid Integer userStatus; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/README.md b/samples/server/petstore/jaxrs-spec-interface/README.md new file mode 100644 index 00000000000..553be1f4b16 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec-interface/README.md @@ -0,0 +1,12 @@ +# JAX-RS server with OpenAPI + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. + +This is an example of building a OpenAPI-enabled JAX-RS server. +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. + +This project produces a jar that defines some interfaces. +The jar can be used in combination with an other project providing the implementation. + diff --git a/samples/server/petstore/jaxrs-spec-interface/pom.xml b/samples/server/petstore/jaxrs-spec-interface/pom.xml index 7bf659704fe..07b76701323 100644 --- a/samples/server/petstore/jaxrs-spec-interface/pom.xml +++ b/samples/server/petstore/jaxrs-spec-interface/pom.xml @@ -8,11 +8,6 @@ src/main/java - - org.apache.maven.plugins - maven-jar-plugin - 2.2 - org.codehaus.mojo build-helper-maven-plugin @@ -32,33 +27,36 @@ + + org.apache.maven.plugins + maven-jar-plugin + 2.2 + javax.ws.rs javax.ws.rs-api - 2.1 + 2.1.1 provided + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson-version} + io.swagger swagger-annotations provided 1.5.3 - - com.fasterxml.jackson.core - jackson-annotations - ${jackson-version} - provided - - - joda-time - joda-time - ${jodatime-version} - provided - junit junit @@ -74,8 +72,7 @@ - 4.8.1 2.8.9 - 2.9.9 + 4.8.1 diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/api/FakeApi.java index 1a7f5a8084c..b156fb2edfc 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/api/FakeApi.java @@ -98,7 +98,7 @@ public interface FakeApi { @ApiResponses(value = { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) - void testEnumParameters(@HeaderParam("enum_header_string_array") @ApiParam("Header parameter enum test (string array)") List enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") @ApiParam("Header parameter enum test (string)") String enumHeaderString,@QueryParam("enum_query_string_array") @ApiParam("Query parameter enum test (string array)") List enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString); + void testEnumParameters(@HeaderParam("enum_header_string_array") @DefaultValue("new ArrayList()") @ApiParam("Header parameter enum test (string array)") List enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") @ApiParam("Header parameter enum test (string)") String enumHeaderString,@QueryParam("enum_query_string_array") @DefaultValue("new ArrayList()") @ApiParam("Query parameter enum test (string array)") List enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString); @POST @Path("/inline-additionalProperties") diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/api/PetApi.java index 87ddda4bcb5..6f3639796b4 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/api/PetApi.java @@ -55,7 +55,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid status value", response = Void.class, responseContainer = "List") }) - List findPetsByStatus(@QueryParam("status") @NotNull @ApiParam("Status values that need to be considered for filter") List status); + List findPetsByStatus(@QueryParam("status") @NotNull @DefaultValue("new ArrayList()") @ApiParam("Status values that need to be considered for filter") List status); @GET @Path("/findByTags") @@ -69,7 +69,7 @@ public interface PetApi { @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid tag value", response = Void.class, responseContainer = "List") }) - List findPetsByTags(@QueryParam("tags") @NotNull @ApiParam("Tags to filter by") List tags); + List findPetsByTags(@QueryParam("tags") @NotNull @DefaultValue("new ArrayList()") @ApiParam("Tags to filter by") List tags); @GET @Path("/{petId}") diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Animal.java index 3ea215fd3de..8b2e9658341 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Animal.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Animal implements Serializable { - private @Valid String className = null; + private @Valid String className; private @Valid String color = "red"; /** diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Capitalization.java index db53f3c49bd..5ca325b2667 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Capitalization.java @@ -16,12 +16,12 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Capitalization implements Serializable { - private @Valid String smallCamel = null; - private @Valid String capitalCamel = null; - private @Valid String smallSnake = null; - private @Valid String capitalSnake = null; - private @Valid String scAETHFlowPoints = null; - private @Valid String ATT_NAME = null; + private @Valid String smallCamel; + private @Valid String capitalCamel; + private @Valid String smallSnake; + private @Valid String capitalSnake; + private @Valid String scAETHFlowPoints; + private @Valid String ATT_NAME; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Cat.java index 501e9c7d2c2..9bfcfde280c 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Cat.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Cat extends Animal implements Serializable { - private @Valid Boolean declawed = null; + private @Valid Boolean declawed; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Category.java index b31e9f551c8..4c665566958 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Category.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Category implements Serializable { - private @Valid Long id = null; - private @Valid String name = null; + private @Valid Long id; + private @Valid String name; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ClassModel.java index 87a1c546c19..5f7e3d649ce 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ClassModel.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonValue; @ApiModel(description = "Model for testing model with \"_class\" property") public class ClassModel implements Serializable { - private @Valid String propertyClass = null; + private @Valid String propertyClass; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Client.java index 56914b24020..92b6aed4de6 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Client.java @@ -16,7 +16,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Client implements Serializable { - private @Valid String client = null; + private @Valid String client; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Dog.java index 79c4f948f92..d22452d2d87 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Dog.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Dog extends Animal implements Serializable { - private @Valid String breed = null; + private @Valid String breed; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/EnumArrays.java index a2003eef8b9..ea468a71fc0 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/EnumArrays.java @@ -51,7 +51,7 @@ public enum JustSymbolEnum { } } - private @Valid JustSymbolEnum justSymbol = null; + private @Valid JustSymbolEnum justSymbol; public enum ArrayEnumEnum { diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/EnumTest.java index ce852c9d3e0..d3f41560189 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/EnumTest.java @@ -50,7 +50,7 @@ public enum EnumStringEnum { } } - private @Valid EnumStringEnum enumString = null; + private @Valid EnumStringEnum enumString; public enum EnumStringRequiredEnum { @@ -84,7 +84,7 @@ public enum EnumStringRequiredEnum { } } - private @Valid EnumStringRequiredEnum enumStringRequired = null; + private @Valid EnumStringRequiredEnum enumStringRequired; public enum EnumIntegerEnum { @@ -118,7 +118,7 @@ public enum EnumIntegerEnum { } } - private @Valid EnumIntegerEnum enumInteger = null; + private @Valid EnumIntegerEnum enumInteger; public enum EnumNumberEnum { @@ -152,7 +152,7 @@ public enum EnumNumberEnum { } } - private @Valid EnumNumberEnum enumNumber = null; + private @Valid EnumNumberEnum enumNumber; private @Valid OuterEnum outerEnum = null; /** diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/FormatTest.java index 2d4ff70310f..800fe24ff92 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/FormatTest.java @@ -21,19 +21,19 @@ import com.fasterxml.jackson.annotation.JsonValue; public class FormatTest implements Serializable { - private @Valid Integer integer = null; - private @Valid Integer int32 = null; - private @Valid Long int64 = null; - private @Valid BigDecimal number = null; - private @Valid Float _float = null; - private @Valid Double _double = null; - private @Valid String string = null; - private @Valid byte[] _byte = null; - private @Valid File binary = null; - private @Valid LocalDate date = null; - private @Valid Date dateTime = null; - private @Valid UUID uuid = null; - private @Valid String password = null; + private @Valid Integer integer; + private @Valid Integer int32; + private @Valid Long int64; + private @Valid BigDecimal number; + private @Valid Float _float; + private @Valid Double _double; + private @Valid String string; + private @Valid byte[] _byte; + private @Valid File binary; + private @Valid LocalDate date; + private @Valid Date dateTime; + private @Valid UUID uuid; + private @Valid String password; /** * minimum: 10 diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java index 22181446330..03cf3ef7aaa 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class HasOnlyReadOnly implements Serializable { - private @Valid String bar = null; - private @Valid String foo = null; + private @Valid String bar; + private @Valid String foo; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MapTest.java index d0e0137e210..76b7ba53793 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MapTest.java @@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import java.io.Serializable; import javax.validation.constraints.*; import javax.validation.Valid; @@ -56,7 +55,7 @@ public enum InnerEnum { private @Valid Map mapOfEnumString = new HashMap(); private @Valid Map directMap = new HashMap(); - private @Valid StringBooleanMap indirectMap = null; + private @Valid Map indirectMap = new HashMap(); /** **/ @@ -111,7 +110,7 @@ public enum InnerEnum { /** **/ - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } @@ -119,10 +118,10 @@ public enum InnerEnum { @ApiModelProperty(value = "") @JsonProperty("indirect_map") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 627a928a17b..dba6f5f403f 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -22,8 +22,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class MixedPropertiesAndAdditionalPropertiesClass implements Serializable { - private @Valid UUID uuid = null; - private @Valid Date dateTime = null; + private @Valid UUID uuid; + private @Valid Date dateTime; private @Valid Map map = new HashMap(); /** diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Model200Response.java index 362ea187e75..d4122c4a2e1 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Model200Response.java @@ -18,8 +18,8 @@ import com.fasterxml.jackson.annotation.JsonValue; @ApiModel(description = "Model for testing model name starting with number") public class Model200Response implements Serializable { - private @Valid Integer name = null; - private @Valid String propertyClass = null; + private @Valid Integer name; + private @Valid String propertyClass; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ModelApiResponse.java index 57705be9cd5..ab53e369365 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -16,9 +16,9 @@ import com.fasterxml.jackson.annotation.JsonValue; public class ModelApiResponse implements Serializable { - private @Valid Integer code = null; - private @Valid String type = null; - private @Valid String message = null; + private @Valid Integer code; + private @Valid String type; + private @Valid String message; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ModelReturn.java index 4d0ad8278e4..90f40a248f2 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ModelReturn.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonValue; @ApiModel(description = "Model for testing reserved words") public class ModelReturn implements Serializable { - private @Valid Integer _return = null; + private @Valid Integer _return; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Name.java index 7dfe13b2cb9..bab48c428e6 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Name.java @@ -18,10 +18,10 @@ import com.fasterxml.jackson.annotation.JsonValue; @ApiModel(description = "Model for testing model name same as property name") public class Name implements Serializable { - private @Valid Integer name = null; - private @Valid Integer snakeCase = null; - private @Valid String property = null; - private @Valid Integer _123number = null; + private @Valid Integer name; + private @Valid Integer snakeCase; + private @Valid String property; + private @Valid Integer _123number; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/NumberOnly.java index bec8bbd4669..000db43f091 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/NumberOnly.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class NumberOnly implements Serializable { - private @Valid BigDecimal justNumber = null; + private @Valid BigDecimal justNumber; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Order.java index 4351bf39098..dc35e75e011 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Order.java @@ -17,10 +17,10 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Order implements Serializable { - private @Valid Long id = null; - private @Valid Long petId = null; - private @Valid Integer quantity = null; - private @Valid Date shipDate = null; + private @Valid Long id; + private @Valid Long petId; + private @Valid Integer quantity; + private @Valid Date shipDate; public enum StatusEnum { @@ -54,7 +54,7 @@ public enum StatusEnum { } } - private @Valid StatusEnum status = null; + private @Valid StatusEnum status; private @Valid Boolean complete = false; /** diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/OuterComposite.java index 37d163744cb..9ae89e7a285 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/OuterComposite.java @@ -17,9 +17,9 @@ import com.fasterxml.jackson.annotation.JsonValue; public class OuterComposite implements Serializable { - private @Valid BigDecimal myNumber = null; - private @Valid String myString = null; - private @Valid Boolean myBoolean = null; + private @Valid BigDecimal myNumber; + private @Valid String myString; + private @Valid Boolean myBoolean; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Pet.java index 6b669e30995..6c5f3319798 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Pet.java @@ -20,9 +20,9 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Pet implements Serializable { - private @Valid Long id = null; + private @Valid Long id; private @Valid Category category = null; - private @Valid String name = null; + private @Valid String name; private @Valid List photoUrls = new ArrayList(); private @Valid List tags = new ArrayList(); @@ -58,7 +58,7 @@ public enum StatusEnum { } } - private @Valid StatusEnum status = null; + private @Valid StatusEnum status; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ReadOnlyFirst.java index 02c8630a47f..031ee7cf9f1 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class ReadOnlyFirst implements Serializable { - private @Valid String bar = null; - private @Valid String baz = null; + private @Valid String bar; + private @Valid String baz; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/SpecialModelName.java index d57dd6da2b2..9d589d25a4b 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -16,7 +16,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class SpecialModelName implements Serializable { - private @Valid Long $specialPropertyName = null; + private @Valid Long $specialPropertyName; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Tag.java index 3c8f6153974..15e81930db2 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/Tag.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Tag implements Serializable { - private @Valid Long id = null; - private @Valid String name = null; + private @Valid Long id; + private @Valid String name; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/User.java index 2e0a3d03321..2b3123ad16b 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-spec-interface/src/gen/java/org/openapitools/model/User.java @@ -16,14 +16,14 @@ import com.fasterxml.jackson.annotation.JsonValue; public class User implements Serializable { - private @Valid Long id = null; - private @Valid String username = null; - private @Valid String firstName = null; - private @Valid String lastName = null; - private @Valid String email = null; - private @Valid String password = null; - private @Valid String phone = null; - private @Valid Integer userStatus = null; + private @Valid Long id; + private @Valid String username; + private @Valid String firstName; + private @Valid String lastName; + private @Valid String email; + private @Valid String password; + private @Valid String phone; + private @Valid Integer userStatus; /** **/ diff --git a/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml index 8ce9975a0aa..dbeef1c2a38 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml @@ -1557,7 +1557,9 @@ components: type: boolean type: object indirect_map: - $ref: '#/components/schemas/StringBooleanMap' + additionalProperties: + type: boolean + type: object type: object Tag: example: diff --git a/samples/server/petstore/jaxrs-spec/README.md b/samples/server/petstore/jaxrs-spec/README.md new file mode 100644 index 00000000000..603301eaf35 --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/README.md @@ -0,0 +1,27 @@ +# JAX-RS server with OpenAPI + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. + +This is an example of building a OpenAPI-enabled JAX-RS server. +This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. + + +The JAX-RS implementation needs to be provided by the application server you are deploying on. + +To run the server from the command line, you can use maven to provision an start a TomEE Server. +Please execute the following: + +``` +mvn -Dtomee-embedded-plugin.http=80 package org.apache.tomee.maven:tomee-embedded-maven-plugin:7.0.5:run +``` + +You can then call your server endpoints under: + +``` +http://localhost:80/v2/ +``` + +Note that if you have configured the `host` to be something other than localhost, the calls through +swagger-ui will be directed to that host and not localhost! diff --git a/samples/server/petstore/jaxrs-spec/pom.xml b/samples/server/petstore/jaxrs-spec/pom.xml index 855d31c209e..21c03b9ad71 100644 --- a/samples/server/petstore/jaxrs-spec/pom.xml +++ b/samples/server/petstore/jaxrs-spec/pom.xml @@ -8,6 +8,25 @@ src/main/java + + org.codehaus.mojo + build-helper-maven-plugin + 1.9.1 + + + add-source + generate-sources + + add-source + + + + src/gen/java + + + + + org.apache.maven.plugins maven-war-plugin @@ -28,52 +47,31 @@ - - org.codehaus.mojo - build-helper-maven-plugin - 1.9.1 - - - add-source - generate-sources - - add-source - - - - src/gen/java - - - - - javax.ws.rs javax.ws.rs-api - 2.1 + 2.1.1 provided + + com.fasterxml.jackson.datatype + jackson-datatype-joda + ${jackson-version} + + + com.fasterxml.jackson.jaxrs + jackson-jaxrs-json-provider + ${jackson-version} + io.swagger swagger-annotations provided 1.5.3 - - com.fasterxml.jackson.core - jackson-annotations - ${jackson-version} - provided - - - joda-time - joda-time - ${jodatime-version} - provided - junit junit @@ -109,8 +107,7 @@ - 4.8.1 2.8.9 - 2.9.9 + 4.8.1 diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FakeApi.java index 0bbd83c106b..d670a9b7c3b 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/FakeApi.java @@ -123,7 +123,7 @@ public class FakeApi { @ApiResponse(code = 400, message = "Invalid request", response = Void.class), @ApiResponse(code = 404, message = "Not found", response = Void.class) }) - public Response testEnumParameters(@HeaderParam("enum_header_string_array") @ApiParam("Header parameter enum test (string array)") List enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") @ApiParam("Header parameter enum test (string)") String enumHeaderString,@QueryParam("enum_query_string_array") @ApiParam("Query parameter enum test (string array)") List enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) { + public Response testEnumParameters(@HeaderParam("enum_header_string_array") @DefaultValue("new ArrayList()") @ApiParam("Header parameter enum test (string array)") List enumHeaderStringArray,@HeaderParam("enum_header_string") @DefaultValue("-efg") @ApiParam("Header parameter enum test (string)") String enumHeaderString,@QueryParam("enum_query_string_array") @DefaultValue("new ArrayList()") @ApiParam("Query parameter enum test (string array)") List enumQueryStringArray,@QueryParam("enum_query_string") @DefaultValue("-efg") @ApiParam("Query parameter enum test (string)") String enumQueryString,@QueryParam("enum_query_integer") @ApiParam("Query parameter enum test (double)") Integer enumQueryInteger,@QueryParam("enum_query_double") @ApiParam("Query parameter enum test (double)") Double enumQueryDouble,@FormParam(value = "enum_form_string_array") List enumFormStringArray,@FormParam(value = "enum_form_string") String enumFormString) { return Response.ok().entity("magic!").build(); } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/PetApi.java index 118344943fa..f545abc5130 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/api/PetApi.java @@ -62,7 +62,7 @@ public class PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) - public Response findPetsByStatus(@QueryParam("status") @NotNull @ApiParam("Status values that need to be considered for filter") List status) { + public Response findPetsByStatus(@QueryParam("status") @NotNull @DefaultValue("new ArrayList()") @ApiParam("Status values that need to be considered for filter") List status) { return Response.ok().entity("magic!").build(); } @@ -79,7 +79,7 @@ public class PetApi { @ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) - public Response findPetsByTags(@QueryParam("tags") @NotNull @ApiParam("Tags to filter by") List tags) { + public Response findPetsByTags(@QueryParam("tags") @NotNull @DefaultValue("new ArrayList()") @ApiParam("Tags to filter by") List tags) { return Response.ok().entity("magic!").build(); } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Animal.java index 3ea215fd3de..8b2e9658341 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Animal.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Animal implements Serializable { - private @Valid String className = null; + private @Valid String className; private @Valid String color = "red"; /** diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Capitalization.java index db53f3c49bd..5ca325b2667 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Capitalization.java @@ -16,12 +16,12 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Capitalization implements Serializable { - private @Valid String smallCamel = null; - private @Valid String capitalCamel = null; - private @Valid String smallSnake = null; - private @Valid String capitalSnake = null; - private @Valid String scAETHFlowPoints = null; - private @Valid String ATT_NAME = null; + private @Valid String smallCamel; + private @Valid String capitalCamel; + private @Valid String smallSnake; + private @Valid String capitalSnake; + private @Valid String scAETHFlowPoints; + private @Valid String ATT_NAME; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Cat.java index 501e9c7d2c2..9bfcfde280c 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Cat.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Cat extends Animal implements Serializable { - private @Valid Boolean declawed = null; + private @Valid Boolean declawed; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Category.java index b31e9f551c8..4c665566958 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Category.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Category implements Serializable { - private @Valid Long id = null; - private @Valid String name = null; + private @Valid Long id; + private @Valid String name; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ClassModel.java index 87a1c546c19..5f7e3d649ce 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ClassModel.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonValue; @ApiModel(description = "Model for testing model with \"_class\" property") public class ClassModel implements Serializable { - private @Valid String propertyClass = null; + private @Valid String propertyClass; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Client.java index 56914b24020..92b6aed4de6 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Client.java @@ -16,7 +16,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Client implements Serializable { - private @Valid String client = null; + private @Valid String client; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Dog.java index 79c4f948f92..d22452d2d87 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Dog.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Dog extends Animal implements Serializable { - private @Valid String breed = null; + private @Valid String breed; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/EnumArrays.java index a2003eef8b9..ea468a71fc0 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/EnumArrays.java @@ -51,7 +51,7 @@ public enum JustSymbolEnum { } } - private @Valid JustSymbolEnum justSymbol = null; + private @Valid JustSymbolEnum justSymbol; public enum ArrayEnumEnum { diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/EnumTest.java index ce852c9d3e0..d3f41560189 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/EnumTest.java @@ -50,7 +50,7 @@ public enum EnumStringEnum { } } - private @Valid EnumStringEnum enumString = null; + private @Valid EnumStringEnum enumString; public enum EnumStringRequiredEnum { @@ -84,7 +84,7 @@ public enum EnumStringRequiredEnum { } } - private @Valid EnumStringRequiredEnum enumStringRequired = null; + private @Valid EnumStringRequiredEnum enumStringRequired; public enum EnumIntegerEnum { @@ -118,7 +118,7 @@ public enum EnumIntegerEnum { } } - private @Valid EnumIntegerEnum enumInteger = null; + private @Valid EnumIntegerEnum enumInteger; public enum EnumNumberEnum { @@ -152,7 +152,7 @@ public enum EnumNumberEnum { } } - private @Valid EnumNumberEnum enumNumber = null; + private @Valid EnumNumberEnum enumNumber; private @Valid OuterEnum outerEnum = null; /** diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/FormatTest.java index 2d4ff70310f..800fe24ff92 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/FormatTest.java @@ -21,19 +21,19 @@ import com.fasterxml.jackson.annotation.JsonValue; public class FormatTest implements Serializable { - private @Valid Integer integer = null; - private @Valid Integer int32 = null; - private @Valid Long int64 = null; - private @Valid BigDecimal number = null; - private @Valid Float _float = null; - private @Valid Double _double = null; - private @Valid String string = null; - private @Valid byte[] _byte = null; - private @Valid File binary = null; - private @Valid LocalDate date = null; - private @Valid Date dateTime = null; - private @Valid UUID uuid = null; - private @Valid String password = null; + private @Valid Integer integer; + private @Valid Integer int32; + private @Valid Long int64; + private @Valid BigDecimal number; + private @Valid Float _float; + private @Valid Double _double; + private @Valid String string; + private @Valid byte[] _byte; + private @Valid File binary; + private @Valid LocalDate date; + private @Valid Date dateTime; + private @Valid UUID uuid; + private @Valid String password; /** * minimum: 10 diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java index 22181446330..03cf3ef7aaa 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class HasOnlyReadOnly implements Serializable { - private @Valid String bar = null; - private @Valid String foo = null; + private @Valid String bar; + private @Valid String foo; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MapTest.java index d0e0137e210..76b7ba53793 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MapTest.java @@ -5,7 +5,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import java.io.Serializable; import javax.validation.constraints.*; import javax.validation.Valid; @@ -56,7 +55,7 @@ public enum InnerEnum { private @Valid Map mapOfEnumString = new HashMap(); private @Valid Map directMap = new HashMap(); - private @Valid StringBooleanMap indirectMap = null; + private @Valid Map indirectMap = new HashMap(); /** **/ @@ -111,7 +110,7 @@ public enum InnerEnum { /** **/ - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } @@ -119,10 +118,10 @@ public enum InnerEnum { @ApiModelProperty(value = "") @JsonProperty("indirect_map") - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 627a928a17b..dba6f5f403f 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -22,8 +22,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class MixedPropertiesAndAdditionalPropertiesClass implements Serializable { - private @Valid UUID uuid = null; - private @Valid Date dateTime = null; + private @Valid UUID uuid; + private @Valid Date dateTime; private @Valid Map map = new HashMap(); /** diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Model200Response.java index 362ea187e75..d4122c4a2e1 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Model200Response.java @@ -18,8 +18,8 @@ import com.fasterxml.jackson.annotation.JsonValue; @ApiModel(description = "Model for testing model name starting with number") public class Model200Response implements Serializable { - private @Valid Integer name = null; - private @Valid String propertyClass = null; + private @Valid Integer name; + private @Valid String propertyClass; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ModelApiResponse.java index 57705be9cd5..ab53e369365 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -16,9 +16,9 @@ import com.fasterxml.jackson.annotation.JsonValue; public class ModelApiResponse implements Serializable { - private @Valid Integer code = null; - private @Valid String type = null; - private @Valid String message = null; + private @Valid Integer code; + private @Valid String type; + private @Valid String message; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ModelReturn.java index 4d0ad8278e4..90f40a248f2 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ModelReturn.java @@ -18,7 +18,7 @@ import com.fasterxml.jackson.annotation.JsonValue; @ApiModel(description = "Model for testing reserved words") public class ModelReturn implements Serializable { - private @Valid Integer _return = null; + private @Valid Integer _return; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Name.java index 7dfe13b2cb9..bab48c428e6 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Name.java @@ -18,10 +18,10 @@ import com.fasterxml.jackson.annotation.JsonValue; @ApiModel(description = "Model for testing model name same as property name") public class Name implements Serializable { - private @Valid Integer name = null; - private @Valid Integer snakeCase = null; - private @Valid String property = null; - private @Valid Integer _123number = null; + private @Valid Integer name; + private @Valid Integer snakeCase; + private @Valid String property; + private @Valid Integer _123number; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/NumberOnly.java index bec8bbd4669..000db43f091 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/NumberOnly.java @@ -17,7 +17,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class NumberOnly implements Serializable { - private @Valid BigDecimal justNumber = null; + private @Valid BigDecimal justNumber; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Order.java index 4351bf39098..dc35e75e011 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Order.java @@ -17,10 +17,10 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Order implements Serializable { - private @Valid Long id = null; - private @Valid Long petId = null; - private @Valid Integer quantity = null; - private @Valid Date shipDate = null; + private @Valid Long id; + private @Valid Long petId; + private @Valid Integer quantity; + private @Valid Date shipDate; public enum StatusEnum { @@ -54,7 +54,7 @@ public enum StatusEnum { } } - private @Valid StatusEnum status = null; + private @Valid StatusEnum status; private @Valid Boolean complete = false; /** diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterComposite.java index 37d163744cb..9ae89e7a285 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/OuterComposite.java @@ -17,9 +17,9 @@ import com.fasterxml.jackson.annotation.JsonValue; public class OuterComposite implements Serializable { - private @Valid BigDecimal myNumber = null; - private @Valid String myString = null; - private @Valid Boolean myBoolean = null; + private @Valid BigDecimal myNumber; + private @Valid String myString; + private @Valid Boolean myBoolean; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Pet.java index 6b669e30995..6c5f3319798 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Pet.java @@ -20,9 +20,9 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Pet implements Serializable { - private @Valid Long id = null; + private @Valid Long id; private @Valid Category category = null; - private @Valid String name = null; + private @Valid String name; private @Valid List photoUrls = new ArrayList(); private @Valid List tags = new ArrayList(); @@ -58,7 +58,7 @@ public enum StatusEnum { } } - private @Valid StatusEnum status = null; + private @Valid StatusEnum status; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ReadOnlyFirst.java index 02c8630a47f..031ee7cf9f1 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class ReadOnlyFirst implements Serializable { - private @Valid String bar = null; - private @Valid String baz = null; + private @Valid String bar; + private @Valid String baz; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/SpecialModelName.java index d57dd6da2b2..9d589d25a4b 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -16,7 +16,7 @@ import com.fasterxml.jackson.annotation.JsonValue; public class SpecialModelName implements Serializable { - private @Valid Long $specialPropertyName = null; + private @Valid Long $specialPropertyName; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Tag.java index 3c8f6153974..15e81930db2 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/Tag.java @@ -16,8 +16,8 @@ import com.fasterxml.jackson.annotation.JsonValue; public class Tag implements Serializable { - private @Valid Long id = null; - private @Valid String name = null; + private @Valid Long id; + private @Valid String name; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/User.java index 2e0a3d03321..2b3123ad16b 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/org/openapitools/model/User.java @@ -16,14 +16,14 @@ import com.fasterxml.jackson.annotation.JsonValue; public class User implements Serializable { - private @Valid Long id = null; - private @Valid String username = null; - private @Valid String firstName = null; - private @Valid String lastName = null; - private @Valid String email = null; - private @Valid String password = null; - private @Valid String phone = null; - private @Valid Integer userStatus = null; + private @Valid Long id; + private @Valid String username; + private @Valid String firstName; + private @Valid String lastName; + private @Valid String email; + private @Valid String password; + private @Valid String phone; + private @Valid Integer userStatus; /** **/ diff --git a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml index 8ce9975a0aa..dbeef1c2a38 100644 --- a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml @@ -1557,7 +1557,9 @@ components: type: boolean type: object indirect_map: - $ref: '#/components/schemas/StringBooleanMap' + additionalProperties: + type: boolean + type: object type: object Tag: example: diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/README.md b/samples/server/petstore/jaxrs/jersey1-useTags/README.md index 87263cc0503..28668de74f6 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/README.md +++ b/samples/server/petstore/jaxrs/jersey1-useTags/README.md @@ -1,11 +1,12 @@ -# Swagger Jersey generated server +# JAX-RS/Jersey server with OpenAPI ## Overview -This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the -[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This -is an example of building a swagger-enabled JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. +Jersey is used as JAX-RS implementation, `io.swagger:swagger-jersey2-jaxrs` is used to derive the OpenAPI Specification from the annotated code. To run the server, please execute the following: @@ -13,10 +14,10 @@ To run the server, please execute the following: mvn clean package jetty:run ``` -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:8082/v2/openapi.json +http://localhost:8082/v2/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/AnotherFakeApi.java index 2a63ee651be..23dd3301380 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -7,9 +7,6 @@ import org.openapitools.api.factories.AnotherFakeApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -import javax.validation.constraints.*; - import org.openapitools.model.Client; import java.util.Map; @@ -25,6 +22,8 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/AnotherFake") @@ -42,7 +41,7 @@ public class AnotherFakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) public Response call123testSpecialTags( - @ApiParam(value = "client model" ,required=true) Client client, + @ApiParam(value = "client model" ,required=true) @Valid Client client, @Context SecurityContext securityContext) throws NotFoundException { return delegate.call123testSpecialTags(client,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/FakeApi.java index ab8255ff378..56c055562fe 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/FakeApi.java @@ -7,9 +7,6 @@ import org.openapitools.api.factories.FakeApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -import javax.validation.constraints.*; - import java.math.BigDecimal; import org.openapitools.model.Client; import java.util.Date; @@ -32,6 +29,8 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/Fake") @@ -49,7 +48,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) public Response fakeOuterBooleanSerialize( - @ApiParam(value = "Input boolean as post body" ) Boolean body, + @ApiParam(value = "Input boolean as post body" ) @Valid Boolean body, @Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterBooleanSerialize(body,securityContext); @@ -62,7 +61,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) public Response fakeOuterCompositeSerialize( - @ApiParam(value = "Input composite as post body" ) OuterComposite outerComposite, + @ApiParam(value = "Input composite as post body" ) @Valid OuterComposite outerComposite, @Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterCompositeSerialize(outerComposite,securityContext); @@ -75,7 +74,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) public Response fakeOuterNumberSerialize( - @ApiParam(value = "Input number as post body" ) BigDecimal body, + @ApiParam(value = "Input number as post body" ) @Valid BigDecimal body, @Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterNumberSerialize(body,securityContext); @@ -88,7 +87,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) }) public Response fakeOuterStringSerialize( - @ApiParam(value = "Input string as post body" ) String body, + @ApiParam(value = "Input string as post body" ) @Valid String body, @Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterStringSerialize(body,securityContext); @@ -101,7 +100,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) public Response testBodyWithFileSchema( - @ApiParam(value = "" ,required=true) FileSchemaTestClass fileSchemaTestClass, + @ApiParam(value = "" ,required=true) @Valid FileSchemaTestClass fileSchemaTestClass, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithFileSchema(fileSchemaTestClass,securityContext); @@ -115,7 +114,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) public Response testBodyWithQueryParams( @ApiParam(value = "",required=true) @QueryParam("query") String query, - @ApiParam(value = "" ,required=true) User user, + @ApiParam(value = "" ,required=true) @Valid User user, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithQueryParams(query,user,securityContext); @@ -128,7 +127,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) public Response testClientModel( - @ApiParam(value = "client model" ,required=true) Client client, + @ApiParam(value = "client model" ,required=true) @Valid Client client, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testClientModel(client,securityContext); @@ -144,21 +143,21 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) public Response testEndpointParameters( - @ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("number") BigDecimal number, - @ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("double") Double _double, - @ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("pattern_without_delimiter") String patternWithoutDelimiter, - @ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("byte") byte[] _byte, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("integer") Integer integer, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int32") Integer int32, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int64") Long int64, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("float") Float _float, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("string") String string, + @ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number, + @ApiParam(value = "None", required=true) @FormParam("double") Double _double, + @ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter, + @ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte, + @ApiParam(value = "None") @FormParam("integer") Integer integer, + @ApiParam(value = "None") @FormParam("int32") Integer int32, + @ApiParam(value = "None") @FormParam("int64") Long int64, + @ApiParam(value = "None") @FormParam("float") Float _float, + @ApiParam(value = "None") @FormParam("string") String string, @FormDataParam("binary") InputStream inputStream, @FormDataParam("binary") FormDataContentDisposition fileDetail, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("date") Date date, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("dateTime") Date dateTime, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("password") String password, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("callback") String paramCallback, + @ApiParam(value = "None") @FormParam("date") Date date, + @ApiParam(value = "None") @FormParam("dateTime") Date dateTime, + @ApiParam(value = "None") @FormParam("password") String password, + @ApiParam(value = "None") @FormParam("callback") String paramCallback, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testEndpointParameters(number,_double,patternWithoutDelimiter,_byte,integer,int32,int64,_float,string,inputStream, fileDetail,date,dateTime,password,paramCallback,securityContext); @@ -172,9 +171,9 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) }) public Response testEnumParameters( - @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List enumHeaderStringArray, + @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()")@HeaderParam("enum_header_string_array") List enumHeaderStringArray, @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString, - @ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $") @QueryParam("enum_query_string_array") List enumQueryStringArray, + @ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("enum_query_string_array") List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble, @@ -192,7 +191,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) public Response testInlineAdditionalProperties( - @ApiParam(value = "request body" ,required=true) Map requestBody, + @ApiParam(value = "request body" ,required=true) @Valid Map requestBody, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testInlineAdditionalProperties(requestBody,securityContext); @@ -205,8 +204,8 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) public Response testJsonFormData( - @ApiParam(value = "field1", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param") String param, - @ApiParam(value = "field2", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param2") String param2, + @ApiParam(value = "field1", required=true) @FormParam("param") String param, + @ApiParam(value = "field2", required=true) @FormParam("param2") String param2, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testJsonFormData(param,param2,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java index f20eb5506cd..882c66080db 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java @@ -7,9 +7,6 @@ import org.openapitools.api.factories.FakeClassnameTags123ApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -import javax.validation.constraints.*; - import org.openapitools.model.Client; import java.util.Map; @@ -25,6 +22,8 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/FakeClassnameTags123") @@ -44,7 +43,7 @@ public class FakeClassnameTags123Api { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) public Response testClassname( - @ApiParam(value = "client model" ,required=true) Client client, + @ApiParam(value = "client model" ,required=true) @Valid Client client, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testClassname(client,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/PetApi.java index 47102e7b50b..c33194224fc 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/PetApi.java @@ -7,9 +7,6 @@ import org.openapitools.api.factories.PetApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -import javax.validation.constraints.*; - import java.io.File; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.Pet; @@ -27,6 +24,8 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/Pet") @@ -49,7 +48,7 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) public Response addPet( - @ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet, + @ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @Valid Pet pet, @Context SecurityContext securityContext) throws NotFoundException { return delegate.addPet(pet,securityContext); @@ -87,7 +86,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) public Response findPetsByStatus( - @ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold") @QueryParam("status") List status, + @ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("status") List status, @Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByStatus(status,securityContext); @@ -106,7 +105,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) public Response findPetsByTags( - @ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List tags, + @ApiParam(value = "Tags to filter by",required=true, defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("tags") List tags, @Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByTags(tags,securityContext); @@ -143,7 +142,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) public Response updatePet( - @ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet, + @ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @Valid Pet pet, @Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePet(pet,securityContext); @@ -162,8 +161,8 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) public Response updatePetWithForm( @ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId, - @ApiParam(value = "Updated name of the pet", defaultValue="null") @DefaultValue("null") @FormParam("name") String name, - @ApiParam(value = "Updated status of the pet", defaultValue="null") @DefaultValue("null") @FormParam("status") String status, + @ApiParam(value = "Updated name of the pet") @FormParam("name") String name, + @ApiParam(value = "Updated status of the pet") @FormParam("status") String status, @Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePetWithForm(petId,name,status,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/StoreApi.java index 2c9da75e76c..bed3aee90bb 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/StoreApi.java @@ -7,9 +7,6 @@ import org.openapitools.api.factories.StoreApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -import javax.validation.constraints.*; - import java.util.Map; import org.openapitools.model.Order; @@ -26,6 +23,8 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/Store") @@ -87,7 +86,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) public Response placeOrder( - @ApiParam(value = "order placed for purchasing the pet" ,required=true) Order order, + @ApiParam(value = "order placed for purchasing the pet" ,required=true) @Valid Order order, @Context SecurityContext securityContext) throws NotFoundException { return delegate.placeOrder(order,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/UserApi.java index 3e426093911..5993cd8a0b6 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/api/UserApi.java @@ -7,9 +7,6 @@ import org.openapitools.api.factories.UserApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -import javax.validation.constraints.*; - import java.util.List; import org.openapitools.model.User; @@ -26,6 +23,8 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/User") @@ -43,7 +42,7 @@ public class UserApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) public Response createUser( - @ApiParam(value = "Created user object" ,required=true) User user, + @ApiParam(value = "Created user object" ,required=true) @Valid User user, @Context SecurityContext securityContext) throws NotFoundException { return delegate.createUser(user,securityContext); @@ -56,7 +55,7 @@ public class UserApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) public Response createUsersWithArrayInput( - @ApiParam(value = "List of user object" ,required=true) List user, + @ApiParam(value = "List of user object" ,required=true) @Valid List user, @Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithArrayInput(user,securityContext); @@ -69,7 +68,7 @@ public class UserApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) public Response createUsersWithListInput( - @ApiParam(value = "List of user object" ,required=true) List user, + @ApiParam(value = "List of user object" ,required=true) @Valid List user, @Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithListInput(user,securityContext); @@ -140,7 +139,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) public Response updateUser( @ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username, - @ApiParam(value = "Updated user object" ,required=true) User user, + @ApiParam(value = "Updated user object" ,required=true) @Valid User user, @Context SecurityContext securityContext) throws NotFoundException { return delegate.updateUser(username,user,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index 780db998ce4..0ca045eb604 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import javax.validation.constraints.*; +import javax.validation.Valid; /** * AdditionalPropertiesClass @@ -53,6 +54,7 @@ public class AdditionalPropertiesClass { **/ @JsonProperty("map_property") @ApiModelProperty(value = "") + public Map getMapProperty() { return mapProperty; } @@ -80,6 +82,7 @@ public class AdditionalPropertiesClass { **/ @JsonProperty("map_of_map_property") @ApiModelProperty(value = "") + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Animal.java index 026d2993302..759bcd00559 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Animal.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Animal @@ -28,7 +29,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; @@ -44,7 +45,8 @@ public class Animal { **/ @JsonProperty("className") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public String getClassName() { return className; } @@ -64,6 +66,7 @@ public class Animal { **/ @JsonProperty("color") @ApiModelProperty(value = "") + public String getColor() { return color; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/AnimalFarm.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/AnimalFarm.java index ebf2da7c4d7..d928eb44271 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/AnimalFarm.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/AnimalFarm.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.List; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * AnimalFarm diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java index 5fa93ebce46..f96168b4fb4 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayOfArrayOfNumberOnly @@ -50,6 +51,7 @@ public class ArrayOfArrayOfNumberOnly { **/ @JsonProperty("ArrayArrayNumber") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java index e074635e77a..279c69dd1dd 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayOfNumberOnly @@ -50,6 +51,7 @@ public class ArrayOfNumberOnly { **/ @JsonProperty("ArrayNumber") @ApiModelProperty(value = "") + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ArrayTest.java index 586e549c1b8..824d9a8d39c 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ArrayTest.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ArrayTest.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; import org.openapitools.model.ReadOnlyFirst; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayTest @@ -56,6 +57,7 @@ public class ArrayTest { **/ @JsonProperty("array_of_string") @ApiModelProperty(value = "") + public List getArrayOfString() { return arrayOfString; } @@ -83,6 +85,7 @@ public class ArrayTest { **/ @JsonProperty("array_array_of_integer") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -110,6 +113,7 @@ public class ArrayTest { **/ @JsonProperty("array_array_of_model") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Capitalization.java index 9a0a8ef045f..96476aacafc 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Capitalization.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Capitalization @@ -26,22 +27,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; @@ -54,6 +55,7 @@ public class Capitalization { **/ @JsonProperty("smallCamel") @ApiModelProperty(value = "") + public String getSmallCamel() { return smallCamel; } @@ -73,6 +75,7 @@ public class Capitalization { **/ @JsonProperty("CapitalCamel") @ApiModelProperty(value = "") + public String getCapitalCamel() { return capitalCamel; } @@ -92,6 +95,7 @@ public class Capitalization { **/ @JsonProperty("small_Snake") @ApiModelProperty(value = "") + public String getSmallSnake() { return smallSnake; } @@ -111,6 +115,7 @@ public class Capitalization { **/ @JsonProperty("Capital_Snake") @ApiModelProperty(value = "") + public String getCapitalSnake() { return capitalSnake; } @@ -130,6 +135,7 @@ public class Capitalization { **/ @JsonProperty("SCA_ETH_Flow_Points") @ApiModelProperty(value = "") + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -149,6 +155,7 @@ public class Capitalization { **/ @JsonProperty("ATT_NAME") @ApiModelProperty(value = "Name of the pet ") + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Cat.java index cff7b81e07b..ccab7921e3b 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Cat.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Cat @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; @@ -40,6 +41,7 @@ public class Cat extends Animal { **/ @JsonProperty("declawed") @ApiModelProperty(value = "") + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Category.java index 97f77be919c..b94a66a3668 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Category.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Category @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; @@ -42,6 +43,7 @@ public class Category { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -61,6 +63,7 @@ public class Category { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ClassModel.java index abf35b9722b..538b5bd4e84 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ClassModel.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model with \"_class\" property @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; @@ -40,6 +41,7 @@ public class ClassModel { **/ @JsonProperty("_class") @ApiModelProperty(value = "") + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Client.java index d800993eef5..eb1bc102269 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Client.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Client @@ -26,7 +27,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; @@ -39,6 +40,7 @@ public class Client { **/ @JsonProperty("client") @ApiModelProperty(value = "") + public String getClient() { return client; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Dog.java index fe07ee5010c..240145a35e3 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Dog.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Dog @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; @@ -40,6 +41,7 @@ public class Dog extends Animal { **/ @JsonProperty("breed") @ApiModelProperty(value = "") + public String getBreed() { return breed; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/EnumArrays.java index 89a470a683e..81f0f17d114 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/EnumArrays.java @@ -22,6 +22,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * EnumArrays @@ -60,7 +61,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum @@ -107,6 +108,7 @@ public class EnumArrays { **/ @JsonProperty("just_symbol") @ApiModelProperty(value = "") + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -134,6 +136,7 @@ public class EnumArrays { **/ @JsonProperty("array_enum") @ApiModelProperty(value = "") + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/EnumClass.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/EnumClass.java index 509355f8f9a..de61df4076b 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/EnumClass.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/EnumClass.java @@ -16,6 +16,7 @@ package org.openapitools.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; import javax.validation.constraints.*; +import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/EnumTest.java index 33024eb0f8b..7917dffad21 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/EnumTest.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.OuterEnum; import javax.validation.constraints.*; +import javax.validation.Valid; /** * EnumTest @@ -61,7 +62,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -97,7 +98,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -131,7 +132,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -165,7 +166,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; @@ -181,6 +182,7 @@ public class EnumTest { **/ @JsonProperty("enum_string") @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { return enumString; } @@ -200,7 +202,8 @@ public class EnumTest { **/ @JsonProperty("enum_string_required") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public EnumStringRequiredEnum getEnumStringRequired() { return enumStringRequired; } @@ -220,6 +223,7 @@ public class EnumTest { **/ @JsonProperty("enum_integer") @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -239,6 +243,7 @@ public class EnumTest { **/ @JsonProperty("enum_number") @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -258,6 +263,7 @@ public class EnumTest { **/ @JsonProperty("outerEnum") @ApiModelProperty(value = "") + @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/FileSchemaTestClass.java index 80545a92169..12de315baa5 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/FileSchemaTestClass.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * FileSchemaTestClass @@ -44,6 +45,7 @@ public class FileSchemaTestClass { **/ @JsonProperty("file") @ApiModelProperty(value = "") + @Valid public java.io.File getFile() { return file; } @@ -71,6 +73,7 @@ public class FileSchemaTestClass { **/ @JsonProperty("files") @ApiModelProperty(value = "") + @Valid public List getFiles() { return files; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/FormatTest.java index 556d64b9f78..5f60f9219ac 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/FormatTest.java @@ -23,6 +23,7 @@ import java.math.BigDecimal; import java.util.Date; import java.util.UUID; import javax.validation.constraints.*; +import javax.validation.Valid; /** * FormatTest @@ -30,43 +31,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private Date date = null; + private Date date; @JsonProperty("dateTime") - private Date dateTime = null; + private Date dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; @@ -81,7 +82,8 @@ public class FormatTest { **/ @JsonProperty("integer") @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + public Integer getInteger() { return integer; } @@ -102,7 +104,8 @@ public class FormatTest { **/ @JsonProperty("int32") @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + public Integer getInt32() { return int32; } @@ -121,6 +124,7 @@ public class FormatTest { **/ @JsonProperty("int64") @ApiModelProperty(value = "") + public Long getInt64() { return int64; } @@ -142,8 +146,9 @@ public class FormatTest { **/ @JsonProperty("number") @ApiModelProperty(required = true, value = "") - @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @NotNull + @DecimalMin("32.1") @DecimalMax("543.2")@Valid + public BigDecimal getNumber() { return number; } @@ -164,7 +169,8 @@ public class FormatTest { **/ @JsonProperty("float") @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + public Float getFloat() { return _float; } @@ -185,7 +191,8 @@ public class FormatTest { **/ @JsonProperty("double") @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + public Double getDouble() { return _double; } @@ -204,7 +211,8 @@ public class FormatTest { **/ @JsonProperty("string") @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + public String getString() { return string; } @@ -223,8 +231,9 @@ public class FormatTest { **/ @JsonProperty("byte") @ApiModelProperty(required = true, value = "") - @NotNull - @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") public byte[] getByte() { + @NotNull + @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") + public byte[] getByte() { return _byte; } @@ -243,6 +252,7 @@ public class FormatTest { **/ @JsonProperty("binary") @ApiModelProperty(value = "") + public File getBinary() { return binary; } @@ -262,7 +272,8 @@ public class FormatTest { **/ @JsonProperty("date") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public Date getDate() { return date; } @@ -282,6 +293,7 @@ public class FormatTest { **/ @JsonProperty("dateTime") @ApiModelProperty(value = "") + public Date getDateTime() { return dateTime; } @@ -301,6 +313,7 @@ public class FormatTest { **/ @JsonProperty("uuid") @ApiModelProperty(value = "") + public UUID getUuid() { return uuid; } @@ -320,8 +333,9 @@ public class FormatTest { **/ @JsonProperty("password") @ApiModelProperty(required = true, value = "") - @NotNull - @Size(min=10,max=64) public String getPassword() { + @NotNull + @Size(min=10,max=64) + public String getPassword() { return password; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java index 9be0e2e1dfe..5b4ba5936e4 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * HasOnlyReadOnly @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar @@ -37,6 +38,7 @@ public class HasOnlyReadOnly { **/ @JsonProperty("bar") @ApiModelProperty(value = "") + public String getBar() { return bar; } @@ -47,6 +49,7 @@ public class HasOnlyReadOnly { **/ @JsonProperty("foo") @ApiModelProperty(value = "") + public String getFoo() { return foo; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/MapTest.java index 51c1e69cce5..549e9303382 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/MapTest.java @@ -22,8 +22,8 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.constraints.*; +import javax.validation.Valid; /** * MapTest @@ -71,7 +71,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -92,6 +92,7 @@ public class MapTest { **/ @JsonProperty("map_map_of_string") @ApiModelProperty(value = "") + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -119,6 +120,7 @@ public class MapTest { **/ @JsonProperty("map_of_enum_string") @ApiModelProperty(value = "") + public Map getMapOfEnumString() { return mapOfEnumString; } @@ -146,6 +148,7 @@ public class MapTest { **/ @JsonProperty("direct_map") @ApiModelProperty(value = "") + public Map getDirectMap() { return directMap; } @@ -154,22 +157,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @JsonProperty("indirect_map") @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 027fb2e667a..0f291a48039 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -25,6 +25,7 @@ import java.util.Map; import java.util.UUID; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * MixedPropertiesAndAdditionalPropertiesClass @@ -32,10 +33,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private Date dateTime = null; + private Date dateTime; @JsonProperty("map") private Map map = null; @@ -51,6 +52,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @JsonProperty("uuid") @ApiModelProperty(value = "") + public UUID getUuid() { return uuid; } @@ -70,6 +72,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @JsonProperty("dateTime") @ApiModelProperty(value = "") + public Date getDateTime() { return dateTime; } @@ -97,6 +100,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @JsonProperty("map") @ApiModelProperty(value = "") + @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Model200Response.java index a81337395a2..cb0463e72a6 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Model200Response.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model name starting with number @@ -27,10 +28,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; @@ -43,6 +44,7 @@ public class Model200Response { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public Integer getName() { return name; } @@ -62,6 +64,7 @@ public class Model200Response { **/ @JsonProperty("class") @ApiModelProperty(value = "") + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ModelApiResponse.java index 87365573398..ee678612d84 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ModelApiResponse @@ -26,13 +27,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; @@ -45,6 +46,7 @@ public class ModelApiResponse { **/ @JsonProperty("code") @ApiModelProperty(value = "") + public Integer getCode() { return code; } @@ -64,6 +66,7 @@ public class ModelApiResponse { **/ @JsonProperty("type") @ApiModelProperty(value = "") + public String getType() { return type; } @@ -83,6 +86,7 @@ public class ModelApiResponse { **/ @JsonProperty("message") @ApiModelProperty(value = "") + public String getMessage() { return message; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ModelReturn.java index b0e231b4c34..aa0c9fd900d 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ModelReturn.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing reserved words @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; @@ -40,6 +41,7 @@ public class ModelReturn { **/ @JsonProperty("return") @ApiModelProperty(value = "") + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Name.java index 40e522d84fd..23bd2389f03 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Name.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model name same as property name @@ -27,16 +28,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; @@ -49,7 +50,8 @@ public class Name { **/ @JsonProperty("name") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public Integer getName() { return name; } @@ -64,6 +66,7 @@ public class Name { **/ @JsonProperty("snake_case") @ApiModelProperty(value = "") + public Integer getSnakeCase() { return snakeCase; } @@ -79,6 +82,7 @@ public class Name { **/ @JsonProperty("property") @ApiModelProperty(value = "") + public String getProperty() { return property; } @@ -93,6 +97,7 @@ public class Name { **/ @JsonProperty("123Number") @ApiModelProperty(value = "") + public Integer get123number() { return _123number; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/NumberOnly.java index 9a217006d89..4b622a0187b 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/NumberOnly.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * NumberOnly @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; @@ -40,6 +41,7 @@ public class NumberOnly { **/ @JsonProperty("JustNumber") @ApiModelProperty(value = "") + @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Order.java index 1a278c18132..c5387324624 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Order.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.Date; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Order @@ -28,16 +29,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private Date shipDate = null; + private Date shipDate; /** * Order Status @@ -73,7 +74,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; @@ -89,6 +90,7 @@ public class Order { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -108,6 +110,7 @@ public class Order { **/ @JsonProperty("petId") @ApiModelProperty(value = "") + public Long getPetId() { return petId; } @@ -127,6 +130,7 @@ public class Order { **/ @JsonProperty("quantity") @ApiModelProperty(value = "") + public Integer getQuantity() { return quantity; } @@ -146,6 +150,7 @@ public class Order { **/ @JsonProperty("shipDate") @ApiModelProperty(value = "") + public Date getShipDate() { return shipDate; } @@ -165,6 +170,7 @@ public class Order { **/ @JsonProperty("status") @ApiModelProperty(value = "Order Status") + public StatusEnum getStatus() { return status; } @@ -184,6 +190,7 @@ public class Order { **/ @JsonProperty("complete") @ApiModelProperty(value = "") + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/OuterComposite.java index 7df1ce746e1..351583bf105 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/OuterComposite.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * OuterComposite @@ -27,13 +28,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; @@ -46,6 +47,7 @@ public class OuterComposite { **/ @JsonProperty("my_number") @ApiModelProperty(value = "") + @Valid public BigDecimal getMyNumber() { return myNumber; } @@ -65,6 +67,7 @@ public class OuterComposite { **/ @JsonProperty("my_string") @ApiModelProperty(value = "") + public String getMyString() { return myString; } @@ -84,6 +87,7 @@ public class OuterComposite { **/ @JsonProperty("my_boolean") @ApiModelProperty(value = "") + public Boolean getMyBoolean() { return myBoolean; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/OuterEnum.java index b7517f3e9ee..3c15248e185 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/OuterEnum.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/OuterEnum.java @@ -16,6 +16,7 @@ package org.openapitools.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; import javax.validation.constraints.*; +import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Pet.java index ac94a0d4780..a74c6936d72 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Pet.java @@ -24,6 +24,7 @@ import java.util.List; import org.openapitools.model.Category; import org.openapitools.model.Tag; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Pet @@ -31,13 +32,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList(); @@ -79,7 +80,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; @@ -92,6 +93,7 @@ public class Pet { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -111,6 +113,7 @@ public class Pet { **/ @JsonProperty("category") @ApiModelProperty(value = "") + @Valid public Category getCategory() { return category; } @@ -130,7 +133,8 @@ public class Pet { **/ @JsonProperty("name") @ApiModelProperty(example = "doggie", required = true, value = "") - @NotNull + @NotNull + public String getName() { return name; } @@ -155,7 +159,8 @@ public class Pet { **/ @JsonProperty("photoUrls") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public List getPhotoUrls() { return photoUrls; } @@ -183,6 +188,7 @@ public class Pet { **/ @JsonProperty("tags") @ApiModelProperty(value = "") + @Valid public List getTags() { return tags; } @@ -202,6 +208,7 @@ public class Pet { **/ @JsonProperty("status") @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ReadOnlyFirst.java index 777d09bf6d9..a961d7518d3 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ReadOnlyFirst @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar @@ -37,6 +38,7 @@ public class ReadOnlyFirst { **/ @JsonProperty("bar") @ApiModelProperty(value = "") + public String getBar() { return bar; } @@ -52,6 +54,7 @@ public class ReadOnlyFirst { **/ @JsonProperty("baz") @ApiModelProperty(value = "") + public String getBaz() { return baz; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/SpecialModelName.java index 69129275503..e9e821a5612 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * SpecialModelName @@ -26,7 +27,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; @@ -39,6 +40,7 @@ public class SpecialModelName { **/ @JsonProperty("$special[property.name]") @ApiModelProperty(value = "") + public Long get$SpecialPropertyName() { return $specialPropertyName; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/StringBooleanMap.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/StringBooleanMap.java index 4b0bf53231b..82f8116bb1f 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/StringBooleanMap.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/StringBooleanMap.java @@ -17,6 +17,7 @@ import java.util.Objects; import java.util.HashMap; import java.util.Map; import javax.validation.constraints.*; +import javax.validation.Valid; /** * StringBooleanMap diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Tag.java index 237b8317e20..d60cad5c167 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/Tag.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Tag @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; @@ -42,6 +43,7 @@ public class Tag { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -61,6 +63,7 @@ public class Tag { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/User.java index 9cb4f16c2e6..e6a336773f0 100644 --- a/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs/jersey1-useTags/src/gen/java/org/openapitools/model/User.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * User @@ -26,28 +27,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; @@ -60,6 +61,7 @@ public class User { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -79,6 +81,7 @@ public class User { **/ @JsonProperty("username") @ApiModelProperty(value = "") + public String getUsername() { return username; } @@ -98,6 +101,7 @@ public class User { **/ @JsonProperty("firstName") @ApiModelProperty(value = "") + public String getFirstName() { return firstName; } @@ -117,6 +121,7 @@ public class User { **/ @JsonProperty("lastName") @ApiModelProperty(value = "") + public String getLastName() { return lastName; } @@ -136,6 +141,7 @@ public class User { **/ @JsonProperty("email") @ApiModelProperty(value = "") + public String getEmail() { return email; } @@ -155,6 +161,7 @@ public class User { **/ @JsonProperty("password") @ApiModelProperty(value = "") + public String getPassword() { return password; } @@ -174,6 +181,7 @@ public class User { **/ @JsonProperty("phone") @ApiModelProperty(value = "") + public String getPhone() { return phone; } @@ -193,6 +201,7 @@ public class User { **/ @JsonProperty("userStatus") @ApiModelProperty(value = "User Status") + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/jaxrs/jersey1/README.md b/samples/server/petstore/jaxrs/jersey1/README.md index 87263cc0503..28668de74f6 100644 --- a/samples/server/petstore/jaxrs/jersey1/README.md +++ b/samples/server/petstore/jaxrs/jersey1/README.md @@ -1,11 +1,12 @@ -# Swagger Jersey generated server +# JAX-RS/Jersey server with OpenAPI ## Overview -This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the -[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This -is an example of building a swagger-enabled JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. +Jersey is used as JAX-RS implementation, `io.swagger:swagger-jersey2-jaxrs` is used to derive the OpenAPI Specification from the annotated code. To run the server, please execute the following: @@ -13,10 +14,10 @@ To run the server, please execute the following: mvn clean package jetty:run ``` -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:8082/v2/openapi.json +http://localhost:8082/v2/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/AnotherFakeApi.java index b9baefac5b6..6d6063569e6 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -7,9 +7,6 @@ import org.openapitools.api.factories.AnotherFakeApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -import javax.validation.constraints.*; - import org.openapitools.model.Client; import java.util.Map; @@ -25,6 +22,8 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/another-fake") @@ -42,7 +41,7 @@ public class AnotherFakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) public Response call123testSpecialTags( - @ApiParam(value = "client model" ,required=true) Client client, + @ApiParam(value = "client model" ,required=true) @Valid Client client, @Context SecurityContext securityContext) throws NotFoundException { return delegate.call123testSpecialTags(client,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/FakeApi.java index 04781547da5..cb74e6c4e73 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/FakeApi.java @@ -7,9 +7,6 @@ import org.openapitools.api.factories.FakeApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -import javax.validation.constraints.*; - import java.math.BigDecimal; import org.openapitools.model.Client; import java.util.Date; @@ -33,6 +30,8 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/fake") @@ -50,7 +49,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) public Response fakeOuterBooleanSerialize( - @ApiParam(value = "Input boolean as post body" ) Boolean body, + @ApiParam(value = "Input boolean as post body" ) @Valid Boolean body, @Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterBooleanSerialize(body,securityContext); @@ -63,7 +62,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) public Response fakeOuterCompositeSerialize( - @ApiParam(value = "Input composite as post body" ) OuterComposite outerComposite, + @ApiParam(value = "Input composite as post body" ) @Valid OuterComposite outerComposite, @Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterCompositeSerialize(outerComposite,securityContext); @@ -76,7 +75,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) public Response fakeOuterNumberSerialize( - @ApiParam(value = "Input number as post body" ) BigDecimal body, + @ApiParam(value = "Input number as post body" ) @Valid BigDecimal body, @Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterNumberSerialize(body,securityContext); @@ -89,7 +88,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) }) public Response fakeOuterStringSerialize( - @ApiParam(value = "Input string as post body" ) String body, + @ApiParam(value = "Input string as post body" ) @Valid String body, @Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterStringSerialize(body,securityContext); @@ -102,7 +101,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) public Response testBodyWithFileSchema( - @ApiParam(value = "" ,required=true) FileSchemaTestClass fileSchemaTestClass, + @ApiParam(value = "" ,required=true) @Valid FileSchemaTestClass fileSchemaTestClass, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithFileSchema(fileSchemaTestClass,securityContext); @@ -116,7 +115,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) public Response testBodyWithQueryParams( @ApiParam(value = "",required=true) @QueryParam("query") String query, - @ApiParam(value = "" ,required=true) User user, + @ApiParam(value = "" ,required=true) @Valid User user, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithQueryParams(query,user,securityContext); @@ -129,7 +128,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) public Response testClientModel( - @ApiParam(value = "client model" ,required=true) Client client, + @ApiParam(value = "client model" ,required=true) @Valid Client client, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testClientModel(client,securityContext); @@ -145,21 +144,21 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) public Response testEndpointParameters( - @ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("number") BigDecimal number, - @ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("double") Double _double, - @ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("pattern_without_delimiter") String patternWithoutDelimiter, - @ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("byte") byte[] _byte, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("integer") Integer integer, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int32") Integer int32, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int64") Long int64, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("float") Float _float, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("string") String string, + @ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number, + @ApiParam(value = "None", required=true) @FormParam("double") Double _double, + @ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter, + @ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte, + @ApiParam(value = "None") @FormParam("integer") Integer integer, + @ApiParam(value = "None") @FormParam("int32") Integer int32, + @ApiParam(value = "None") @FormParam("int64") Long int64, + @ApiParam(value = "None") @FormParam("float") Float _float, + @ApiParam(value = "None") @FormParam("string") String string, @FormDataParam("binary") InputStream inputStream, @FormDataParam("binary") FormDataContentDisposition fileDetail, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("date") Date date, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("dateTime") Date dateTime, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("password") String password, - @ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("callback") String paramCallback, + @ApiParam(value = "None") @FormParam("date") Date date, + @ApiParam(value = "None") @FormParam("dateTime") Date dateTime, + @ApiParam(value = "None") @FormParam("password") String password, + @ApiParam(value = "None") @FormParam("callback") String paramCallback, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testEndpointParameters(number,_double,patternWithoutDelimiter,_byte,integer,int32,int64,_float,string,inputStream, fileDetail,date,dateTime,password,paramCallback,securityContext); @@ -173,9 +172,9 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) }) public Response testEnumParameters( - @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List enumHeaderStringArray, + @ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()")@HeaderParam("enum_header_string_array") List enumHeaderStringArray, @ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString, - @ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $") @QueryParam("enum_query_string_array") List enumQueryStringArray, + @ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("enum_query_string_array") List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger, @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble, @@ -193,7 +192,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) public Response testInlineAdditionalProperties( - @ApiParam(value = "request body" ,required=true) Map requestBody, + @ApiParam(value = "request body" ,required=true) @Valid Map requestBody, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testInlineAdditionalProperties(requestBody,securityContext); @@ -206,8 +205,8 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) public Response testJsonFormData( - @ApiParam(value = "field1", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param") String param, - @ApiParam(value = "field2", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param2") String param2, + @ApiParam(value = "field1", required=true) @FormParam("param") String param, + @ApiParam(value = "field2", required=true) @FormParam("param2") String param2, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testJsonFormData(param,param2,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java index 56838a217e9..362df233829 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -7,9 +7,6 @@ import org.openapitools.api.factories.FakeClassnameTestApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -import javax.validation.constraints.*; - import org.openapitools.model.Client; import java.util.Map; @@ -25,6 +22,8 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/fake_classname_test") @@ -44,7 +43,7 @@ public class FakeClassnameTestApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) public Response testClassname( - @ApiParam(value = "client model" ,required=true) Client client, + @ApiParam(value = "client model" ,required=true) @Valid Client client, @Context SecurityContext securityContext) throws NotFoundException { return delegate.testClassname(client,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/PetApi.java index 4d6288f5ef5..69d72ed7661 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/PetApi.java @@ -7,9 +7,6 @@ import org.openapitools.api.factories.PetApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -import javax.validation.constraints.*; - import java.io.File; import org.openapitools.model.ModelApiResponse; import org.openapitools.model.Pet; @@ -27,6 +24,8 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/pet") @@ -49,7 +48,7 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) public Response addPet( - @ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet, + @ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @Valid Pet pet, @Context SecurityContext securityContext) throws NotFoundException { return delegate.addPet(pet,securityContext); @@ -87,7 +86,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) public Response findPetsByStatus( - @ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold") @QueryParam("status") List status, + @ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("status") List status, @Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByStatus(status,securityContext); @@ -106,7 +105,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) public Response findPetsByTags( - @ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List tags, + @ApiParam(value = "Tags to filter by",required=true, defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("tags") List tags, @Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByTags(tags,securityContext); @@ -143,7 +142,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) public Response updatePet( - @ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet, + @ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @Valid Pet pet, @Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePet(pet,securityContext); @@ -162,8 +161,8 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) public Response updatePetWithForm( @ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId, - @ApiParam(value = "Updated name of the pet", defaultValue="null") @DefaultValue("null") @FormParam("name") String name, - @ApiParam(value = "Updated status of the pet", defaultValue="null") @DefaultValue("null") @FormParam("status") String status, + @ApiParam(value = "Updated name of the pet") @FormParam("name") String name, + @ApiParam(value = "Updated status of the pet") @FormParam("status") String status, @Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePetWithForm(petId,name,status,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/StoreApi.java index 21912ede598..9247b5b870b 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/StoreApi.java @@ -7,9 +7,6 @@ import org.openapitools.api.factories.StoreApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -import javax.validation.constraints.*; - import java.util.Map; import org.openapitools.model.Order; @@ -26,6 +23,8 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/store") @@ -87,7 +86,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) public Response placeOrder( - @ApiParam(value = "order placed for purchasing the pet" ,required=true) Order order, + @ApiParam(value = "order placed for purchasing the pet" ,required=true) @Valid Order order, @Context SecurityContext securityContext) throws NotFoundException { return delegate.placeOrder(order,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/UserApi.java index e830d819507..b006f802547 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/api/UserApi.java @@ -7,9 +7,6 @@ import org.openapitools.api.factories.UserApiServiceFactory; import io.swagger.annotations.ApiParam; import io.swagger.jaxrs.*; -import com.sun.jersey.multipart.FormDataParam; -import javax.validation.constraints.*; - import java.util.List; import org.openapitools.model.User; @@ -26,6 +23,8 @@ import javax.ws.rs.core.Context; import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; +import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/user") @@ -43,7 +42,7 @@ public class UserApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) public Response createUser( - @ApiParam(value = "Created user object" ,required=true) User user, + @ApiParam(value = "Created user object" ,required=true) @Valid User user, @Context SecurityContext securityContext) throws NotFoundException { return delegate.createUser(user,securityContext); @@ -56,7 +55,7 @@ public class UserApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) public Response createUsersWithArrayInput( - @ApiParam(value = "List of user object" ,required=true) List user, + @ApiParam(value = "List of user object" ,required=true) @Valid List user, @Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithArrayInput(user,securityContext); @@ -69,7 +68,7 @@ public class UserApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) public Response createUsersWithListInput( - @ApiParam(value = "List of user object" ,required=true) List user, + @ApiParam(value = "List of user object" ,required=true) @Valid List user, @Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithListInput(user,securityContext); @@ -140,7 +139,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) public Response updateUser( @ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username, - @ApiParam(value = "Updated user object" ,required=true) User user, + @ApiParam(value = "Updated user object" ,required=true) @Valid User user, @Context SecurityContext securityContext) throws NotFoundException { return delegate.updateUser(username,user,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index 780db998ce4..0ca045eb604 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import javax.validation.constraints.*; +import javax.validation.Valid; /** * AdditionalPropertiesClass @@ -53,6 +54,7 @@ public class AdditionalPropertiesClass { **/ @JsonProperty("map_property") @ApiModelProperty(value = "") + public Map getMapProperty() { return mapProperty; } @@ -80,6 +82,7 @@ public class AdditionalPropertiesClass { **/ @JsonProperty("map_of_map_property") @ApiModelProperty(value = "") + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Animal.java index 026d2993302..759bcd00559 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Animal.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Animal @@ -28,7 +29,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; @@ -44,7 +45,8 @@ public class Animal { **/ @JsonProperty("className") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public String getClassName() { return className; } @@ -64,6 +66,7 @@ public class Animal { **/ @JsonProperty("color") @ApiModelProperty(value = "") + public String getColor() { return color; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/AnimalFarm.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/AnimalFarm.java index ebf2da7c4d7..d928eb44271 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/AnimalFarm.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/AnimalFarm.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.List; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * AnimalFarm diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java index 5fa93ebce46..f96168b4fb4 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayOfArrayOfNumberOnly @@ -50,6 +51,7 @@ public class ArrayOfArrayOfNumberOnly { **/ @JsonProperty("ArrayArrayNumber") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java index e074635e77a..279c69dd1dd 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayOfNumberOnly @@ -50,6 +51,7 @@ public class ArrayOfNumberOnly { **/ @JsonProperty("ArrayNumber") @ApiModelProperty(value = "") + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ArrayTest.java index 586e549c1b8..824d9a8d39c 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ArrayTest.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ArrayTest.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; import org.openapitools.model.ReadOnlyFirst; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayTest @@ -56,6 +57,7 @@ public class ArrayTest { **/ @JsonProperty("array_of_string") @ApiModelProperty(value = "") + public List getArrayOfString() { return arrayOfString; } @@ -83,6 +85,7 @@ public class ArrayTest { **/ @JsonProperty("array_array_of_integer") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -110,6 +113,7 @@ public class ArrayTest { **/ @JsonProperty("array_array_of_model") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Capitalization.java index 9a0a8ef045f..96476aacafc 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Capitalization.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Capitalization @@ -26,22 +27,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; @@ -54,6 +55,7 @@ public class Capitalization { **/ @JsonProperty("smallCamel") @ApiModelProperty(value = "") + public String getSmallCamel() { return smallCamel; } @@ -73,6 +75,7 @@ public class Capitalization { **/ @JsonProperty("CapitalCamel") @ApiModelProperty(value = "") + public String getCapitalCamel() { return capitalCamel; } @@ -92,6 +95,7 @@ public class Capitalization { **/ @JsonProperty("small_Snake") @ApiModelProperty(value = "") + public String getSmallSnake() { return smallSnake; } @@ -111,6 +115,7 @@ public class Capitalization { **/ @JsonProperty("Capital_Snake") @ApiModelProperty(value = "") + public String getCapitalSnake() { return capitalSnake; } @@ -130,6 +135,7 @@ public class Capitalization { **/ @JsonProperty("SCA_ETH_Flow_Points") @ApiModelProperty(value = "") + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -149,6 +155,7 @@ public class Capitalization { **/ @JsonProperty("ATT_NAME") @ApiModelProperty(value = "Name of the pet ") + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Cat.java index cff7b81e07b..ccab7921e3b 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Cat.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Cat @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; @@ -40,6 +41,7 @@ public class Cat extends Animal { **/ @JsonProperty("declawed") @ApiModelProperty(value = "") + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Category.java index 97f77be919c..b94a66a3668 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Category.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Category @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; @@ -42,6 +43,7 @@ public class Category { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -61,6 +63,7 @@ public class Category { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ClassModel.java index abf35b9722b..538b5bd4e84 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ClassModel.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model with \"_class\" property @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; @@ -40,6 +41,7 @@ public class ClassModel { **/ @JsonProperty("_class") @ApiModelProperty(value = "") + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Client.java index d800993eef5..eb1bc102269 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Client.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Client @@ -26,7 +27,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; @@ -39,6 +40,7 @@ public class Client { **/ @JsonProperty("client") @ApiModelProperty(value = "") + public String getClient() { return client; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Dog.java index fe07ee5010c..240145a35e3 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Dog.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Dog @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; @@ -40,6 +41,7 @@ public class Dog extends Animal { **/ @JsonProperty("breed") @ApiModelProperty(value = "") + public String getBreed() { return breed; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/EnumArrays.java index 89a470a683e..81f0f17d114 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/EnumArrays.java @@ -22,6 +22,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * EnumArrays @@ -60,7 +61,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum @@ -107,6 +108,7 @@ public class EnumArrays { **/ @JsonProperty("just_symbol") @ApiModelProperty(value = "") + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -134,6 +136,7 @@ public class EnumArrays { **/ @JsonProperty("array_enum") @ApiModelProperty(value = "") + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/EnumClass.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/EnumClass.java index 509355f8f9a..de61df4076b 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/EnumClass.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/EnumClass.java @@ -16,6 +16,7 @@ package org.openapitools.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; import javax.validation.constraints.*; +import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/EnumTest.java index 33024eb0f8b..7917dffad21 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/EnumTest.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.OuterEnum; import javax.validation.constraints.*; +import javax.validation.Valid; /** * EnumTest @@ -61,7 +62,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -97,7 +98,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -131,7 +132,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -165,7 +166,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; @@ -181,6 +182,7 @@ public class EnumTest { **/ @JsonProperty("enum_string") @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { return enumString; } @@ -200,7 +202,8 @@ public class EnumTest { **/ @JsonProperty("enum_string_required") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public EnumStringRequiredEnum getEnumStringRequired() { return enumStringRequired; } @@ -220,6 +223,7 @@ public class EnumTest { **/ @JsonProperty("enum_integer") @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -239,6 +243,7 @@ public class EnumTest { **/ @JsonProperty("enum_number") @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -258,6 +263,7 @@ public class EnumTest { **/ @JsonProperty("outerEnum") @ApiModelProperty(value = "") + @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/FileSchemaTestClass.java index 80545a92169..12de315baa5 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/FileSchemaTestClass.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * FileSchemaTestClass @@ -44,6 +45,7 @@ public class FileSchemaTestClass { **/ @JsonProperty("file") @ApiModelProperty(value = "") + @Valid public java.io.File getFile() { return file; } @@ -71,6 +73,7 @@ public class FileSchemaTestClass { **/ @JsonProperty("files") @ApiModelProperty(value = "") + @Valid public List getFiles() { return files; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/FormatTest.java index 556d64b9f78..5f60f9219ac 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/FormatTest.java @@ -23,6 +23,7 @@ import java.math.BigDecimal; import java.util.Date; import java.util.UUID; import javax.validation.constraints.*; +import javax.validation.Valid; /** * FormatTest @@ -30,43 +31,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private Date date = null; + private Date date; @JsonProperty("dateTime") - private Date dateTime = null; + private Date dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; @@ -81,7 +82,8 @@ public class FormatTest { **/ @JsonProperty("integer") @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + public Integer getInteger() { return integer; } @@ -102,7 +104,8 @@ public class FormatTest { **/ @JsonProperty("int32") @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + public Integer getInt32() { return int32; } @@ -121,6 +124,7 @@ public class FormatTest { **/ @JsonProperty("int64") @ApiModelProperty(value = "") + public Long getInt64() { return int64; } @@ -142,8 +146,9 @@ public class FormatTest { **/ @JsonProperty("number") @ApiModelProperty(required = true, value = "") - @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @NotNull + @DecimalMin("32.1") @DecimalMax("543.2")@Valid + public BigDecimal getNumber() { return number; } @@ -164,7 +169,8 @@ public class FormatTest { **/ @JsonProperty("float") @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + public Float getFloat() { return _float; } @@ -185,7 +191,8 @@ public class FormatTest { **/ @JsonProperty("double") @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + public Double getDouble() { return _double; } @@ -204,7 +211,8 @@ public class FormatTest { **/ @JsonProperty("string") @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + public String getString() { return string; } @@ -223,8 +231,9 @@ public class FormatTest { **/ @JsonProperty("byte") @ApiModelProperty(required = true, value = "") - @NotNull - @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") public byte[] getByte() { + @NotNull + @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") + public byte[] getByte() { return _byte; } @@ -243,6 +252,7 @@ public class FormatTest { **/ @JsonProperty("binary") @ApiModelProperty(value = "") + public File getBinary() { return binary; } @@ -262,7 +272,8 @@ public class FormatTest { **/ @JsonProperty("date") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public Date getDate() { return date; } @@ -282,6 +293,7 @@ public class FormatTest { **/ @JsonProperty("dateTime") @ApiModelProperty(value = "") + public Date getDateTime() { return dateTime; } @@ -301,6 +313,7 @@ public class FormatTest { **/ @JsonProperty("uuid") @ApiModelProperty(value = "") + public UUID getUuid() { return uuid; } @@ -320,8 +333,9 @@ public class FormatTest { **/ @JsonProperty("password") @ApiModelProperty(required = true, value = "") - @NotNull - @Size(min=10,max=64) public String getPassword() { + @NotNull + @Size(min=10,max=64) + public String getPassword() { return password; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java index 9be0e2e1dfe..5b4ba5936e4 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * HasOnlyReadOnly @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar @@ -37,6 +38,7 @@ public class HasOnlyReadOnly { **/ @JsonProperty("bar") @ApiModelProperty(value = "") + public String getBar() { return bar; } @@ -47,6 +49,7 @@ public class HasOnlyReadOnly { **/ @JsonProperty("foo") @ApiModelProperty(value = "") + public String getFoo() { return foo; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/MapTest.java index 51c1e69cce5..549e9303382 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/MapTest.java @@ -22,8 +22,8 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.constraints.*; +import javax.validation.Valid; /** * MapTest @@ -71,7 +71,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -92,6 +92,7 @@ public class MapTest { **/ @JsonProperty("map_map_of_string") @ApiModelProperty(value = "") + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -119,6 +120,7 @@ public class MapTest { **/ @JsonProperty("map_of_enum_string") @ApiModelProperty(value = "") + public Map getMapOfEnumString() { return mapOfEnumString; } @@ -146,6 +148,7 @@ public class MapTest { **/ @JsonProperty("direct_map") @ApiModelProperty(value = "") + public Map getDirectMap() { return directMap; } @@ -154,22 +157,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @JsonProperty("indirect_map") @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 027fb2e667a..0f291a48039 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -25,6 +25,7 @@ import java.util.Map; import java.util.UUID; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * MixedPropertiesAndAdditionalPropertiesClass @@ -32,10 +33,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private Date dateTime = null; + private Date dateTime; @JsonProperty("map") private Map map = null; @@ -51,6 +52,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @JsonProperty("uuid") @ApiModelProperty(value = "") + public UUID getUuid() { return uuid; } @@ -70,6 +72,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @JsonProperty("dateTime") @ApiModelProperty(value = "") + public Date getDateTime() { return dateTime; } @@ -97,6 +100,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @JsonProperty("map") @ApiModelProperty(value = "") + @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Model200Response.java index a81337395a2..cb0463e72a6 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Model200Response.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model name starting with number @@ -27,10 +28,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; @@ -43,6 +44,7 @@ public class Model200Response { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public Integer getName() { return name; } @@ -62,6 +64,7 @@ public class Model200Response { **/ @JsonProperty("class") @ApiModelProperty(value = "") + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ModelApiResponse.java index 87365573398..ee678612d84 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ModelApiResponse @@ -26,13 +27,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; @@ -45,6 +46,7 @@ public class ModelApiResponse { **/ @JsonProperty("code") @ApiModelProperty(value = "") + public Integer getCode() { return code; } @@ -64,6 +66,7 @@ public class ModelApiResponse { **/ @JsonProperty("type") @ApiModelProperty(value = "") + public String getType() { return type; } @@ -83,6 +86,7 @@ public class ModelApiResponse { **/ @JsonProperty("message") @ApiModelProperty(value = "") + public String getMessage() { return message; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ModelReturn.java index b0e231b4c34..aa0c9fd900d 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ModelReturn.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing reserved words @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; @@ -40,6 +41,7 @@ public class ModelReturn { **/ @JsonProperty("return") @ApiModelProperty(value = "") + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Name.java index 40e522d84fd..23bd2389f03 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Name.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model name same as property name @@ -27,16 +28,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; @@ -49,7 +50,8 @@ public class Name { **/ @JsonProperty("name") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public Integer getName() { return name; } @@ -64,6 +66,7 @@ public class Name { **/ @JsonProperty("snake_case") @ApiModelProperty(value = "") + public Integer getSnakeCase() { return snakeCase; } @@ -79,6 +82,7 @@ public class Name { **/ @JsonProperty("property") @ApiModelProperty(value = "") + public String getProperty() { return property; } @@ -93,6 +97,7 @@ public class Name { **/ @JsonProperty("123Number") @ApiModelProperty(value = "") + public Integer get123number() { return _123number; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/NumberOnly.java index 9a217006d89..4b622a0187b 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/NumberOnly.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * NumberOnly @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; @@ -40,6 +41,7 @@ public class NumberOnly { **/ @JsonProperty("JustNumber") @ApiModelProperty(value = "") + @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Order.java index 1a278c18132..c5387324624 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Order.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.Date; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Order @@ -28,16 +29,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private Date shipDate = null; + private Date shipDate; /** * Order Status @@ -73,7 +74,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; @@ -89,6 +90,7 @@ public class Order { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -108,6 +110,7 @@ public class Order { **/ @JsonProperty("petId") @ApiModelProperty(value = "") + public Long getPetId() { return petId; } @@ -127,6 +130,7 @@ public class Order { **/ @JsonProperty("quantity") @ApiModelProperty(value = "") + public Integer getQuantity() { return quantity; } @@ -146,6 +150,7 @@ public class Order { **/ @JsonProperty("shipDate") @ApiModelProperty(value = "") + public Date getShipDate() { return shipDate; } @@ -165,6 +170,7 @@ public class Order { **/ @JsonProperty("status") @ApiModelProperty(value = "Order Status") + public StatusEnum getStatus() { return status; } @@ -184,6 +190,7 @@ public class Order { **/ @JsonProperty("complete") @ApiModelProperty(value = "") + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/OuterComposite.java index 7df1ce746e1..351583bf105 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/OuterComposite.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * OuterComposite @@ -27,13 +28,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; @@ -46,6 +47,7 @@ public class OuterComposite { **/ @JsonProperty("my_number") @ApiModelProperty(value = "") + @Valid public BigDecimal getMyNumber() { return myNumber; } @@ -65,6 +67,7 @@ public class OuterComposite { **/ @JsonProperty("my_string") @ApiModelProperty(value = "") + public String getMyString() { return myString; } @@ -84,6 +87,7 @@ public class OuterComposite { **/ @JsonProperty("my_boolean") @ApiModelProperty(value = "") + public Boolean getMyBoolean() { return myBoolean; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/OuterEnum.java index b7517f3e9ee..3c15248e185 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/OuterEnum.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/OuterEnum.java @@ -16,6 +16,7 @@ package org.openapitools.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; import javax.validation.constraints.*; +import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Pet.java index ac94a0d4780..a74c6936d72 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Pet.java @@ -24,6 +24,7 @@ import java.util.List; import org.openapitools.model.Category; import org.openapitools.model.Tag; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Pet @@ -31,13 +32,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList(); @@ -79,7 +80,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; @@ -92,6 +93,7 @@ public class Pet { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -111,6 +113,7 @@ public class Pet { **/ @JsonProperty("category") @ApiModelProperty(value = "") + @Valid public Category getCategory() { return category; } @@ -130,7 +133,8 @@ public class Pet { **/ @JsonProperty("name") @ApiModelProperty(example = "doggie", required = true, value = "") - @NotNull + @NotNull + public String getName() { return name; } @@ -155,7 +159,8 @@ public class Pet { **/ @JsonProperty("photoUrls") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public List getPhotoUrls() { return photoUrls; } @@ -183,6 +188,7 @@ public class Pet { **/ @JsonProperty("tags") @ApiModelProperty(value = "") + @Valid public List getTags() { return tags; } @@ -202,6 +208,7 @@ public class Pet { **/ @JsonProperty("status") @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ReadOnlyFirst.java index 777d09bf6d9..a961d7518d3 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ReadOnlyFirst @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar @@ -37,6 +38,7 @@ public class ReadOnlyFirst { **/ @JsonProperty("bar") @ApiModelProperty(value = "") + public String getBar() { return bar; } @@ -52,6 +54,7 @@ public class ReadOnlyFirst { **/ @JsonProperty("baz") @ApiModelProperty(value = "") + public String getBaz() { return baz; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/SpecialModelName.java index 69129275503..e9e821a5612 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * SpecialModelName @@ -26,7 +27,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; @@ -39,6 +40,7 @@ public class SpecialModelName { **/ @JsonProperty("$special[property.name]") @ApiModelProperty(value = "") + public Long get$SpecialPropertyName() { return $specialPropertyName; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/StringBooleanMap.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/StringBooleanMap.java index 4b0bf53231b..82f8116bb1f 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/StringBooleanMap.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/StringBooleanMap.java @@ -17,6 +17,7 @@ import java.util.Objects; import java.util.HashMap; import java.util.Map; import javax.validation.constraints.*; +import javax.validation.Valid; /** * StringBooleanMap diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Tag.java index 237b8317e20..d60cad5c167 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/Tag.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Tag @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; @@ -42,6 +43,7 @@ public class Tag { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -61,6 +63,7 @@ public class Tag { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/User.java index 9cb4f16c2e6..e6a336773f0 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/org/openapitools/model/User.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * User @@ -26,28 +27,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; @@ -60,6 +61,7 @@ public class User { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -79,6 +81,7 @@ public class User { **/ @JsonProperty("username") @ApiModelProperty(value = "") + public String getUsername() { return username; } @@ -98,6 +101,7 @@ public class User { **/ @JsonProperty("firstName") @ApiModelProperty(value = "") + public String getFirstName() { return firstName; } @@ -117,6 +121,7 @@ public class User { **/ @JsonProperty("lastName") @ApiModelProperty(value = "") + public String getLastName() { return lastName; } @@ -136,6 +141,7 @@ public class User { **/ @JsonProperty("email") @ApiModelProperty(value = "") + public String getEmail() { return email; } @@ -155,6 +161,7 @@ public class User { **/ @JsonProperty("password") @ApiModelProperty(value = "") + public String getPassword() { return password; } @@ -174,6 +181,7 @@ public class User { **/ @JsonProperty("phone") @ApiModelProperty(value = "") + public String getPhone() { return phone; } @@ -193,6 +201,7 @@ public class User { **/ @JsonProperty("userStatus") @ApiModelProperty(value = "User Status") + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/README.md b/samples/server/petstore/jaxrs/jersey2-useTags/README.md index 87263cc0503..28668de74f6 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/README.md +++ b/samples/server/petstore/jaxrs/jersey2-useTags/README.md @@ -1,11 +1,12 @@ -# Swagger Jersey generated server +# JAX-RS/Jersey server with OpenAPI ## Overview -This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the -[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This -is an example of building a swagger-enabled JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. +Jersey is used as JAX-RS implementation, `io.swagger:swagger-jersey2-jaxrs` is used to derive the OpenAPI Specification from the annotated code. To run the server, please execute the following: @@ -13,10 +14,10 @@ To run the server, please execute the following: mvn clean package jetty:run ``` -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:8082/v2/openapi.json +http://localhost:8082/v2/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/AnotherFakeApi.java index d7af3cd53de..27f7918eae9 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -24,6 +24,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("") @@ -61,7 +62,7 @@ public class AnotherFakeApi { @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response call123testSpecialTags(@ApiParam(value = "client model" ,required=true) Client client + public Response call123testSpecialTags(@ApiParam(value = "client model" ,required=true) @Valid Client client ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.call123testSpecialTags(client,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeApi.java index f17fbde6347..0a10473bdab 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeApi.java @@ -31,6 +31,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/fake") @@ -68,7 +69,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) - public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) Boolean body + public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid Boolean body ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterBooleanSerialize(body,securityContext); @@ -80,7 +81,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) - public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) OuterComposite outerComposite + public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid OuterComposite outerComposite ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterCompositeSerialize(outerComposite,securityContext); @@ -92,7 +93,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) - public Response fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) BigDecimal body + public Response fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid BigDecimal body ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterNumberSerialize(body,securityContext); @@ -104,7 +105,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) }) - public Response fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) String body + public Response fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid String body ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterStringSerialize(body,securityContext); @@ -116,7 +117,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) - public Response testBodyWithFileSchema(@ApiParam(value = "" ,required=true) FileSchemaTestClass fileSchemaTestClass + public Response testBodyWithFileSchema(@ApiParam(value = "" ,required=true) @Valid FileSchemaTestClass fileSchemaTestClass ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithFileSchema(fileSchemaTestClass,securityContext); @@ -129,7 +130,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) public Response testBodyWithQueryParams(@ApiParam(value = "",required=true) @QueryParam("query") String query -,@ApiParam(value = "" ,required=true) User user +,@ApiParam(value = "" ,required=true) @Valid User user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithQueryParams(query,user,securityContext); @@ -141,7 +142,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response testClientModel(@ApiParam(value = "client model" ,required=true) Client client + public Response testClientModel(@ApiParam(value = "client model" ,required=true) @Valid Client client ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClientModel(client,securityContext); @@ -157,22 +158,22 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) - public Response testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("number") BigDecimal number -,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("double") Double _double -,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("pattern_without_delimiter") String patternWithoutDelimiter -,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("byte") byte[] _byte -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("integer") Integer integer -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int32") Integer int32 -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int64") Long int64 -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("float") Float _float -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("string") String string + public Response testEndpointParameters(@ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number +,@ApiParam(value = "None", required=true) @FormParam("double") Double _double +,@ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter +,@ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte +,@ApiParam(value = "None") @FormParam("integer") Integer integer +,@ApiParam(value = "None") @FormParam("int32") Integer int32 +,@ApiParam(value = "None") @FormParam("int64") Long int64 +,@ApiParam(value = "None") @FormParam("float") Float _float +,@ApiParam(value = "None") @FormParam("string") String string , @FormDataParam("binary") InputStream binaryInputStream, @FormDataParam("binary") FormDataContentDisposition binaryDetail -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("date") Date date -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("dateTime") Date dateTime -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("password") String password -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("callback") String paramCallback +,@ApiParam(value = "None") @FormParam("date") Date date +,@ApiParam(value = "None") @FormParam("dateTime") Date dateTime +,@ApiParam(value = "None") @FormParam("password") String password +,@ApiParam(value = "None") @FormParam("callback") String paramCallback ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testEndpointParameters(number,_double,patternWithoutDelimiter,_byte,integer,int32,int64,_float,string,binaryInputStream, binaryDetail,date,dateTime,password,paramCallback,securityContext); @@ -186,9 +187,9 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) }) - public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List enumHeaderStringArray + public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()")@HeaderParam("enum_header_string_array") List enumHeaderStringArray ,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString -,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $") @QueryParam("enum_query_string_array") List enumQueryStringArray +,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("enum_query_string_array") List enumQueryStringArray ,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString ,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger ,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble @@ -205,7 +206,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) Map requestBody + public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) @Valid Map requestBody ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testInlineAdditionalProperties(requestBody,securityContext); @@ -217,8 +218,8 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param") String param -,@ApiParam(value = "field2", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param2") String param2 + public Response testJsonFormData(@ApiParam(value = "field1", required=true) @FormParam("param") String param +,@ApiParam(value = "field2", required=true) @FormParam("param2") String param2 ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testJsonFormData(param,param2,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java index a04fbb8fbc0..a385d98a834 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/FakeClassnameTags123Api.java @@ -24,6 +24,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("") @@ -63,7 +64,7 @@ public class FakeClassnameTags123Api { }, tags={ "fake_classname_tags 123#$%^", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response testClassname(@ApiParam(value = "client model" ,required=true) Client client + public Response testClassname(@ApiParam(value = "client model" ,required=true) @Valid Client client ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClassname(client,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/PetApi.java index 8d5362ac86e..b45eeb3c672 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/PetApi.java @@ -26,6 +26,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("") @@ -68,7 +69,7 @@ public class PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @Valid Pet pet ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.addPet(pet,securityContext); @@ -105,7 +106,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) - public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold") @QueryParam("status") List status + public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("status") List status ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByStatus(status,securityContext); @@ -124,7 +125,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) - public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List tags + public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true, defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("tags") List tags ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByTags(tags,securityContext); @@ -163,7 +164,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @Valid Pet pet ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePet(pet,securityContext); @@ -181,8 +182,8 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId -,@ApiParam(value = "Updated name of the pet", defaultValue="null") @DefaultValue("null") @FormParam("name") String name -,@ApiParam(value = "Updated status of the pet", defaultValue="null") @DefaultValue("null") @FormParam("status") String status +,@ApiParam(value = "Updated name of the pet") @FormParam("name") String name +,@ApiParam(value = "Updated status of the pet") @FormParam("status") String status ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePetWithForm(petId,name,status,securityContext); @@ -200,7 +201,7 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId -,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata +,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata , @FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail @@ -224,7 +225,7 @@ public class PetApi { , @FormDataParam("requiredFile") InputStream requiredFileInputStream, @FormDataParam("requiredFile") FormDataContentDisposition requiredFileDetail -,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata +,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.uploadFileWithRequiredFile(petId,requiredFileInputStream, requiredFileDetail,additionalMetadata,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/StoreApi.java index 0922fe72a2c..558726ede5e 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/StoreApi.java @@ -25,6 +25,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/store") @@ -107,7 +108,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) - public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order order + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) @Valid Order order ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.placeOrder(order,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApi.java index 52278201f1b..8c1a9384805 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/api/UserApi.java @@ -25,6 +25,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/user") @@ -62,7 +63,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUser(@ApiParam(value = "Created user object" ,required=true) User user + public Response createUser(@ApiParam(value = "Created user object" ,required=true) @Valid User user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUser(user,securityContext); @@ -74,7 +75,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List user + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) @Valid List user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithArrayInput(user,securityContext); @@ -86,7 +87,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List user + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) @Valid List user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithListInput(user,securityContext); @@ -157,7 +158,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) public Response updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username -,@ApiParam(value = "Updated user object" ,required=true) User user +,@ApiParam(value = "Updated user object" ,required=true) @Valid User user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updateUser(username,user,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index 780db998ce4..0ca045eb604 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import javax.validation.constraints.*; +import javax.validation.Valid; /** * AdditionalPropertiesClass @@ -53,6 +54,7 @@ public class AdditionalPropertiesClass { **/ @JsonProperty("map_property") @ApiModelProperty(value = "") + public Map getMapProperty() { return mapProperty; } @@ -80,6 +82,7 @@ public class AdditionalPropertiesClass { **/ @JsonProperty("map_of_map_property") @ApiModelProperty(value = "") + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Animal.java index 026d2993302..759bcd00559 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Animal.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Animal @@ -28,7 +29,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; @@ -44,7 +45,8 @@ public class Animal { **/ @JsonProperty("className") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public String getClassName() { return className; } @@ -64,6 +66,7 @@ public class Animal { **/ @JsonProperty("color") @ApiModelProperty(value = "") + public String getColor() { return color; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/AnimalFarm.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/AnimalFarm.java index ebf2da7c4d7..d928eb44271 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/AnimalFarm.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/AnimalFarm.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.List; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * AnimalFarm diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java index 5fa93ebce46..f96168b4fb4 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayOfArrayOfNumberOnly @@ -50,6 +51,7 @@ public class ArrayOfArrayOfNumberOnly { **/ @JsonProperty("ArrayArrayNumber") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java index e074635e77a..279c69dd1dd 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayOfNumberOnly @@ -50,6 +51,7 @@ public class ArrayOfNumberOnly { **/ @JsonProperty("ArrayNumber") @ApiModelProperty(value = "") + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ArrayTest.java index 586e549c1b8..824d9a8d39c 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ArrayTest.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ArrayTest.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; import org.openapitools.model.ReadOnlyFirst; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayTest @@ -56,6 +57,7 @@ public class ArrayTest { **/ @JsonProperty("array_of_string") @ApiModelProperty(value = "") + public List getArrayOfString() { return arrayOfString; } @@ -83,6 +85,7 @@ public class ArrayTest { **/ @JsonProperty("array_array_of_integer") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -110,6 +113,7 @@ public class ArrayTest { **/ @JsonProperty("array_array_of_model") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Capitalization.java index 9a0a8ef045f..96476aacafc 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Capitalization.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Capitalization @@ -26,22 +27,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; @@ -54,6 +55,7 @@ public class Capitalization { **/ @JsonProperty("smallCamel") @ApiModelProperty(value = "") + public String getSmallCamel() { return smallCamel; } @@ -73,6 +75,7 @@ public class Capitalization { **/ @JsonProperty("CapitalCamel") @ApiModelProperty(value = "") + public String getCapitalCamel() { return capitalCamel; } @@ -92,6 +95,7 @@ public class Capitalization { **/ @JsonProperty("small_Snake") @ApiModelProperty(value = "") + public String getSmallSnake() { return smallSnake; } @@ -111,6 +115,7 @@ public class Capitalization { **/ @JsonProperty("Capital_Snake") @ApiModelProperty(value = "") + public String getCapitalSnake() { return capitalSnake; } @@ -130,6 +135,7 @@ public class Capitalization { **/ @JsonProperty("SCA_ETH_Flow_Points") @ApiModelProperty(value = "") + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -149,6 +155,7 @@ public class Capitalization { **/ @JsonProperty("ATT_NAME") @ApiModelProperty(value = "Name of the pet ") + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Cat.java index cff7b81e07b..ccab7921e3b 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Cat.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Cat @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; @@ -40,6 +41,7 @@ public class Cat extends Animal { **/ @JsonProperty("declawed") @ApiModelProperty(value = "") + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Category.java index 97f77be919c..b94a66a3668 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Category.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Category @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; @@ -42,6 +43,7 @@ public class Category { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -61,6 +63,7 @@ public class Category { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ClassModel.java index abf35b9722b..538b5bd4e84 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ClassModel.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model with \"_class\" property @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; @@ -40,6 +41,7 @@ public class ClassModel { **/ @JsonProperty("_class") @ApiModelProperty(value = "") + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Client.java index d800993eef5..eb1bc102269 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Client.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Client @@ -26,7 +27,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; @@ -39,6 +40,7 @@ public class Client { **/ @JsonProperty("client") @ApiModelProperty(value = "") + public String getClient() { return client; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Dog.java index fe07ee5010c..240145a35e3 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Dog.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Dog @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; @@ -40,6 +41,7 @@ public class Dog extends Animal { **/ @JsonProperty("breed") @ApiModelProperty(value = "") + public String getBreed() { return breed; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/EnumArrays.java index 89a470a683e..81f0f17d114 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/EnumArrays.java @@ -22,6 +22,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * EnumArrays @@ -60,7 +61,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum @@ -107,6 +108,7 @@ public class EnumArrays { **/ @JsonProperty("just_symbol") @ApiModelProperty(value = "") + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -134,6 +136,7 @@ public class EnumArrays { **/ @JsonProperty("array_enum") @ApiModelProperty(value = "") + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/EnumClass.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/EnumClass.java index 509355f8f9a..de61df4076b 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/EnumClass.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/EnumClass.java @@ -16,6 +16,7 @@ package org.openapitools.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; import javax.validation.constraints.*; +import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/EnumTest.java index 33024eb0f8b..7917dffad21 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/EnumTest.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.OuterEnum; import javax.validation.constraints.*; +import javax.validation.Valid; /** * EnumTest @@ -61,7 +62,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -97,7 +98,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -131,7 +132,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -165,7 +166,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; @@ -181,6 +182,7 @@ public class EnumTest { **/ @JsonProperty("enum_string") @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { return enumString; } @@ -200,7 +202,8 @@ public class EnumTest { **/ @JsonProperty("enum_string_required") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public EnumStringRequiredEnum getEnumStringRequired() { return enumStringRequired; } @@ -220,6 +223,7 @@ public class EnumTest { **/ @JsonProperty("enum_integer") @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -239,6 +243,7 @@ public class EnumTest { **/ @JsonProperty("enum_number") @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -258,6 +263,7 @@ public class EnumTest { **/ @JsonProperty("outerEnum") @ApiModelProperty(value = "") + @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/FileSchemaTestClass.java index 80545a92169..12de315baa5 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/FileSchemaTestClass.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * FileSchemaTestClass @@ -44,6 +45,7 @@ public class FileSchemaTestClass { **/ @JsonProperty("file") @ApiModelProperty(value = "") + @Valid public java.io.File getFile() { return file; } @@ -71,6 +73,7 @@ public class FileSchemaTestClass { **/ @JsonProperty("files") @ApiModelProperty(value = "") + @Valid public List getFiles() { return files; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/FormatTest.java index 556d64b9f78..5f60f9219ac 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/FormatTest.java @@ -23,6 +23,7 @@ import java.math.BigDecimal; import java.util.Date; import java.util.UUID; import javax.validation.constraints.*; +import javax.validation.Valid; /** * FormatTest @@ -30,43 +31,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private Date date = null; + private Date date; @JsonProperty("dateTime") - private Date dateTime = null; + private Date dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; @@ -81,7 +82,8 @@ public class FormatTest { **/ @JsonProperty("integer") @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + public Integer getInteger() { return integer; } @@ -102,7 +104,8 @@ public class FormatTest { **/ @JsonProperty("int32") @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + public Integer getInt32() { return int32; } @@ -121,6 +124,7 @@ public class FormatTest { **/ @JsonProperty("int64") @ApiModelProperty(value = "") + public Long getInt64() { return int64; } @@ -142,8 +146,9 @@ public class FormatTest { **/ @JsonProperty("number") @ApiModelProperty(required = true, value = "") - @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @NotNull + @DecimalMin("32.1") @DecimalMax("543.2")@Valid + public BigDecimal getNumber() { return number; } @@ -164,7 +169,8 @@ public class FormatTest { **/ @JsonProperty("float") @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + public Float getFloat() { return _float; } @@ -185,7 +191,8 @@ public class FormatTest { **/ @JsonProperty("double") @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + public Double getDouble() { return _double; } @@ -204,7 +211,8 @@ public class FormatTest { **/ @JsonProperty("string") @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + public String getString() { return string; } @@ -223,8 +231,9 @@ public class FormatTest { **/ @JsonProperty("byte") @ApiModelProperty(required = true, value = "") - @NotNull - @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") public byte[] getByte() { + @NotNull + @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") + public byte[] getByte() { return _byte; } @@ -243,6 +252,7 @@ public class FormatTest { **/ @JsonProperty("binary") @ApiModelProperty(value = "") + public File getBinary() { return binary; } @@ -262,7 +272,8 @@ public class FormatTest { **/ @JsonProperty("date") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public Date getDate() { return date; } @@ -282,6 +293,7 @@ public class FormatTest { **/ @JsonProperty("dateTime") @ApiModelProperty(value = "") + public Date getDateTime() { return dateTime; } @@ -301,6 +313,7 @@ public class FormatTest { **/ @JsonProperty("uuid") @ApiModelProperty(value = "") + public UUID getUuid() { return uuid; } @@ -320,8 +333,9 @@ public class FormatTest { **/ @JsonProperty("password") @ApiModelProperty(required = true, value = "") - @NotNull - @Size(min=10,max=64) public String getPassword() { + @NotNull + @Size(min=10,max=64) + public String getPassword() { return password; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java index 9be0e2e1dfe..5b4ba5936e4 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * HasOnlyReadOnly @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar @@ -37,6 +38,7 @@ public class HasOnlyReadOnly { **/ @JsonProperty("bar") @ApiModelProperty(value = "") + public String getBar() { return bar; } @@ -47,6 +49,7 @@ public class HasOnlyReadOnly { **/ @JsonProperty("foo") @ApiModelProperty(value = "") + public String getFoo() { return foo; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/MapTest.java index 51c1e69cce5..549e9303382 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/MapTest.java @@ -22,8 +22,8 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.constraints.*; +import javax.validation.Valid; /** * MapTest @@ -71,7 +71,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -92,6 +92,7 @@ public class MapTest { **/ @JsonProperty("map_map_of_string") @ApiModelProperty(value = "") + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -119,6 +120,7 @@ public class MapTest { **/ @JsonProperty("map_of_enum_string") @ApiModelProperty(value = "") + public Map getMapOfEnumString() { return mapOfEnumString; } @@ -146,6 +148,7 @@ public class MapTest { **/ @JsonProperty("direct_map") @ApiModelProperty(value = "") + public Map getDirectMap() { return directMap; } @@ -154,22 +157,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @JsonProperty("indirect_map") @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 027fb2e667a..0f291a48039 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -25,6 +25,7 @@ import java.util.Map; import java.util.UUID; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * MixedPropertiesAndAdditionalPropertiesClass @@ -32,10 +33,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private Date dateTime = null; + private Date dateTime; @JsonProperty("map") private Map map = null; @@ -51,6 +52,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @JsonProperty("uuid") @ApiModelProperty(value = "") + public UUID getUuid() { return uuid; } @@ -70,6 +72,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @JsonProperty("dateTime") @ApiModelProperty(value = "") + public Date getDateTime() { return dateTime; } @@ -97,6 +100,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @JsonProperty("map") @ApiModelProperty(value = "") + @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Model200Response.java index a81337395a2..cb0463e72a6 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Model200Response.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model name starting with number @@ -27,10 +28,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; @@ -43,6 +44,7 @@ public class Model200Response { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public Integer getName() { return name; } @@ -62,6 +64,7 @@ public class Model200Response { **/ @JsonProperty("class") @ApiModelProperty(value = "") + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ModelApiResponse.java index 87365573398..ee678612d84 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ModelApiResponse @@ -26,13 +27,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; @@ -45,6 +46,7 @@ public class ModelApiResponse { **/ @JsonProperty("code") @ApiModelProperty(value = "") + public Integer getCode() { return code; } @@ -64,6 +66,7 @@ public class ModelApiResponse { **/ @JsonProperty("type") @ApiModelProperty(value = "") + public String getType() { return type; } @@ -83,6 +86,7 @@ public class ModelApiResponse { **/ @JsonProperty("message") @ApiModelProperty(value = "") + public String getMessage() { return message; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ModelReturn.java index b0e231b4c34..aa0c9fd900d 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ModelReturn.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing reserved words @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; @@ -40,6 +41,7 @@ public class ModelReturn { **/ @JsonProperty("return") @ApiModelProperty(value = "") + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Name.java index 40e522d84fd..23bd2389f03 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Name.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model name same as property name @@ -27,16 +28,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; @@ -49,7 +50,8 @@ public class Name { **/ @JsonProperty("name") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public Integer getName() { return name; } @@ -64,6 +66,7 @@ public class Name { **/ @JsonProperty("snake_case") @ApiModelProperty(value = "") + public Integer getSnakeCase() { return snakeCase; } @@ -79,6 +82,7 @@ public class Name { **/ @JsonProperty("property") @ApiModelProperty(value = "") + public String getProperty() { return property; } @@ -93,6 +97,7 @@ public class Name { **/ @JsonProperty("123Number") @ApiModelProperty(value = "") + public Integer get123number() { return _123number; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/NumberOnly.java index 9a217006d89..4b622a0187b 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/NumberOnly.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * NumberOnly @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; @@ -40,6 +41,7 @@ public class NumberOnly { **/ @JsonProperty("JustNumber") @ApiModelProperty(value = "") + @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Order.java index 1a278c18132..c5387324624 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Order.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.Date; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Order @@ -28,16 +29,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private Date shipDate = null; + private Date shipDate; /** * Order Status @@ -73,7 +74,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; @@ -89,6 +90,7 @@ public class Order { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -108,6 +110,7 @@ public class Order { **/ @JsonProperty("petId") @ApiModelProperty(value = "") + public Long getPetId() { return petId; } @@ -127,6 +130,7 @@ public class Order { **/ @JsonProperty("quantity") @ApiModelProperty(value = "") + public Integer getQuantity() { return quantity; } @@ -146,6 +150,7 @@ public class Order { **/ @JsonProperty("shipDate") @ApiModelProperty(value = "") + public Date getShipDate() { return shipDate; } @@ -165,6 +170,7 @@ public class Order { **/ @JsonProperty("status") @ApiModelProperty(value = "Order Status") + public StatusEnum getStatus() { return status; } @@ -184,6 +190,7 @@ public class Order { **/ @JsonProperty("complete") @ApiModelProperty(value = "") + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/OuterComposite.java index 7df1ce746e1..351583bf105 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/OuterComposite.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * OuterComposite @@ -27,13 +28,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; @@ -46,6 +47,7 @@ public class OuterComposite { **/ @JsonProperty("my_number") @ApiModelProperty(value = "") + @Valid public BigDecimal getMyNumber() { return myNumber; } @@ -65,6 +67,7 @@ public class OuterComposite { **/ @JsonProperty("my_string") @ApiModelProperty(value = "") + public String getMyString() { return myString; } @@ -84,6 +87,7 @@ public class OuterComposite { **/ @JsonProperty("my_boolean") @ApiModelProperty(value = "") + public Boolean getMyBoolean() { return myBoolean; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/OuterEnum.java index b7517f3e9ee..3c15248e185 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/OuterEnum.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/OuterEnum.java @@ -16,6 +16,7 @@ package org.openapitools.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; import javax.validation.constraints.*; +import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Pet.java index ac94a0d4780..a74c6936d72 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Pet.java @@ -24,6 +24,7 @@ import java.util.List; import org.openapitools.model.Category; import org.openapitools.model.Tag; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Pet @@ -31,13 +32,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList(); @@ -79,7 +80,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; @@ -92,6 +93,7 @@ public class Pet { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -111,6 +113,7 @@ public class Pet { **/ @JsonProperty("category") @ApiModelProperty(value = "") + @Valid public Category getCategory() { return category; } @@ -130,7 +133,8 @@ public class Pet { **/ @JsonProperty("name") @ApiModelProperty(example = "doggie", required = true, value = "") - @NotNull + @NotNull + public String getName() { return name; } @@ -155,7 +159,8 @@ public class Pet { **/ @JsonProperty("photoUrls") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public List getPhotoUrls() { return photoUrls; } @@ -183,6 +188,7 @@ public class Pet { **/ @JsonProperty("tags") @ApiModelProperty(value = "") + @Valid public List getTags() { return tags; } @@ -202,6 +208,7 @@ public class Pet { **/ @JsonProperty("status") @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ReadOnlyFirst.java index 777d09bf6d9..a961d7518d3 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ReadOnlyFirst @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar @@ -37,6 +38,7 @@ public class ReadOnlyFirst { **/ @JsonProperty("bar") @ApiModelProperty(value = "") + public String getBar() { return bar; } @@ -52,6 +54,7 @@ public class ReadOnlyFirst { **/ @JsonProperty("baz") @ApiModelProperty(value = "") + public String getBaz() { return baz; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/SpecialModelName.java index 69129275503..e9e821a5612 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * SpecialModelName @@ -26,7 +27,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; @@ -39,6 +40,7 @@ public class SpecialModelName { **/ @JsonProperty("$special[property.name]") @ApiModelProperty(value = "") + public Long get$SpecialPropertyName() { return $specialPropertyName; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/StringBooleanMap.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/StringBooleanMap.java index 4b0bf53231b..82f8116bb1f 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/StringBooleanMap.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/StringBooleanMap.java @@ -17,6 +17,7 @@ import java.util.Objects; import java.util.HashMap; import java.util.Map; import javax.validation.constraints.*; +import javax.validation.Valid; /** * StringBooleanMap diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Tag.java index 237b8317e20..d60cad5c167 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/Tag.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Tag @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; @@ -42,6 +43,7 @@ public class Tag { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -61,6 +63,7 @@ public class Tag { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/User.java index 9cb4f16c2e6..e6a336773f0 100644 --- a/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs/jersey2-useTags/src/gen/java/org/openapitools/model/User.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * User @@ -26,28 +27,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; @@ -60,6 +61,7 @@ public class User { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -79,6 +81,7 @@ public class User { **/ @JsonProperty("username") @ApiModelProperty(value = "") + public String getUsername() { return username; } @@ -98,6 +101,7 @@ public class User { **/ @JsonProperty("firstName") @ApiModelProperty(value = "") + public String getFirstName() { return firstName; } @@ -117,6 +121,7 @@ public class User { **/ @JsonProperty("lastName") @ApiModelProperty(value = "") + public String getLastName() { return lastName; } @@ -136,6 +141,7 @@ public class User { **/ @JsonProperty("email") @ApiModelProperty(value = "") + public String getEmail() { return email; } @@ -155,6 +161,7 @@ public class User { **/ @JsonProperty("password") @ApiModelProperty(value = "") + public String getPassword() { return password; } @@ -174,6 +181,7 @@ public class User { **/ @JsonProperty("phone") @ApiModelProperty(value = "") + public String getPhone() { return phone; } @@ -193,6 +201,7 @@ public class User { **/ @JsonProperty("userStatus") @ApiModelProperty(value = "User Status") + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/jaxrs/jersey2/README.md b/samples/server/petstore/jaxrs/jersey2/README.md index 87263cc0503..28668de74f6 100644 --- a/samples/server/petstore/jaxrs/jersey2/README.md +++ b/samples/server/petstore/jaxrs/jersey2/README.md @@ -1,11 +1,12 @@ -# Swagger Jersey generated server +# JAX-RS/Jersey server with OpenAPI ## Overview -This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the -[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This -is an example of building a swagger-enabled JAX-RS server. +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using an +[OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled JAX-RS server. This example uses the [JAX-RS](https://jax-rs-spec.java.net/) framework. +Jersey is used as JAX-RS implementation, `io.swagger:swagger-jersey2-jaxrs` is used to derive the OpenAPI Specification from the annotated code. To run the server, please execute the following: @@ -13,10 +14,10 @@ To run the server, please execute the following: mvn clean package jetty:run ``` -You can then view the swagger listing here: +You can then view the OpenAPI v2 specification here: ``` -http://localhost:8082/v2/openapi.json +http://localhost:8082/v2/swagger.json ``` Note that if you have configured the `host` to be something other than localhost, the calls through diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/AnotherFakeApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/AnotherFakeApi.java index c1eb8b88c3c..09cd0e9c47c 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/AnotherFakeApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/AnotherFakeApi.java @@ -24,6 +24,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/another-fake") @@ -61,7 +62,7 @@ public class AnotherFakeApi { @io.swagger.annotations.ApiOperation(value = "To test special tags", notes = "To test special tags and operation ID starting with number", response = Client.class, tags={ "$another-fake?", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response call123testSpecialTags(@ApiParam(value = "client model" ,required=true) Client client + public Response call123testSpecialTags(@ApiParam(value = "client model" ,required=true) @Valid Client client ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.call123testSpecialTags(client,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeApi.java index 44a8201d939..ecebe0d1c25 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeApi.java @@ -32,6 +32,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/fake") @@ -69,7 +70,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) - public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) Boolean body + public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid Boolean body ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterBooleanSerialize(body,securityContext); @@ -81,7 +82,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) - public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) OuterComposite outerComposite + public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid OuterComposite outerComposite ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterCompositeSerialize(outerComposite,securityContext); @@ -93,7 +94,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) - public Response fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) BigDecimal body + public Response fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid BigDecimal body ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterNumberSerialize(body,securityContext); @@ -105,7 +106,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) }) - public Response fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) String body + public Response fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid String body ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.fakeOuterStringSerialize(body,securityContext); @@ -117,7 +118,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "", notes = "For this test, the body for this request much reference a schema named `File`.", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) - public Response testBodyWithFileSchema(@ApiParam(value = "" ,required=true) FileSchemaTestClass fileSchemaTestClass + public Response testBodyWithFileSchema(@ApiParam(value = "" ,required=true) @Valid FileSchemaTestClass fileSchemaTestClass ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithFileSchema(fileSchemaTestClass,securityContext); @@ -130,7 +131,7 @@ public class FakeApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "Success", response = Void.class) }) public Response testBodyWithQueryParams(@ApiParam(value = "",required=true) @QueryParam("query") String query -,@ApiParam(value = "" ,required=true) User user +,@ApiParam(value = "" ,required=true) @Valid User user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testBodyWithQueryParams(query,user,securityContext); @@ -142,7 +143,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response testClientModel(@ApiParam(value = "client model" ,required=true) Client client + public Response testClientModel(@ApiParam(value = "client model" ,required=true) @Valid Client client ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClientModel(client,securityContext); @@ -158,22 +159,22 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid username supplied", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) - public Response testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("number") BigDecimal number -,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("double") Double _double -,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("pattern_without_delimiter") String patternWithoutDelimiter -,@ApiParam(value = "None", required=true, defaultValue="null") @DefaultValue("null") @FormParam("byte") byte[] _byte -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("integer") Integer integer -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int32") Integer int32 -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("int64") Long int64 -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("float") Float _float -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("string") String string + public Response testEndpointParameters(@ApiParam(value = "None", required=true) @FormParam("number") BigDecimal number +,@ApiParam(value = "None", required=true) @FormParam("double") Double _double +,@ApiParam(value = "None", required=true) @FormParam("pattern_without_delimiter") String patternWithoutDelimiter +,@ApiParam(value = "None", required=true) @FormParam("byte") byte[] _byte +,@ApiParam(value = "None") @FormParam("integer") Integer integer +,@ApiParam(value = "None") @FormParam("int32") Integer int32 +,@ApiParam(value = "None") @FormParam("int64") Long int64 +,@ApiParam(value = "None") @FormParam("float") Float _float +,@ApiParam(value = "None") @FormParam("string") String string , @FormDataParam("binary") InputStream binaryInputStream, @FormDataParam("binary") FormDataContentDisposition binaryDetail -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("date") Date date -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("dateTime") Date dateTime -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("password") String password -,@ApiParam(value = "None", defaultValue="null") @DefaultValue("null") @FormParam("callback") String paramCallback +,@ApiParam(value = "None") @FormParam("date") Date date +,@ApiParam(value = "None") @FormParam("dateTime") Date dateTime +,@ApiParam(value = "None") @FormParam("password") String password +,@ApiParam(value = "None") @FormParam("callback") String paramCallback ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testEndpointParameters(number,_double,patternWithoutDelimiter,_byte,integer,int32,int64,_float,string,binaryInputStream, binaryDetail,date,dateTime,password,paramCallback,securityContext); @@ -187,9 +188,9 @@ public class FakeApi { @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid request", response = Void.class), @io.swagger.annotations.ApiResponse(code = 404, message = "Not found", response = Void.class) }) - public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $")@HeaderParam("enum_header_string_array") List enumHeaderStringArray + public Response testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()")@HeaderParam("enum_header_string_array") List enumHeaderStringArray ,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg")@HeaderParam("enum_header_string") String enumHeaderString -,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $") @QueryParam("enum_query_string_array") List enumQueryStringArray +,@ApiParam(value = "Query parameter enum test (string array)", allowableValues=">, $", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("enum_query_string_array") List enumQueryStringArray ,@ApiParam(value = "Query parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @DefaultValue("-efg") @QueryParam("enum_query_string") String enumQueryString ,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1, -2") @QueryParam("enum_query_integer") Integer enumQueryInteger ,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @QueryParam("enum_query_double") Double enumQueryDouble @@ -206,7 +207,7 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "test inline additionalProperties", notes = "", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) Map requestBody + public Response testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true) @Valid Map requestBody ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testInlineAdditionalProperties(requestBody,securityContext); @@ -218,8 +219,8 @@ public class FakeApi { @io.swagger.annotations.ApiOperation(value = "test json serialization of form data", notes = "", response = Void.class, tags={ "fake", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param") String param -,@ApiParam(value = "field2", required=true, defaultValue="null") @DefaultValue("null") @FormParam("param2") String param2 + public Response testJsonFormData(@ApiParam(value = "field1", required=true) @FormParam("param") String param +,@ApiParam(value = "field2", required=true) @FormParam("param2") String param2 ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testJsonFormData(param,param2,securityContext); @@ -240,7 +241,7 @@ public class FakeApi { , @FormDataParam("requiredFile") InputStream requiredFileInputStream, @FormDataParam("requiredFile") FormDataContentDisposition requiredFileDetail -,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata +,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.uploadFileWithRequiredFile(petId,requiredFileInputStream, requiredFileDetail,additionalMetadata,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java index 26f71f89a8d..f2552f7d08c 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/FakeClassnameTestApi.java @@ -24,6 +24,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/fake_classname_test") @@ -63,7 +64,7 @@ public class FakeClassnameTestApi { }, tags={ "fake_classname_tags 123#$%^", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Client.class) }) - public Response testClassname(@ApiParam(value = "client model" ,required=true) Client client + public Response testClassname(@ApiParam(value = "client model" ,required=true) @Valid Client client ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.testClassname(client,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/PetApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/PetApi.java index c915d919bab..6bfaebc7da2 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/PetApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/PetApi.java @@ -26,6 +26,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/pet") @@ -68,7 +69,7 @@ public class PetApi { }, tags={ "pet", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) - public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet + public Response addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @Valid Pet pet ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.addPet(pet,securityContext); @@ -105,7 +106,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid status value", response = Void.class) }) - public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold") @QueryParam("status") List status + public Response findPetsByStatus(@ApiParam(value = "Status values that need to be considered for filter",required=true, allowableValues="available, pending, sold", defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("status") List status ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByStatus(status,securityContext); @@ -124,7 +125,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Pet.class, responseContainer = "List"), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid tag value", response = Void.class) }) - public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true) @QueryParam("tags") List tags + public Response findPetsByTags(@ApiParam(value = "Tags to filter by",required=true, defaultValue="new ArrayList()") @DefaultValue("new ArrayList()") @QueryParam("tags") List tags ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.findPetsByTags(tags,securityContext); @@ -163,7 +164,7 @@ public class PetApi { @io.swagger.annotations.ApiResponse(code = 404, message = "Pet not found", response = Void.class), @io.swagger.annotations.ApiResponse(code = 405, message = "Validation exception", response = Void.class) }) - public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) Pet pet + public Response updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true) @Valid Pet pet ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePet(pet,securityContext); @@ -181,8 +182,8 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 405, message = "Invalid input", response = Void.class) }) public Response updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true) @PathParam("petId") Long petId -,@ApiParam(value = "Updated name of the pet", defaultValue="null") @DefaultValue("null") @FormParam("name") String name -,@ApiParam(value = "Updated status of the pet", defaultValue="null") @DefaultValue("null") @FormParam("status") String status +,@ApiParam(value = "Updated name of the pet") @FormParam("name") String name +,@ApiParam(value = "Updated status of the pet") @FormParam("status") String status ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updatePetWithForm(petId,name,status,securityContext); @@ -200,7 +201,7 @@ public class PetApi { @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) public Response uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathParam("petId") Long petId -,@ApiParam(value = "Additional data to pass to server", defaultValue="null")@FormDataParam("additionalMetadata") String additionalMetadata +,@ApiParam(value = "Additional data to pass to server")@FormDataParam("additionalMetadata") String additionalMetadata , @FormDataParam("file") InputStream fileInputStream, @FormDataParam("file") FormDataContentDisposition fileDetail diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/StoreApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/StoreApi.java index 5cb8bfffd76..953b54fdc1f 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/StoreApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/StoreApi.java @@ -25,6 +25,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/store") @@ -107,7 +108,7 @@ public class StoreApi { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Order.class), @io.swagger.annotations.ApiResponse(code = 400, message = "Invalid Order", response = Void.class) }) - public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) Order order + public Response placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true) @Valid Order order ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.placeOrder(order,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApi.java index bdc79d307f6..92191994db5 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/api/UserApi.java @@ -25,6 +25,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.SecurityContext; import javax.ws.rs.*; import javax.validation.constraints.*; +import javax.validation.Valid; @Path("/user") @@ -62,7 +63,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Create user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUser(@ApiParam(value = "Created user object" ,required=true) User user + public Response createUser(@ApiParam(value = "Created user object" ,required=true) @Valid User user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUser(user,securityContext); @@ -74,7 +75,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) List user + public Response createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true) @Valid List user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithArrayInput(user,securityContext); @@ -86,7 +87,7 @@ public class UserApi { @io.swagger.annotations.ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @io.swagger.annotations.ApiResponses(value = { @io.swagger.annotations.ApiResponse(code = 200, message = "successful operation", response = Void.class) }) - public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) List user + public Response createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true) @Valid List user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.createUsersWithListInput(user,securityContext); @@ -157,7 +158,7 @@ public class UserApi { @io.swagger.annotations.ApiResponse(code = 404, message = "User not found", response = Void.class) }) public Response updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathParam("username") String username -,@ApiParam(value = "Updated user object" ,required=true) User user +,@ApiParam(value = "Updated user object" ,required=true) @Valid User user ,@Context SecurityContext securityContext) throws NotFoundException { return delegate.updateUser(username,user,securityContext); diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java index 780db998ce4..0ca045eb604 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/AdditionalPropertiesClass.java @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import javax.validation.constraints.*; +import javax.validation.Valid; /** * AdditionalPropertiesClass @@ -53,6 +54,7 @@ public class AdditionalPropertiesClass { **/ @JsonProperty("map_property") @ApiModelProperty(value = "") + public Map getMapProperty() { return mapProperty; } @@ -80,6 +82,7 @@ public class AdditionalPropertiesClass { **/ @JsonProperty("map_of_map_property") @ApiModelProperty(value = "") + @Valid public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Animal.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Animal.java index 026d2993302..759bcd00559 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Animal.java @@ -21,6 +21,7 @@ import com.fasterxml.jackson.annotation.JsonTypeInfo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Animal @@ -28,7 +29,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; @@ -44,7 +45,8 @@ public class Animal { **/ @JsonProperty("className") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public String getClassName() { return className; } @@ -64,6 +66,7 @@ public class Animal { **/ @JsonProperty("color") @ApiModelProperty(value = "") + public String getColor() { return color; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/AnimalFarm.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/AnimalFarm.java index ebf2da7c4d7..d928eb44271 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/AnimalFarm.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/AnimalFarm.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.List; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * AnimalFarm diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java index 5fa93ebce46..f96168b4fb4 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ArrayOfArrayOfNumberOnly.java @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayOfArrayOfNumberOnly @@ -50,6 +51,7 @@ public class ArrayOfArrayOfNumberOnly { **/ @JsonProperty("ArrayArrayNumber") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java index e074635e77a..279c69dd1dd 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ArrayOfNumberOnly.java @@ -22,6 +22,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayOfNumberOnly @@ -50,6 +51,7 @@ public class ArrayOfNumberOnly { **/ @JsonProperty("ArrayNumber") @ApiModelProperty(value = "") + @Valid public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ArrayTest.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ArrayTest.java index 586e549c1b8..824d9a8d39c 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ArrayTest.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ArrayTest.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.List; import org.openapitools.model.ReadOnlyFirst; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ArrayTest @@ -56,6 +57,7 @@ public class ArrayTest { **/ @JsonProperty("array_of_string") @ApiModelProperty(value = "") + public List getArrayOfString() { return arrayOfString; } @@ -83,6 +85,7 @@ public class ArrayTest { **/ @JsonProperty("array_array_of_integer") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -110,6 +113,7 @@ public class ArrayTest { **/ @JsonProperty("array_array_of_model") @ApiModelProperty(value = "") + @Valid public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Capitalization.java index 9a0a8ef045f..96476aacafc 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Capitalization.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Capitalization @@ -26,22 +27,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; @@ -54,6 +55,7 @@ public class Capitalization { **/ @JsonProperty("smallCamel") @ApiModelProperty(value = "") + public String getSmallCamel() { return smallCamel; } @@ -73,6 +75,7 @@ public class Capitalization { **/ @JsonProperty("CapitalCamel") @ApiModelProperty(value = "") + public String getCapitalCamel() { return capitalCamel; } @@ -92,6 +95,7 @@ public class Capitalization { **/ @JsonProperty("small_Snake") @ApiModelProperty(value = "") + public String getSmallSnake() { return smallSnake; } @@ -111,6 +115,7 @@ public class Capitalization { **/ @JsonProperty("Capital_Snake") @ApiModelProperty(value = "") + public String getCapitalSnake() { return capitalSnake; } @@ -130,6 +135,7 @@ public class Capitalization { **/ @JsonProperty("SCA_ETH_Flow_Points") @ApiModelProperty(value = "") + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -149,6 +155,7 @@ public class Capitalization { **/ @JsonProperty("ATT_NAME") @ApiModelProperty(value = "Name of the pet ") + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Cat.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Cat.java index cff7b81e07b..ccab7921e3b 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Cat.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Cat @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; @@ -40,6 +41,7 @@ public class Cat extends Animal { **/ @JsonProperty("declawed") @ApiModelProperty(value = "") + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Category.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Category.java index 97f77be919c..b94a66a3668 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Category.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Category @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; @@ -42,6 +43,7 @@ public class Category { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -61,6 +63,7 @@ public class Category { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ClassModel.java index abf35b9722b..538b5bd4e84 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ClassModel.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model with \"_class\" property @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; @@ -40,6 +41,7 @@ public class ClassModel { **/ @JsonProperty("_class") @ApiModelProperty(value = "") + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Client.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Client.java index d800993eef5..eb1bc102269 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Client.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Client @@ -26,7 +27,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; @@ -39,6 +40,7 @@ public class Client { **/ @JsonProperty("client") @ApiModelProperty(value = "") + public String getClient() { return client; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Dog.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Dog.java index fe07ee5010c..240145a35e3 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Dog.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Dog @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; @@ -40,6 +41,7 @@ public class Dog extends Animal { **/ @JsonProperty("breed") @ApiModelProperty(value = "") + public String getBreed() { return breed; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/EnumArrays.java index 89a470a683e..81f0f17d114 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/EnumArrays.java @@ -22,6 +22,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * EnumArrays @@ -60,7 +61,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum @@ -107,6 +108,7 @@ public class EnumArrays { **/ @JsonProperty("just_symbol") @ApiModelProperty(value = "") + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -134,6 +136,7 @@ public class EnumArrays { **/ @JsonProperty("array_enum") @ApiModelProperty(value = "") + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/EnumClass.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/EnumClass.java index 509355f8f9a..de61df4076b 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/EnumClass.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/EnumClass.java @@ -16,6 +16,7 @@ package org.openapitools.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; import javax.validation.constraints.*; +import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/EnumTest.java index 33024eb0f8b..7917dffad21 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/EnumTest.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import org.openapitools.model.OuterEnum; import javax.validation.constraints.*; +import javax.validation.Valid; /** * EnumTest @@ -61,7 +62,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -97,7 +98,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -131,7 +132,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -165,7 +166,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; @@ -181,6 +182,7 @@ public class EnumTest { **/ @JsonProperty("enum_string") @ApiModelProperty(value = "") + public EnumStringEnum getEnumString() { return enumString; } @@ -200,7 +202,8 @@ public class EnumTest { **/ @JsonProperty("enum_string_required") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public EnumStringRequiredEnum getEnumStringRequired() { return enumStringRequired; } @@ -220,6 +223,7 @@ public class EnumTest { **/ @JsonProperty("enum_integer") @ApiModelProperty(value = "") + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -239,6 +243,7 @@ public class EnumTest { **/ @JsonProperty("enum_number") @ApiModelProperty(value = "") + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -258,6 +263,7 @@ public class EnumTest { **/ @JsonProperty("outerEnum") @ApiModelProperty(value = "") + @Valid public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/FileSchemaTestClass.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/FileSchemaTestClass.java index 80545a92169..12de315baa5 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/FileSchemaTestClass.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/FileSchemaTestClass.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModelProperty; import java.util.ArrayList; import java.util.List; import javax.validation.constraints.*; +import javax.validation.Valid; /** * FileSchemaTestClass @@ -44,6 +45,7 @@ public class FileSchemaTestClass { **/ @JsonProperty("file") @ApiModelProperty(value = "") + @Valid public java.io.File getFile() { return file; } @@ -71,6 +73,7 @@ public class FileSchemaTestClass { **/ @JsonProperty("files") @ApiModelProperty(value = "") + @Valid public List getFiles() { return files; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/FormatTest.java index 556d64b9f78..5f60f9219ac 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/FormatTest.java @@ -23,6 +23,7 @@ import java.math.BigDecimal; import java.util.Date; import java.util.UUID; import javax.validation.constraints.*; +import javax.validation.Valid; /** * FormatTest @@ -30,43 +31,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private File binary = null; + private File binary; @JsonProperty("date") - private Date date = null; + private Date date; @JsonProperty("dateTime") - private Date dateTime = null; + private Date dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; @@ -81,7 +82,8 @@ public class FormatTest { **/ @JsonProperty("integer") @ApiModelProperty(value = "") - @Min(10) @Max(100) public Integer getInteger() { + @Min(10) @Max(100) + public Integer getInteger() { return integer; } @@ -102,7 +104,8 @@ public class FormatTest { **/ @JsonProperty("int32") @ApiModelProperty(value = "") - @Min(20) @Max(200) public Integer getInt32() { + @Min(20) @Max(200) + public Integer getInt32() { return int32; } @@ -121,6 +124,7 @@ public class FormatTest { **/ @JsonProperty("int64") @ApiModelProperty(value = "") + public Long getInt64() { return int64; } @@ -142,8 +146,9 @@ public class FormatTest { **/ @JsonProperty("number") @ApiModelProperty(required = true, value = "") - @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { + @NotNull + @DecimalMin("32.1") @DecimalMax("543.2")@Valid + public BigDecimal getNumber() { return number; } @@ -164,7 +169,8 @@ public class FormatTest { **/ @JsonProperty("float") @ApiModelProperty(value = "") - @DecimalMin("54.3") @DecimalMax("987.6") public Float getFloat() { + @DecimalMin("54.3") @DecimalMax("987.6") + public Float getFloat() { return _float; } @@ -185,7 +191,8 @@ public class FormatTest { **/ @JsonProperty("double") @ApiModelProperty(value = "") - @DecimalMin("67.8") @DecimalMax("123.4") public Double getDouble() { + @DecimalMin("67.8") @DecimalMax("123.4") + public Double getDouble() { return _double; } @@ -204,7 +211,8 @@ public class FormatTest { **/ @JsonProperty("string") @ApiModelProperty(value = "") - @Pattern(regexp="/[a-z]/i") public String getString() { + @Pattern(regexp="/[a-z]/i") + public String getString() { return string; } @@ -223,8 +231,9 @@ public class FormatTest { **/ @JsonProperty("byte") @ApiModelProperty(required = true, value = "") - @NotNull - @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") public byte[] getByte() { + @NotNull + @Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") + public byte[] getByte() { return _byte; } @@ -243,6 +252,7 @@ public class FormatTest { **/ @JsonProperty("binary") @ApiModelProperty(value = "") + public File getBinary() { return binary; } @@ -262,7 +272,8 @@ public class FormatTest { **/ @JsonProperty("date") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public Date getDate() { return date; } @@ -282,6 +293,7 @@ public class FormatTest { **/ @JsonProperty("dateTime") @ApiModelProperty(value = "") + public Date getDateTime() { return dateTime; } @@ -301,6 +313,7 @@ public class FormatTest { **/ @JsonProperty("uuid") @ApiModelProperty(value = "") + public UUID getUuid() { return uuid; } @@ -320,8 +333,9 @@ public class FormatTest { **/ @JsonProperty("password") @ApiModelProperty(required = true, value = "") - @NotNull - @Size(min=10,max=64) public String getPassword() { + @NotNull + @Size(min=10,max=64) + public String getPassword() { return password; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java index 9be0e2e1dfe..5b4ba5936e4 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/HasOnlyReadOnly.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * HasOnlyReadOnly @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; /** * Get bar @@ -37,6 +38,7 @@ public class HasOnlyReadOnly { **/ @JsonProperty("bar") @ApiModelProperty(value = "") + public String getBar() { return bar; } @@ -47,6 +49,7 @@ public class HasOnlyReadOnly { **/ @JsonProperty("foo") @ApiModelProperty(value = "") + public String getFoo() { return foo; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/MapTest.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/MapTest.java index 51c1e69cce5..549e9303382 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/MapTest.java @@ -22,8 +22,8 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.constraints.*; +import javax.validation.Valid; /** * MapTest @@ -71,7 +71,7 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -92,6 +92,7 @@ public class MapTest { **/ @JsonProperty("map_map_of_string") @ApiModelProperty(value = "") + @Valid public Map> getMapMapOfString() { return mapMapOfString; } @@ -119,6 +120,7 @@ public class MapTest { **/ @JsonProperty("map_of_enum_string") @ApiModelProperty(value = "") + public Map getMapOfEnumString() { return mapOfEnumString; } @@ -146,6 +148,7 @@ public class MapTest { **/ @JsonProperty("direct_map") @ApiModelProperty(value = "") + public Map getDirectMap() { return directMap; } @@ -154,22 +157,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @JsonProperty("indirect_map") @ApiModelProperty(value = "") - public StringBooleanMap getIndirectMap() { + + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 027fb2e667a..0f291a48039 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -25,6 +25,7 @@ import java.util.Map; import java.util.UUID; import org.openapitools.model.Animal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * MixedPropertiesAndAdditionalPropertiesClass @@ -32,10 +33,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private Date dateTime = null; + private Date dateTime; @JsonProperty("map") private Map map = null; @@ -51,6 +52,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @JsonProperty("uuid") @ApiModelProperty(value = "") + public UUID getUuid() { return uuid; } @@ -70,6 +72,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @JsonProperty("dateTime") @ApiModelProperty(value = "") + public Date getDateTime() { return dateTime; } @@ -97,6 +100,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { **/ @JsonProperty("map") @ApiModelProperty(value = "") + @Valid public Map getMap() { return map; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Model200Response.java index a81337395a2..cb0463e72a6 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Model200Response.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model name starting with number @@ -27,10 +28,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; @@ -43,6 +44,7 @@ public class Model200Response { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public Integer getName() { return name; } @@ -62,6 +64,7 @@ public class Model200Response { **/ @JsonProperty("class") @ApiModelProperty(value = "") + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ModelApiResponse.java index 87365573398..ee678612d84 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ModelApiResponse.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ModelApiResponse @@ -26,13 +27,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; @@ -45,6 +46,7 @@ public class ModelApiResponse { **/ @JsonProperty("code") @ApiModelProperty(value = "") + public Integer getCode() { return code; } @@ -64,6 +66,7 @@ public class ModelApiResponse { **/ @JsonProperty("type") @ApiModelProperty(value = "") + public String getType() { return type; } @@ -83,6 +86,7 @@ public class ModelApiResponse { **/ @JsonProperty("message") @ApiModelProperty(value = "") + public String getMessage() { return message; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ModelReturn.java index b0e231b4c34..aa0c9fd900d 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ModelReturn.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing reserved words @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; @@ -40,6 +41,7 @@ public class ModelReturn { **/ @JsonProperty("return") @ApiModelProperty(value = "") + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Name.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Name.java index 40e522d84fd..23bd2389f03 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Name.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Model for testing model name same as property name @@ -27,16 +28,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; @@ -49,7 +50,8 @@ public class Name { **/ @JsonProperty("name") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public Integer getName() { return name; } @@ -64,6 +66,7 @@ public class Name { **/ @JsonProperty("snake_case") @ApiModelProperty(value = "") + public Integer getSnakeCase() { return snakeCase; } @@ -79,6 +82,7 @@ public class Name { **/ @JsonProperty("property") @ApiModelProperty(value = "") + public String getProperty() { return property; } @@ -93,6 +97,7 @@ public class Name { **/ @JsonProperty("123Number") @ApiModelProperty(value = "") + public Integer get123number() { return _123number; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/NumberOnly.java index 9a217006d89..4b622a0187b 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/NumberOnly.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * NumberOnly @@ -27,7 +28,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; @@ -40,6 +41,7 @@ public class NumberOnly { **/ @JsonProperty("JustNumber") @ApiModelProperty(value = "") + @Valid public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Order.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Order.java index 1a278c18132..c5387324624 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Order.java @@ -21,6 +21,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.util.Date; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Order @@ -28,16 +29,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private Date shipDate = null; + private Date shipDate; /** * Order Status @@ -73,7 +74,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; @@ -89,6 +90,7 @@ public class Order { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -108,6 +110,7 @@ public class Order { **/ @JsonProperty("petId") @ApiModelProperty(value = "") + public Long getPetId() { return petId; } @@ -127,6 +130,7 @@ public class Order { **/ @JsonProperty("quantity") @ApiModelProperty(value = "") + public Integer getQuantity() { return quantity; } @@ -146,6 +150,7 @@ public class Order { **/ @JsonProperty("shipDate") @ApiModelProperty(value = "") + public Date getShipDate() { return shipDate; } @@ -165,6 +170,7 @@ public class Order { **/ @JsonProperty("status") @ApiModelProperty(value = "Order Status") + public StatusEnum getStatus() { return status; } @@ -184,6 +190,7 @@ public class Order { **/ @JsonProperty("complete") @ApiModelProperty(value = "") + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/OuterComposite.java index 7df1ce746e1..351583bf105 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/OuterComposite.java @@ -20,6 +20,7 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.math.BigDecimal; import javax.validation.constraints.*; +import javax.validation.Valid; /** * OuterComposite @@ -27,13 +28,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; @@ -46,6 +47,7 @@ public class OuterComposite { **/ @JsonProperty("my_number") @ApiModelProperty(value = "") + @Valid public BigDecimal getMyNumber() { return myNumber; } @@ -65,6 +67,7 @@ public class OuterComposite { **/ @JsonProperty("my_string") @ApiModelProperty(value = "") + public String getMyString() { return myString; } @@ -84,6 +87,7 @@ public class OuterComposite { **/ @JsonProperty("my_boolean") @ApiModelProperty(value = "") + public Boolean getMyBoolean() { return myBoolean; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/OuterEnum.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/OuterEnum.java index b7517f3e9ee..3c15248e185 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/OuterEnum.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/OuterEnum.java @@ -16,6 +16,7 @@ package org.openapitools.model; import java.util.Objects; import com.fasterxml.jackson.annotation.JsonValue; import javax.validation.constraints.*; +import javax.validation.Valid; import com.fasterxml.jackson.annotation.JsonCreator; diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Pet.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Pet.java index ac94a0d4780..a74c6936d72 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Pet.java @@ -24,6 +24,7 @@ import java.util.List; import org.openapitools.model.Category; import org.openapitools.model.Tag; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Pet @@ -31,13 +32,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") private List photoUrls = new ArrayList(); @@ -79,7 +80,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; @@ -92,6 +93,7 @@ public class Pet { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -111,6 +113,7 @@ public class Pet { **/ @JsonProperty("category") @ApiModelProperty(value = "") + @Valid public Category getCategory() { return category; } @@ -130,7 +133,8 @@ public class Pet { **/ @JsonProperty("name") @ApiModelProperty(example = "doggie", required = true, value = "") - @NotNull + @NotNull + public String getName() { return name; } @@ -155,7 +159,8 @@ public class Pet { **/ @JsonProperty("photoUrls") @ApiModelProperty(required = true, value = "") - @NotNull + @NotNull + public List getPhotoUrls() { return photoUrls; } @@ -183,6 +188,7 @@ public class Pet { **/ @JsonProperty("tags") @ApiModelProperty(value = "") + @Valid public List getTags() { return tags; } @@ -202,6 +208,7 @@ public class Pet { **/ @JsonProperty("status") @ApiModelProperty(value = "pet status in the store") + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ReadOnlyFirst.java index 777d09bf6d9..a961d7518d3 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/ReadOnlyFirst.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * ReadOnlyFirst @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; /** * Get bar @@ -37,6 +38,7 @@ public class ReadOnlyFirst { **/ @JsonProperty("bar") @ApiModelProperty(value = "") + public String getBar() { return bar; } @@ -52,6 +54,7 @@ public class ReadOnlyFirst { **/ @JsonProperty("baz") @ApiModelProperty(value = "") + public String getBaz() { return baz; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/SpecialModelName.java index 69129275503..e9e821a5612 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/SpecialModelName.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * SpecialModelName @@ -26,7 +27,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; @@ -39,6 +40,7 @@ public class SpecialModelName { **/ @JsonProperty("$special[property.name]") @ApiModelProperty(value = "") + public Long get$SpecialPropertyName() { return $specialPropertyName; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/StringBooleanMap.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/StringBooleanMap.java index 4b0bf53231b..82f8116bb1f 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/StringBooleanMap.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/StringBooleanMap.java @@ -17,6 +17,7 @@ import java.util.Objects; import java.util.HashMap; import java.util.Map; import javax.validation.constraints.*; +import javax.validation.Valid; /** * StringBooleanMap diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Tag.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Tag.java index 237b8317e20..d60cad5c167 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/Tag.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * Tag @@ -26,10 +27,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; @@ -42,6 +43,7 @@ public class Tag { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -61,6 +63,7 @@ public class Tag { **/ @JsonProperty("name") @ApiModelProperty(value = "") + public String getName() { return name; } diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/User.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/User.java index 9cb4f16c2e6..e6a336773f0 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/User.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/org/openapitools/model/User.java @@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonCreator; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import javax.validation.constraints.*; +import javax.validation.Valid; /** * User @@ -26,28 +27,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; @@ -60,6 +61,7 @@ public class User { **/ @JsonProperty("id") @ApiModelProperty(value = "") + public Long getId() { return id; } @@ -79,6 +81,7 @@ public class User { **/ @JsonProperty("username") @ApiModelProperty(value = "") + public String getUsername() { return username; } @@ -98,6 +101,7 @@ public class User { **/ @JsonProperty("firstName") @ApiModelProperty(value = "") + public String getFirstName() { return firstName; } @@ -117,6 +121,7 @@ public class User { **/ @JsonProperty("lastName") @ApiModelProperty(value = "") + public String getLastName() { return lastName; } @@ -136,6 +141,7 @@ public class User { **/ @JsonProperty("email") @ApiModelProperty(value = "") + public String getEmail() { return email; } @@ -155,6 +161,7 @@ public class User { **/ @JsonProperty("password") @ApiModelProperty(value = "") + public String getPassword() { return password; } @@ -174,6 +181,7 @@ public class User { **/ @JsonProperty("phone") @ApiModelProperty(value = "") + public String getPhone() { return phone; } @@ -193,6 +201,7 @@ public class User { **/ @JsonProperty("userStatus") @ApiModelProperty(value = "User Status") + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/Paths.kt b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/Paths.kt index b72c44f902a..81fcd9be810 100644 --- a/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/Paths.kt +++ b/samples/server/petstore/kotlin-server/ktor/src/main/kotlin/org/openapitools/server/Paths.kt @@ -34,7 +34,7 @@ object Paths { * Deletes a pet * * @param petId Pet id to delete - * @param apiKey (optional) + * @param apiKey (optional, default to null) */ @Location("/pet/{petId}") class deletePet(val petId: kotlin.Long, val apiKey: kotlin.String) diff --git a/samples/server/petstore/kotlin-springboot/.openapi-generator-ignore b/samples/server/petstore/kotlin-springboot/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/.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/.openapi-generator/VERSION b/samples/server/petstore/kotlin-springboot/.openapi-generator/VERSION new file mode 100644 index 00000000000..6d94c9c2e12 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot/README.md b/samples/server/petstore/kotlin-springboot/README.md new file mode 100644 index 00000000000..b6865a08113 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/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/build.gradle.kts b/samples/server/petstore/kotlin-springboot/build.gradle.kts new file mode 100644 index 00000000000..f7a2deac996 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/build.gradle.kts @@ -0,0 +1,46 @@ +import org.jetbrains.kotlin.gradle.tasks.KotlinCompile + +buildscript { + repositories { + jcenter() + mavenCentral() + } + dependencies { + classpath("org.springframework.boot:spring-boot-gradle-plugin:2.0.3.RELEASE") + } +} + +group = "org.openapitools" +version = "1.0.0" + +repositories { + jcenter() + mavenCentral() +} + +tasks.withType { + kotlinOptions.jvmTarget = "1.8" +} + +plugins { + val kotlinVersion = "1.2.60" + id("org.jetbrains.kotlin.jvm") version kotlinVersion + id("org.jetbrains.kotlin.plugin.jpa") version kotlinVersion + id("org.jetbrains.kotlin.plugin.spring") version kotlinVersion + id("org.springframework.boot") version "2.0.3.RELEASE" + id("io.spring.dependency-management") version "1.0.5.RELEASE" +} + +dependencies { + 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.springframework.boot:spring-boot-starter-test") { + exclude(module = "junit") + } +} diff --git a/samples/server/petstore/kotlin-springboot/pom.xml b/samples/server/petstore/kotlin-springboot/pom.xml new file mode 100644 index 00000000000..96ed05a21d5 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/pom.xml @@ -0,0 +1,109 @@ + + 4.0.0 + org.openapitools + openapi-spring + jar + openapi-spring + 1.0.0 + + 1.2.60 + + + org.springframework.boot + spring-boot-starter-parent + 2.0.3.RELEASE + + + ${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.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 + + + diff --git a/samples/server/petstore/kotlin-springboot/settings.gradle b/samples/server/petstore/kotlin-springboot/settings.gradle new file mode 100644 index 00000000000..f0dd035311e --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "openapi-spring" \ No newline at end of file diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/Application.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/Application.kt new file mode 100644 index 00000000000..f2ee49d476b --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/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/src/main/kotlin/org/openapitools/api/Exceptions.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/Exceptions.kt new file mode 100644 index 00000000000..4d8400902aa --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/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/src/main/kotlin/org/openapitools/api/PetApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt new file mode 100644 index 00000000000..17b87c74fdf --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApi.kt @@ -0,0 +1,159 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import io.swagger.annotations.* +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity +import org.springframework.stereotype.Controller +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +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.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.web.multipart.MultipartFile +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.* + +import kotlin.collections.List +import kotlin.collections.Map + +@Controller +@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 pet: Pet): ResponseEntity { + return ResponseEntity(service.addPet(pet), HttpStatus.OK) + } + + @ApiOperation( + value = "Deletes a pet", + nickname = "deletePet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid pet value")]) + @RequestMapping( + value = ["/pet/{petId}"], + method = [RequestMethod.DELETE]) + fun deletePet(@ApiParam(value = "Pet id to delete", required=true) @PathVariable("petId") petId: Long,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) apiKey: String?): ResponseEntity { + return ResponseEntity(service.deletePet(petId, apiKey), HttpStatus.OK) + } + + @ApiOperation( + value = "Finds Pets by status", + nickname = "findPetsByStatus", + notes = "Multiple status values can be provided with comma separated strings", + response = Pet::class, + responseContainer = "List", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "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: List): ResponseEntity> { + return ResponseEntity(service.findPetsByStatus(status), HttpStatus.OK) + } + + @ApiOperation( + value = "Finds Pets by tags", + nickname = "findPetsByTags", + notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", + response = Pet::class, + responseContainer = "List", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "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: List): ResponseEntity> { + return ResponseEntity(service.findPetsByTags(tags), HttpStatus.OK) + } + + @ApiOperation( + value = "Find pet by ID", + nickname = "getPetById", + notes = "Returns a single pet", + response = Pet::class, + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Pet::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found")]) + @RequestMapping( + value = ["/pet/{petId}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun getPetById(@ApiParam(value = "ID of pet to return", required=true) @PathVariable("petId") petId: Long): ResponseEntity { + return ResponseEntity(service.getPetById(petId), HttpStatus.OK) + } + + @ApiOperation( + value = "Update an existing pet", + nickname = "updatePet", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Pet not found"),ApiResponse(code = 405, message = "Validation exception")]) + @RequestMapping( + value = ["/pet"], + consumes = ["application/json", "application/xml"], + method = [RequestMethod.PUT]) + fun updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody pet: Pet): ResponseEntity { + return ResponseEntity(service.updatePet(pet), HttpStatus.OK) + } + + @ApiOperation( + value = "Updates a pet in the store with form data", + nickname = "updatePetWithForm", + notes = "", + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 405, message = "Invalid input")]) + @RequestMapping( + value = ["/pet/{petId}"], + consumes = ["application/x-www-form-urlencoded"], + method = [RequestMethod.POST]) + fun updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated", required=true) @PathVariable("petId") petId: Long,@ApiParam(value = "Updated name of the pet", defaultValue="null") @RequestParam(value="name", required=false) name: String ,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) status: String ): ResponseEntity { + return ResponseEntity(service.updatePetWithForm(petId, name, status), HttpStatus.OK) + } + + @ApiOperation( + value = "uploads an image", + nickname = "uploadFile", + notes = "", + response = ModelApiResponse::class, + authorizations = [Authorization(value = "petstore_auth", scopes = [AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), AuthorizationScope(scope = "read:pets", description = "read your pets")])]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse::class)]) + @RequestMapping( + value = ["/pet/{petId}/uploadImage"], + produces = ["application/json"], + consumes = ["multipart/form-data"], + method = [RequestMethod.POST]) + fun uploadFile(@ApiParam(value = "ID of pet to update", required=true) @PathVariable("petId") petId: Long,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) additionalMetadata: String ,@ApiParam(value = "file detail") @Valid @RequestPart("file") file: MultipartFile): ResponseEntity { + return ResponseEntity(service.uploadFile(petId, additionalMetadata, file), HttpStatus.OK) + } +} diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt new file mode 100644 index 00000000000..b31d96e91b7 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiService.kt @@ -0,0 +1,23 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet + +interface PetApiService { + + fun addPet(pet: Pet): Unit + + fun deletePet(petId: Long,apiKey: String?): Unit + + fun findPetsByStatus(status: List): List + + fun findPetsByTags(tags: List): List + + fun getPetById(petId: Long): Pet + + fun updatePet(pet: Pet): Unit + + fun updatePetWithForm(petId: Long,name: String,status: String): Unit + + fun uploadFile(petId: Long,additionalMetadata: String,file: org.springframework.web.multipart.MultipartFile): ModelApiResponse +} diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt new file mode 100644 index 00000000000..80b7d6e8fe1 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/PetApiServiceImpl.kt @@ -0,0 +1,41 @@ +package org.openapitools.api + +import org.openapitools.model.ModelApiResponse +import org.openapitools.model.Pet +import org.springframework.stereotype.Service + +@Service +class PetApiServiceImpl : PetApiService { + + override fun addPet(pet: Pet): Unit { + TODO("Implement me") + } + + override fun deletePet(petId: Long,apiKey: String?): Unit { + TODO("Implement me") + } + + override fun findPetsByStatus(status: List): List { + TODO("Implement me") + } + + override fun findPetsByTags(tags: List): List { + TODO("Implement me") + } + + override fun getPetById(petId: Long): Pet { + TODO("Implement me") + } + + override fun updatePet(pet: Pet): Unit { + TODO("Implement me") + } + + override fun updatePetWithForm(petId: Long,name: String,status: String): Unit { + TODO("Implement me") + } + + override fun uploadFile(petId: Long,additionalMetadata: String,file: org.springframework.web.multipart.MultipartFile): ModelApiResponse { + TODO("Implement me") + } +} diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt new file mode 100644 index 00000000000..01c64e66ccf --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApi.kt @@ -0,0 +1,92 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import io.swagger.annotations.* +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity +import org.springframework.stereotype.Controller +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +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.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.web.multipart.MultipartFile +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.* + +import kotlin.collections.List +import kotlin.collections.Map + +@Controller +@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: String): ResponseEntity { + return ResponseEntity(service.deleteOrder(orderId), HttpStatus.OK) + } + + @ApiOperation( + value = "Returns pet inventories by status", + nickname = "getInventory", + notes = "Returns a map of status codes to quantities", + response = Int::class, + responseContainer = "Map", + authorizations = [Authorization(value = "api_key")]) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Map::class, responseContainer = "Map")]) + @RequestMapping( + value = ["/store/inventory"], + produces = ["application/json"], + method = [RequestMethod.GET]) + fun getInventory(): ResponseEntity> { + return ResponseEntity(service.getInventory(), HttpStatus.OK) + } + + @ApiOperation( + value = "Find purchase order by ID", + nickname = "getOrderById", + notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", + response = Order::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid ID supplied"),ApiResponse(code = 404, message = "Order not found")]) + @RequestMapping( + value = ["/store/order/{orderId}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched", required=true) @PathVariable("orderId") orderId: Long): ResponseEntity { + return ResponseEntity(service.getOrderById(orderId), HttpStatus.OK) + } + + @ApiOperation( + value = "Place an order for a pet", + nickname = "placeOrder", + notes = "", + response = Order::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = Order::class),ApiResponse(code = 400, message = "Invalid Order")]) + @RequestMapping( + value = ["/store/order"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.POST]) + fun placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody order: Order): ResponseEntity { + return ResponseEntity(service.placeOrder(order), HttpStatus.OK) + } +} diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt new file mode 100644 index 00000000000..7767fa87a8a --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiService.kt @@ -0,0 +1,14 @@ +package org.openapitools.api + +import org.openapitools.model.Order + +interface StoreApiService { + + fun deleteOrder(orderId: String): Unit + + fun getInventory(): Map + + fun getOrderById(orderId: Long): Order + + fun placeOrder(order: Order): Order +} diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt new file mode 100644 index 00000000000..850853758fe --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/StoreApiServiceImpl.kt @@ -0,0 +1,24 @@ +package org.openapitools.api + +import org.openapitools.model.Order +import org.springframework.stereotype.Service + +@Service +class StoreApiServiceImpl : StoreApiService { + + override fun deleteOrder(orderId: String): Unit { + TODO("Implement me") + } + + override fun getInventory(): Map { + TODO("Implement me") + } + + override fun getOrderById(orderId: Long): Order { + TODO("Implement me") + } + + override fun placeOrder(order: Order): Order { + TODO("Implement me") + } +} diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt new file mode 100644 index 00000000000..b68773524a2 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApi.kt @@ -0,0 +1,140 @@ +package org.openapitools.api + +import org.openapitools.model.User +import io.swagger.annotations.* +import org.springframework.http.HttpStatus +import org.springframework.http.MediaType +import org.springframework.http.ResponseEntity +import org.springframework.stereotype.Controller +import org.springframework.web.bind.annotation.RequestBody +import org.springframework.web.bind.annotation.RequestPart +import org.springframework.web.bind.annotation.RequestParam +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.validation.annotation.Validated +import org.springframework.web.context.request.NativeWebRequest +import org.springframework.web.multipart.MultipartFile +import org.springframework.beans.factory.annotation.Autowired + +import javax.validation.Valid +import javax.validation.constraints.* + +import kotlin.collections.List +import kotlin.collections.Map + +@Controller +@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 user: User): ResponseEntity { + return ResponseEntity(service.createUser(user), HttpStatus.OK) + } + + @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 user: List): ResponseEntity { + return ResponseEntity(service.createUsersWithArrayInput(user), HttpStatus.OK) + } + + @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 user: List): ResponseEntity { + return ResponseEntity(service.createUsersWithListInput(user), HttpStatus.OK) + } + + @ApiOperation( + value = "Delete user", + nickname = "deleteUser", + notes = "This can only be done by the logged in user.") + @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: String): ResponseEntity { + return ResponseEntity(service.deleteUser(username), HttpStatus.OK) + } + + @ApiOperation( + value = "Get user by user name", + nickname = "getUserByName", + notes = "", + response = User::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = User::class),ApiResponse(code = 400, message = "Invalid username supplied"),ApiResponse(code = 404, message = "User not found")]) + @RequestMapping( + value = ["/user/{username}"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.", required=true) @PathVariable("username") username: String): ResponseEntity { + return ResponseEntity(service.getUserByName(username), HttpStatus.OK) + } + + @ApiOperation( + value = "Logs user into the system", + nickname = "loginUser", + notes = "", + response = String::class) + @ApiResponses( + value = [ApiResponse(code = 200, message = "successful operation", response = String::class),ApiResponse(code = 400, message = "Invalid username/password supplied")]) + @RequestMapping( + value = ["/user/login"], + produces = ["application/xml", "application/json"], + method = [RequestMethod.GET]) + fun loginUser(@NotNull @ApiParam(value = "The user name for login", required = true) @Valid @RequestParam(value = "username", required = true) username: String,@NotNull @ApiParam(value = "The password for login in clear text", required = true) @Valid @RequestParam(value = "password", required = true) password: String): ResponseEntity { + return ResponseEntity(service.loginUser(username, password), HttpStatus.OK) + } + + @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.OK) + } + + @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: String,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody user: User): ResponseEntity { + return ResponseEntity(service.updateUser(username, user), HttpStatus.OK) + } +} diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt new file mode 100644 index 00000000000..b8a3d7ebae1 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiService.kt @@ -0,0 +1,22 @@ +package org.openapitools.api + +import org.openapitools.model.User + +interface UserApiService { + + fun createUser(user: User): Unit + + fun createUsersWithArrayInput(user: List): Unit + + fun createUsersWithListInput(user: List): Unit + + fun deleteUser(username: String): Unit + + fun getUserByName(username: String): User + + fun loginUser(username: String,password: String): String + + fun logoutUser(): Unit + + fun updateUser(username: String,user: User): Unit +} diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt new file mode 100644 index 00000000000..62b365a6d82 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/api/UserApiServiceImpl.kt @@ -0,0 +1,40 @@ +package org.openapitools.api + +import org.openapitools.model.User +import org.springframework.stereotype.Service + +@Service +class UserApiServiceImpl : UserApiService { + + override fun createUser(user: User): Unit { + TODO("Implement me") + } + + override fun createUsersWithArrayInput(user: List): Unit { + TODO("Implement me") + } + + override fun createUsersWithListInput(user: List): Unit { + TODO("Implement me") + } + + override fun deleteUser(username: String): Unit { + TODO("Implement me") + } + + override fun getUserByName(username: String): User { + TODO("Implement me") + } + + override fun loginUser(username: String,password: String): String { + TODO("Implement me") + } + + override fun logoutUser(): Unit { + TODO("Implement me") + } + + override fun updateUser(username: String,user: User): Unit { + TODO("Implement me") + } +} diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt new file mode 100644 index 00000000000..da259e87b8e --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Category.kt @@ -0,0 +1,24 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.Valid +import javax.validation.constraints.* +import io.swagger.annotations.ApiModelProperty + +/** + * A category for a pet + * @param id + * @param name + */ +data class Category ( + + @ApiModelProperty(value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("name") val name: String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt new file mode 100644 index 00000000000..e933f2436a4 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/ModelApiResponse.kt @@ -0,0 +1,28 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.Valid +import javax.validation.constraints.* +import io.swagger.annotations.ApiModelProperty + +/** + * Describes the result of uploading an image resource + * @param code + * @param type + * @param message + */ +data class ModelApiResponse ( + + @ApiModelProperty(value = "") + @JsonProperty("code") val code: Int? = null, + + @ApiModelProperty(value = "") + @JsonProperty("type") val type: String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("message") val message: String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt new file mode 100644 index 00000000000..e1065f56bd3 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Order.kt @@ -0,0 +1,55 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.annotation.JsonValue +import javax.validation.Valid +import javax.validation.constraints.* +import 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(value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("petId") val petId: Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("quantity") val quantity: Int? = null, + + @ApiModelProperty(value = "") + @JsonProperty("shipDate") val shipDate: java.time.OffsetDateTime? = null, + + @ApiModelProperty(value = "Order Status") + @JsonProperty("status") val status: Order.Status? = null, + + @ApiModelProperty(value = "") + @JsonProperty("complete") val complete: Boolean? = null +) { + + /** + * Order Status + * Values: placed,approved,delivered + */ + enum class Status(val value: String) { + + @JsonProperty("placed") placed("placed"), + + @JsonProperty("approved") approved("approved"), + + @JsonProperty("delivered") delivered("delivered"); + + } + +} + diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt new file mode 100644 index 00000000000..967bd0846b6 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Pet.kt @@ -0,0 +1,59 @@ +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.Valid +import javax.validation.constraints.* +import io.swagger.annotations.ApiModelProperty + +/** + * A pet for sale in the pet store + * @param id + * @param category + * @param name + * @param photoUrls + * @param tags + * @param status pet status in the store + */ +data class Pet ( + + @get:NotNull + @ApiModelProperty(example = "doggie", required = true, value = "") + @JsonProperty("name") val name: String, + + @get:NotNull + @ApiModelProperty(required = true, value = "") + @JsonProperty("photoUrls") val photoUrls: List, + + @ApiModelProperty(value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("category") val category: Category? = null, + + @ApiModelProperty(value = "") + @JsonProperty("tags") val tags: List? = null, + + @ApiModelProperty(value = "pet status in the store") + @JsonProperty("status") val status: Pet.Status? = null +) { + + /** + * pet status in the store + * Values: available,pending,sold + */ + enum class Status(val value: String) { + + @JsonProperty("available") available("available"), + + @JsonProperty("pending") pending("pending"), + + @JsonProperty("sold") sold("sold"); + + } + +} + diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt new file mode 100644 index 00000000000..e40833c55fd --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/Tag.kt @@ -0,0 +1,24 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.Valid +import javax.validation.constraints.* +import io.swagger.annotations.ApiModelProperty + +/** + * A tag for a pet + * @param id + * @param name + */ +data class Tag ( + + @ApiModelProperty(value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("name") val name: String? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt new file mode 100644 index 00000000000..b9cc2886ea0 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/src/main/kotlin/org/openapitools/model/User.kt @@ -0,0 +1,48 @@ +package org.openapitools.model + +import java.util.Objects +import com.fasterxml.jackson.annotation.JsonProperty +import javax.validation.Valid +import javax.validation.constraints.* +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(value = "") + @JsonProperty("id") val id: Long? = null, + + @ApiModelProperty(value = "") + @JsonProperty("username") val username: String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("firstName") val firstName: String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("lastName") val lastName: String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("email") val email: String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("password") val password: String? = null, + + @ApiModelProperty(value = "") + @JsonProperty("phone") val phone: String? = null, + + @ApiModelProperty(value = "User Status") + @JsonProperty("userStatus") val userStatus: Int? = null +) { + +} + diff --git a/samples/server/petstore/kotlin-springboot/src/main/resources/application.yaml b/samples/server/petstore/kotlin-springboot/src/main/resources/application.yaml new file mode 100644 index 00000000000..8e2ebcde976 --- /dev/null +++ b/samples/server/petstore/kotlin-springboot/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/php-lumen/lib/readme.md b/samples/server/petstore/php-lumen/lib/readme.md index cd61e963163..e0dba8a2f5c 100644 --- a/samples/server/petstore/php-lumen/lib/readme.md +++ b/samples/server/petstore/php-lumen/lib/readme.md @@ -20,3 +20,8 @@ Using `composer update` to install the framework and dependencies via [Composer] The `composer update` should be the first thing to do right after generating Lumen server stub. The autoload.php will be generated only after excuting `composer update`. Or there would be errors during service or model migration. +### Running the generated server stub + +```bash +php -S localhost:8080 public/index.php +``` diff --git a/samples/server/petstore/php-slim/README.md b/samples/server/petstore/php-slim/README.md index 85f8dfa9803..ff2ac3a4e68 100644 --- a/samples/server/petstore/php-slim/README.md +++ b/samples/server/petstore/php-slim/README.md @@ -5,7 +5,7 @@ ## Requirements * Web server with URL rewriting -* PHP 5.5 or newer +* PHP 5.5.9 or newer This package contains `.htaccess` for Apache configuration. If you use another server(Nginx, HHVM, IIS, lighttpd) check out [Web Servers](https://www.slimframework.com/docs/v3/start/web-servers.html) doc. @@ -30,15 +30,20 @@ $ php -S localhost:8888 -t php-slim-server ## Run tests -This package uses PHPUnit 4.8 for unit testing. +This package uses PHPUnit 4.8 for unit testing and PHP Codesniffer to check source code against user defined coding standard(`phpcsStandard` generator config option). [Test folder](test) contains templates which you can fill with real test assertions. How to write tests read at [PHPUnit Manual - Chapter 2. Writing Tests for PHPUnit](https://phpunit.de/manual/4.8/en/writing-tests-for-phpunit.html). +How to configure PHP CodeSniffer read at [PHP CodeSniffer Documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki). +There is [phplint](https://github.com/overtrue/phplint) tool to check php syntax automatically. Command | Tool | Target ---- | ---- | ---- `$ composer test` | PHPUnit | All tests `$ composer run test-apis` | PHPUnit | Apis tests `$ composer run test-models` | PHPUnit | Models tests +`$ composer run phpcs` | PHP CodeSniffer | All files +`$ composer run phplint` | phplint | All files + ## API Endpoints diff --git a/samples/server/petstore/php-slim/composer.json b/samples/server/petstore/php-slim/composer.json index ca199179020..1c4e6a790f8 100644 --- a/samples/server/petstore/php-slim/composer.json +++ b/samples/server/petstore/php-slim/composer.json @@ -1,12 +1,14 @@ { "minimum-stability": "RC", "require": { - "php": ">=5.5", + "php": ">=5.5.9", "slim/slim": "3.*", "tuupola/slim-basic-auth": "^3.0.0" }, "require-dev": { - "phpunit/phpunit": "^4.8" + "phpunit/phpunit": "^4.8", + "overtrue/phplint": "^1.0", + "squizlabs/php_codesniffer": "^3.0" }, "autoload": { "psr-4": { "OpenAPIServer\\": "lib/" } @@ -20,6 +22,8 @@ "@test-models" ], "test-apis": "phpunit --testsuite Apis", - "test-models": "phpunit --testsuite Models" + "test-models": "phpunit --testsuite Models", + "phpcs": "phpcs ./ --ignore=vendor --warning-severity=0 --standard=PSR12", + "phplint": "phplint ./ --exclude=vendor" } -} \ No newline at end of file +} diff --git a/samples/server/petstore/php-slim/composer.lock b/samples/server/petstore/php-slim/composer.lock index 75bac6e27ba..91f98b9ed53 100644 --- a/samples/server/petstore/php-slim/composer.lock +++ b/samples/server/petstore/php-slim/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "7abeaa62669cac171aa0692df2e1943b", + "content-hash": "df189d30a7ab9ec76b4d8994a6cfaec9", "packages": [ { "name": "container-interop/container-interop", @@ -37,58 +37,6 @@ "homepage": "https://github.com/container-interop/container-interop", "time": "2017-02-14T19:40:03+00:00" }, - { - "name": "http-interop/http-factory", - "version": "0.3.0", - "source": { - "type": "git", - "url": "https://github.com/http-interop/http-factory.git", - "reference": "c2587cc0a6f74987fefb5b8074acfd32c69a4b0f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/http-interop/http-factory/zipball/c2587cc0a6f74987fefb5b8074acfd32c69a4b0f", - "reference": "c2587cc0a6f74987fefb5b8074acfd32c69a4b0f", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/http-message": "^1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Interop\\Http\\Factory\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interface for HTTP message factories", - "keywords": [ - "factory", - "http", - "message", - "psr", - "psr-17", - "psr-7", - "request", - "response" - ], - "time": "2017-03-24T14:48:51+00:00" - }, { "name": "nikic/fast-route", "version": "v1.3.0", @@ -234,6 +182,58 @@ ], "time": "2017-02-14T16:28:37+00:00" }, + { + "name": "psr/http-factory", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/378bfe27931ecc54ff824a20d6f6bfc303bbd04c", + "reference": "378bfe27931ecc54ff824a20d6f6bfc303bbd04c", + "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": "2018-07-30T21:54:04+00:00" + }, { "name": "psr/http-message", "version": "1.0.1", @@ -463,20 +463,20 @@ }, { "name": "tuupola/callable-handler", - "version": "0.3.0", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/tuupola/callable-handler.git", - "reference": "5141efa1e974687a3fa53338811a988198f50662" + "reference": "662744a6a4a52235be5bd73ac04de4375eff3fc9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tuupola/callable-handler/zipball/5141efa1e974687a3fa53338811a988198f50662", - "reference": "5141efa1e974687a3fa53338811a988198f50662", + "url": "https://api.github.com/repos/tuupola/callable-handler/zipball/662744a6a4a52235be5bd73ac04de4375eff3fc9", + "reference": "662744a6a4a52235be5bd73ac04de4375eff3fc9", "shasum": "" }, "require": { - "php": "^7.0", + "php": "^7.1", "psr/http-server-middleware": "^1.0" }, "require-dev": { @@ -484,7 +484,7 @@ "overtrue/phplint": "^1.0", "phpunit/phpunit": "^6.5", "squizlabs/php_codesniffer": "^3.2", - "tuupola/http-factory": "^0.3.0", + "tuupola/http-factory": "^0.4.0", "zendframework/zend-diactoros": "^1.6" }, "type": "library", @@ -512,29 +512,30 @@ "psr-15", "psr-7" ], - "time": "2018-01-23T04:07:25+00:00" + "time": "2018-08-02T11:15:40+00:00" }, { "name": "tuupola/http-factory", - "version": "0.3.0", + "version": "0.4.2", "source": { "type": "git", "url": "https://github.com/tuupola/http-factory.git", - "reference": "57b2e19ff3f4af0bbee4e31fd282689be351f1ad" + "reference": "c7e2712d5c4f49ddae704ae1f42854f437ddb028" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tuupola/http-factory/zipball/57b2e19ff3f4af0bbee4e31fd282689be351f1ad", - "reference": "57b2e19ff3f4af0bbee4e31fd282689be351f1ad", + "url": "https://api.github.com/repos/tuupola/http-factory/zipball/c7e2712d5c4f49ddae704ae1f42854f437ddb028", + "reference": "c7e2712d5c4f49ddae704ae1f42854f437ddb028", "shasum": "" }, "require": { - "http-interop/http-factory": "^0.3.0" + "php": "^7.1", + "psr/http-factory": "^1.0" }, "require-dev": { - "http-interop/http-factory-tests": "^0.3.0", - "overtrue/phplint": "^0.2.1", - "phpunit/phpunit": "^5.7", + "http-interop/http-factory-tests": "^0.5.0", + "overtrue/phplint": "^1.0", + "phpunit/phpunit": "^6.5", "squizlabs/php_codesniffer": "^3.0" }, "type": "library", @@ -562,29 +563,28 @@ "psr-17", "psr-7" ], - "time": "2017-07-15T22:03:15+00:00" + "time": "2018-08-09T09:02:33+00:00" }, { "name": "tuupola/slim-basic-auth", - "version": "3.1.0", + "version": "3.2.0", "source": { "type": "git", "url": "https://github.com/tuupola/slim-basic-auth.git", - "reference": "b169fba3113059548e3a2ac4096b1b08616b070e" + "reference": "e4bbd5e9f609cb6e83264e56f79289fea48c8bbc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/tuupola/slim-basic-auth/zipball/b169fba3113059548e3a2ac4096b1b08616b070e", - "reference": "b169fba3113059548e3a2ac4096b1b08616b070e", + "url": "https://api.github.com/repos/tuupola/slim-basic-auth/zipball/e4bbd5e9f609cb6e83264e56f79289fea48c8bbc", + "reference": "e4bbd5e9f609cb6e83264e56f79289fea48c8bbc", "shasum": "" }, "require": { - "http-interop/http-factory": "^0.3.0", "php": "^7.1", "psr/http-message": "^1.0", "psr/http-server-middleware": "^1.0", - "tuupola/callable-handler": "^0.3.0", - "tuupola/http-factory": "^0.3.0" + "tuupola/callable-handler": "^0.3.0|^0.4.0", + "tuupola/http-factory": "^0.4.0" }, "require-dev": { "codedungeon/phpunit-result-printer": "^0.6.0", @@ -620,7 +620,7 @@ "psr-15", "psr-7" ], - "time": "2018-05-06T05:41:44+00:00" + "time": "2018-08-07T08:09:49+00:00" } ], "packages-dev": [ @@ -678,6 +678,59 @@ ], "time": "2017-07-22T11:58:36+00:00" }, + { + "name": "overtrue/phplint", + "version": "1.1.3", + "source": { + "type": "git", + "url": "https://github.com/overtrue/phplint.git", + "reference": "b8822e30b5bd1412471520901ba148c5417656c8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/overtrue/phplint/zipball/b8822e30b5bd1412471520901ba148c5417656c8", + "reference": "b8822e30b5bd1412471520901ba148c5417656c8", + "shasum": "" + }, + "require": { + "ext-json": "*", + "php": ">=5.5.9", + "symfony/console": "^3.2|^4.0", + "symfony/finder": "^3.0|^4.0", + "symfony/process": "^3.0|^4.0", + "symfony/yaml": "^3.0|^4.0" + }, + "require-dev": { + "jakub-onderka/php-console-highlighter": "^0.3.2" + }, + "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": "2018-06-19T06:30:45+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "1.0.1", @@ -832,16 +885,16 @@ }, { "name": "phpspec/prophecy", - "version": "1.7.6", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712" + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/33a7e3c4fda54e912ff6338c48823bd5c0f0b712", - "reference": "33a7e3c4fda54e912ff6338c48823bd5c0f0b712", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", + "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", "shasum": "" }, "require": { @@ -853,12 +906,12 @@ }, "require-dev": { "phpspec/phpspec": "^2.5|^3.2", - "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.7.x-dev" + "dev-master": "1.8.x-dev" } }, "autoload": { @@ -891,7 +944,7 @@ "spy", "stub" ], - "time": "2018-04-18T13:57:24+00:00" + "time": "2018-08-05T17:53:17+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1642,26 +1695,146 @@ "time": "2015-06-21T13:59:46+00:00" }, { - "name": "symfony/polyfill-ctype", - "version": "v1.8.0", + "name": "symfony/console", + "version": "v4.1.3", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae" + "url": "https://github.com/symfony/console.git", + "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/7cc359f1b7b80fc25ed7796be7d96adc9b354bae", - "reference": "7cc359f1b7b80fc25ed7796be7d96adc9b354bae", + "url": "https://api.github.com/repos/symfony/console/zipball/ca80b8ced97cf07390078b29773dc384c39eee1f", + "reference": "ca80b8ced97cf07390078b29773dc384c39eee1f", + "shasum": "" + }, + "require": { + "php": "^7.1.3", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/dependency-injection": "<3.4", + "symfony/process": "<3.3" + }, + "require-dev": { + "psr/log": "~1.0", + "symfony/config": "~3.4|~4.0", + "symfony/dependency-injection": "~3.4|~4.0", + "symfony/event-dispatcher": "~3.4|~4.0", + "symfony/lock": "~3.4|~4.0", + "symfony/process": "~3.4|~4.0" + }, + "suggest": { + "psr/log-implementation": "For using the console logger", + "symfony/event-dispatcher": "", + "symfony/lock": "", + "symfony/process": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-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": "2018-07-26T11:24:31+00:00" + }, + { + "name": "symfony/finder", + "version": "v4.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/e162f1df3102d0b7472805a5a9d5db9fcf0a8068", + "reference": "e162f1df3102d0b7472805a5a9d5db9fcf0a8068", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-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": "2018-07-26T11:24:31+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.9.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", "shasum": "" }, "require": { "php": ">=5.3.3" }, + "suggest": { + "ext-ctype": "For best performance" + }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "autoload": { @@ -1694,20 +1867,128 @@ "polyfill", "portable" ], - "time": "2018-04-30T19:57:29+00:00" + "time": "2018-08-06T14:22:27+00:00" }, { - "name": "symfony/yaml", - "version": "v3.4.13", + "name": "symfony/polyfill-mbstring", + "version": "v1.9.0", "source": { "type": "git", - "url": "https://github.com/symfony/yaml.git", - "reference": "c5010cc1692ce1fa328b1fb666961eb3d4a85bb0" + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/c5010cc1692ce1fa328b1fb666961eb3d4a85bb0", - "reference": "c5010cc1692ce1fa328b1fb666961eb3d4a85bb0", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d0cd638f4634c16d8df4508e847f14e9e43168b8", + "reference": "d0cd638f4634c16d8df4508e847f14e9e43168b8", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-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": "2018-08-06T14:22:27+00:00" + }, + { + "name": "symfony/process", + "version": "v4.1.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "f01fc7a4493572f7f506c49dcb50ad01fb3a2f56" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/f01fc7a4493572f7f506c49dcb50ad01fb3a2f56", + "reference": "f01fc7a4493572f7f506c49dcb50ad01fb3a2f56", + "shasum": "" + }, + "require": { + "php": "^7.1.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "4.1-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": "2018-07-26T11:24:31+00:00" + }, + { + "name": "symfony/yaml", + "version": "v3.4.14", + "source": { + "type": "git", + "url": "https://github.com/symfony/yaml.git", + "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/yaml/zipball/810af2d35fc72b6cf5c01116806d2b65ccaaf2e2", + "reference": "810af2d35fc72b6cf5c01116806d2b65ccaaf2e2", "shasum": "" }, "require": { @@ -1753,7 +2034,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2018-05-03T23:18:14+00:00" + "time": "2018-07-26T11:19:56+00:00" }, { "name": "webmozart/assert", @@ -1812,7 +2093,7 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.5" + "php": ">=5.5.9" }, "platform-dev": [] } diff --git a/samples/server/petstore/php-slim/lib/AbstractApiController.php b/samples/server/petstore/php-slim/lib/AbstractApiController.php index 7f1ee414191..9f20afc8770 100644 --- a/samples/server/petstore/php-slim/lib/AbstractApiController.php +++ b/samples/server/petstore/php-slim/lib/AbstractApiController.php @@ -35,7 +35,8 @@ namespace OpenAPIServer; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -abstract class AbstractApiController { +abstract class AbstractApiController +{ /** * @var \Interop\Container\ContainerInterface Slim app container instance @@ -47,8 +48,8 @@ abstract class AbstractApiController { * * @param \Interop\Container\ContainerInterface $container Slim app container instance */ - public function __construct($container) { + public function __construct($container) + { $this->container = $container; } - } diff --git a/samples/server/petstore/php-slim/lib/Api/AnotherFakeApi.php b/samples/server/petstore/php-slim/lib/Api/AnotherFakeApi.php index ff108200b53..31a641e5528 100644 --- a/samples/server/petstore/php-slim/lib/Api/AnotherFakeApi.php +++ b/samples/server/petstore/php-slim/lib/Api/AnotherFakeApi.php @@ -37,7 +37,8 @@ use OpenAPIServer\AbstractApiController; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -class AnotherFakeApi extends AbstractApiController { +class AnotherFakeApi extends AbstractApiController +{ /** * PATCH call123TestSpecialTags @@ -49,10 +50,10 @@ class AnotherFakeApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function call123TestSpecialTags($request, $response, $args) { + public function call123TestSpecialTags($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing call123TestSpecialTags as a PATCH method ?'); return $response; } - } diff --git a/samples/server/petstore/php-slim/lib/Api/FakeApi.php b/samples/server/petstore/php-slim/lib/Api/FakeApi.php index 2f8fee13498..c93048cdfe5 100644 --- a/samples/server/petstore/php-slim/lib/Api/FakeApi.php +++ b/samples/server/petstore/php-slim/lib/Api/FakeApi.php @@ -37,11 +37,11 @@ use OpenAPIServer\AbstractApiController; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -class FakeApi extends AbstractApiController { +class FakeApi extends AbstractApiController +{ /** * POST fakeOuterBooleanSerialize - * Summary: * Notes: Test serialization of outer boolean types * Output-Formats: [*_/_*] * @@ -49,15 +49,15 @@ class FakeApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function fakeOuterBooleanSerialize($request, $response, $args) { + public function fakeOuterBooleanSerialize($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing fakeOuterBooleanSerialize as a POST method ?'); return $response; } - + /** * POST fakeOuterCompositeSerialize - * Summary: * Notes: Test serialization of object with outer number type * Output-Formats: [*_/_*] * @@ -65,15 +65,15 @@ class FakeApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function fakeOuterCompositeSerialize($request, $response, $args) { + public function fakeOuterCompositeSerialize($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing fakeOuterCompositeSerialize as a POST method ?'); return $response; } - + /** * POST fakeOuterNumberSerialize - * Summary: * Notes: Test serialization of outer number types * Output-Formats: [*_/_*] * @@ -81,15 +81,15 @@ class FakeApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function fakeOuterNumberSerialize($request, $response, $args) { + public function fakeOuterNumberSerialize($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing fakeOuterNumberSerialize as a POST method ?'); return $response; } - + /** * POST fakeOuterStringSerialize - * Summary: * Notes: Test serialization of outer string types * Output-Formats: [*_/_*] * @@ -97,44 +97,44 @@ class FakeApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function fakeOuterStringSerialize($request, $response, $args) { + public function fakeOuterStringSerialize($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing fakeOuterStringSerialize as a POST method ?'); return $response; } - + /** * PUT testBodyWithFileSchema - * Summary: * Notes: For this test, the body for this request much reference a schema named `File`. * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function testBodyWithFileSchema($request, $response, $args) { + public function testBodyWithFileSchema($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing testBodyWithFileSchema as a PUT method ?'); return $response; } - + /** * PUT testBodyWithQueryParams - * Summary: - * Notes: * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function testBodyWithQueryParams($request, $response, $args) { + public function testBodyWithQueryParams($request, $response, $args) + { $queryParams = $request->getQueryParams(); $query = $request->getQueryParam('query'); $body = $request->getParsedBody(); $response->write('How about implementing testBodyWithQueryParams as a PUT method ?'); return $response; } - + /** * PATCH testClientModel * Summary: To test \"client\" model @@ -145,12 +145,13 @@ class FakeApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function testClientModel($request, $response, $args) { + public function testClientModel($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing testClientModel as a PATCH method ?'); return $response; } - + /** * POST testEndpointParameters * Summary: Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -160,7 +161,8 @@ class FakeApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function testEndpointParameters($request, $response, $args) { + public function testEndpointParameters($request, $response, $args) + { $integer = $request->getParsedBodyParam('integer'); $int32 = $request->getParsedBodyParam('int32'); $int64 = $request->getParsedBodyParam('int64'); @@ -178,7 +180,7 @@ class FakeApi extends AbstractApiController { $response->write('How about implementing testEndpointParameters as a POST method ?'); return $response; } - + /** * GET testEnumParameters * Summary: To test enum parameters @@ -188,7 +190,8 @@ class FakeApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function testEnumParameters($request, $response, $args) { + public function testEnumParameters($request, $response, $args) + { $headers = $request->getHeaders(); $enumHeaderStringArray = $request->hasHeader('enum_header_string_array') ? $headers['enum_header_string_array'] : null; $enumHeaderString = $request->hasHeader('enum_header_string') ? $headers['enum_header_string'] : null; @@ -202,36 +205,35 @@ class FakeApi extends AbstractApiController { $response->write('How about implementing testEnumParameters as a GET method ?'); return $response; } - + /** * POST testInlineAdditionalProperties * Summary: test inline additionalProperties - * Notes: * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function testInlineAdditionalProperties($request, $response, $args) { + public function testInlineAdditionalProperties($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing testInlineAdditionalProperties as a POST method ?'); return $response; } - + /** * GET testJsonFormData * Summary: test json serialization of form data - * Notes: * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function testJsonFormData($request, $response, $args) { + public function testJsonFormData($request, $response, $args) + { $param = $request->getParsedBodyParam('param'); $param2 = $request->getParsedBodyParam('param2'); $response->write('How about implementing testJsonFormData as a GET method ?'); return $response; } - } diff --git a/samples/server/petstore/php-slim/lib/Api/FakeClassnameTags123Api.php b/samples/server/petstore/php-slim/lib/Api/FakeClassnameTags123Api.php index e824913c4e3..c4699994049 100644 --- a/samples/server/petstore/php-slim/lib/Api/FakeClassnameTags123Api.php +++ b/samples/server/petstore/php-slim/lib/Api/FakeClassnameTags123Api.php @@ -37,7 +37,8 @@ use OpenAPIServer\AbstractApiController; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -class FakeClassnameTags123Api extends AbstractApiController { +class FakeClassnameTags123Api extends AbstractApiController +{ /** * PATCH testClassname @@ -49,10 +50,10 @@ class FakeClassnameTags123Api extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function testClassname($request, $response, $args) { + public function testClassname($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing testClassname as a PATCH method ?'); return $response; } - } diff --git a/samples/server/petstore/php-slim/lib/Api/PetApi.php b/samples/server/petstore/php-slim/lib/Api/PetApi.php index 7534dd9e48c..08fd51b46e9 100644 --- a/samples/server/petstore/php-slim/lib/Api/PetApi.php +++ b/samples/server/petstore/php-slim/lib/Api/PetApi.php @@ -37,40 +37,41 @@ use OpenAPIServer\AbstractApiController; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -class PetApi extends AbstractApiController { +class PetApi extends AbstractApiController +{ /** * POST addPet * Summary: Add a new pet to the store - * Notes: * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function addPet($request, $response, $args) { + public function addPet($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing addPet as a POST method ?'); return $response; } - + /** * DELETE deletePet * Summary: Deletes a pet - * Notes: * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function deletePet($request, $response, $args) { + public function deletePet($request, $response, $args) + { $headers = $request->getHeaders(); $apiKey = $request->hasHeader('api_key') ? $headers['api_key'] : null; $petId = $args['petId']; $response->write('How about implementing deletePet as a DELETE method ?'); return $response; } - + /** * GET findPetsByStatus * Summary: Finds Pets by status @@ -81,13 +82,14 @@ class PetApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function findPetsByStatus($request, $response, $args) { + public function findPetsByStatus($request, $response, $args) + { $queryParams = $request->getQueryParams(); $status = $request->getQueryParam('status'); $response->write('How about implementing findPetsByStatus as a GET method ?'); return $response; } - + /** * GET findPetsByTags * Summary: Finds Pets by tags @@ -98,13 +100,14 @@ class PetApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function findPetsByTags($request, $response, $args) { + public function findPetsByTags($request, $response, $args) + { $queryParams = $request->getQueryParams(); $tags = $request->getQueryParam('tags'); $response->write('How about implementing findPetsByTags as a GET method ?'); return $response; } - + /** * GET getPetById * Summary: Find pet by ID @@ -115,78 +118,78 @@ class PetApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function getPetById($request, $response, $args) { + public function getPetById($request, $response, $args) + { $petId = $args['petId']; $response->write('How about implementing getPetById as a GET method ?'); return $response; } - + /** * PUT updatePet * Summary: Update an existing pet - * Notes: * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function updatePet($request, $response, $args) { + public function updatePet($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing updatePet as a PUT method ?'); return $response; } - + /** * POST updatePetWithForm * Summary: Updates a pet in the store with form data - * Notes: * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function updatePetWithForm($request, $response, $args) { + public function updatePetWithForm($request, $response, $args) + { $petId = $args['petId']; $name = $request->getParsedBodyParam('name'); $status = $request->getParsedBodyParam('status'); $response->write('How about implementing updatePetWithForm as a POST method ?'); return $response; } - + /** * POST uploadFile * Summary: uploads an image - * Notes: * Output-Formats: [application/json] * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function uploadFile($request, $response, $args) { + public function uploadFile($request, $response, $args) + { $petId = $args['petId']; $additionalMetadata = $request->getParsedBodyParam('additionalMetadata'); $file = (key_exists('file', $request->getUploadedFiles())) ? $request->getUploadedFiles()['file'] : null; $response->write('How about implementing uploadFile as a POST method ?'); return $response; } - + /** * POST uploadFileWithRequiredFile * Summary: uploads an image (required) - * Notes: * Output-Formats: [application/json] * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function uploadFileWithRequiredFile($request, $response, $args) { + public function uploadFileWithRequiredFile($request, $response, $args) + { $petId = $args['petId']; $additionalMetadata = $request->getParsedBodyParam('additionalMetadata'); $requiredFile = (key_exists('requiredFile', $request->getUploadedFiles())) ? $request->getUploadedFiles()['requiredFile'] : null; $response->write('How about implementing uploadFileWithRequiredFile as a POST method ?'); return $response; } - } diff --git a/samples/server/petstore/php-slim/lib/Api/StoreApi.php b/samples/server/petstore/php-slim/lib/Api/StoreApi.php index 181c66337eb..f668236a34f 100644 --- a/samples/server/petstore/php-slim/lib/Api/StoreApi.php +++ b/samples/server/petstore/php-slim/lib/Api/StoreApi.php @@ -37,7 +37,8 @@ use OpenAPIServer\AbstractApiController; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -class StoreApi extends AbstractApiController { +class StoreApi extends AbstractApiController +{ /** * DELETE deleteOrder @@ -48,12 +49,13 @@ class StoreApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function deleteOrder($request, $response, $args) { + public function deleteOrder($request, $response, $args) + { $orderId = $args['order_id']; $response->write('How about implementing deleteOrder as a DELETE method ?'); return $response; } - + /** * GET getInventory * Summary: Returns pet inventories by status @@ -64,11 +66,12 @@ class StoreApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function getInventory($request, $response, $args) { + public function getInventory($request, $response, $args) + { $response->write('How about implementing getInventory as a GET method ?'); return $response; } - + /** * GET getOrderById * Summary: Find purchase order by ID @@ -79,26 +82,26 @@ class StoreApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function getOrderById($request, $response, $args) { + public function getOrderById($request, $response, $args) + { $orderId = $args['order_id']; $response->write('How about implementing getOrderById as a GET method ?'); return $response; } - + /** * POST placeOrder * Summary: Place an order for a pet - * Notes: * Output-Formats: [application/xml, application/json] * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function placeOrder($request, $response, $args) { + public function placeOrder($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing placeOrder as a POST method ?'); return $response; } - } diff --git a/samples/server/petstore/php-slim/lib/Api/UserApi.php b/samples/server/petstore/php-slim/lib/Api/UserApi.php index 4ba8c652b71..ef9863cfc33 100644 --- a/samples/server/petstore/php-slim/lib/Api/UserApi.php +++ b/samples/server/petstore/php-slim/lib/Api/UserApi.php @@ -37,7 +37,8 @@ use OpenAPIServer\AbstractApiController; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -class UserApi extends AbstractApiController { +class UserApi extends AbstractApiController +{ /** * POST createUser @@ -48,42 +49,43 @@ class UserApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function createUser($request, $response, $args) { + public function createUser($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing createUser as a POST method ?'); return $response; } - + /** * POST createUsersWithArrayInput * Summary: Creates list of users with given input array - * Notes: * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function createUsersWithArrayInput($request, $response, $args) { + public function createUsersWithArrayInput($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing createUsersWithArrayInput as a POST method ?'); return $response; } - + /** * POST createUsersWithListInput * Summary: Creates list of users with given input array - * Notes: * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function createUsersWithListInput($request, $response, $args) { + public function createUsersWithListInput($request, $response, $args) + { $body = $request->getParsedBody(); $response->write('How about implementing createUsersWithListInput as a POST method ?'); return $response; } - + /** * DELETE deleteUser * Summary: Delete user @@ -93,60 +95,61 @@ class UserApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function deleteUser($request, $response, $args) { + public function deleteUser($request, $response, $args) + { $username = $args['username']; $response->write('How about implementing deleteUser as a DELETE method ?'); return $response; } - + /** * GET getUserByName * Summary: Get user by user name - * Notes: * Output-Formats: [application/xml, application/json] * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function getUserByName($request, $response, $args) { + public function getUserByName($request, $response, $args) + { $username = $args['username']; $response->write('How about implementing getUserByName as a GET method ?'); return $response; } - + /** * GET loginUser * Summary: Logs user into the system - * Notes: * Output-Formats: [application/xml, application/json] * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function loginUser($request, $response, $args) { + public function loginUser($request, $response, $args) + { $queryParams = $request->getQueryParams(); $username = $request->getQueryParam('username'); $password = $request->getQueryParam('password'); $response->write('How about implementing loginUser as a GET method ?'); return $response; } - + /** * GET logoutUser * Summary: Logs out current logged in user session - * Notes: * * @param \Psr\Http\Message\ServerRequestInterface $request Request * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function logoutUser($request, $response, $args) { + public function logoutUser($request, $response, $args) + { $response->write('How about implementing logoutUser as a GET method ?'); return $response; } - + /** * PUT updateUser * Summary: Updated user @@ -156,11 +159,11 @@ class UserApi extends AbstractApiController { * @param \Psr\Http\Message\ResponseInterface $response Response * @param array|null $args Path arguments */ - public function updateUser($request, $response, $args) { + public function updateUser($request, $response, $args) + { $username = $args['username']; $body = $request->getParsedBody(); $response->write('How about implementing updateUser as a PUT method ?'); return $response; } - } diff --git a/samples/server/petstore/php-slim/lib/Model/AdditionalPropertiesClass.php b/samples/server/petstore/php-slim/lib/Model/AdditionalPropertiesClass.php index 460fd8573bb..ee96953acb1 100644 --- a/samples/server/petstore/php-slim/lib/Model/AdditionalPropertiesClass.php +++ b/samples/server/petstore/php-slim/lib/Model/AdditionalPropertiesClass.php @@ -7,12 +7,12 @@ namespace OpenAPIServer\Model; /** * AdditionalPropertiesClass */ -class AdditionalPropertiesClass { - +class AdditionalPropertiesClass +{ + /** @var map[string,string] $mapProperty */ private $mapProperty; - + /** @var map[string,map[string,string]] $mapOfMapProperty */ private $mapOfMapProperty; - } diff --git a/samples/server/petstore/php-slim/lib/Model/Animal.php b/samples/server/petstore/php-slim/lib/Model/Animal.php index d4c127fc757..b9bc8ea44b8 100644 --- a/samples/server/petstore/php-slim/lib/Model/Animal.php +++ b/samples/server/petstore/php-slim/lib/Model/Animal.php @@ -7,12 +7,12 @@ namespace OpenAPIServer\Model; /** * Animal */ -class Animal { - +class Animal +{ + /** @var string $className */ private $className; - + /** @var string $color */ private $color; - } diff --git a/samples/server/petstore/php-slim/lib/Model/AnimalFarm.php b/samples/server/petstore/php-slim/lib/Model/AnimalFarm.php index 3d3e6bc0183..36466e01819 100644 --- a/samples/server/petstore/php-slim/lib/Model/AnimalFarm.php +++ b/samples/server/petstore/php-slim/lib/Model/AnimalFarm.php @@ -7,6 +7,6 @@ namespace OpenAPIServer\Model; /** * AnimalFarm */ -class AnimalFarm { - +class AnimalFarm +{ } diff --git a/samples/server/petstore/php-slim/lib/Model/ApiResponse.php b/samples/server/petstore/php-slim/lib/Model/ApiResponse.php index fe48dcd69ce..b6a7390c8bf 100644 --- a/samples/server/petstore/php-slim/lib/Model/ApiResponse.php +++ b/samples/server/petstore/php-slim/lib/Model/ApiResponse.php @@ -7,15 +7,15 @@ namespace OpenAPIServer\Model; /** * ApiResponse */ -class ApiResponse { - +class ApiResponse +{ + /** @var int $code */ private $code; - + /** @var string $type */ private $type; - + /** @var string $message */ private $message; - } diff --git a/samples/server/petstore/php-slim/lib/Model/ArrayOfArrayOfNumberOnly.php b/samples/server/petstore/php-slim/lib/Model/ArrayOfArrayOfNumberOnly.php index 60401112529..1a9159e7ce8 100644 --- a/samples/server/petstore/php-slim/lib/Model/ArrayOfArrayOfNumberOnly.php +++ b/samples/server/petstore/php-slim/lib/Model/ArrayOfArrayOfNumberOnly.php @@ -7,9 +7,9 @@ namespace OpenAPIServer\Model; /** * ArrayOfArrayOfNumberOnly */ -class ArrayOfArrayOfNumberOnly { - +class ArrayOfArrayOfNumberOnly +{ + /** @var float[][] $arrayArrayNumber */ private $arrayArrayNumber; - } diff --git a/samples/server/petstore/php-slim/lib/Model/ArrayOfNumberOnly.php b/samples/server/petstore/php-slim/lib/Model/ArrayOfNumberOnly.php index a3b2e76c22c..33a08beb982 100644 --- a/samples/server/petstore/php-slim/lib/Model/ArrayOfNumberOnly.php +++ b/samples/server/petstore/php-slim/lib/Model/ArrayOfNumberOnly.php @@ -7,9 +7,9 @@ namespace OpenAPIServer\Model; /** * ArrayOfNumberOnly */ -class ArrayOfNumberOnly { - +class ArrayOfNumberOnly +{ + /** @var float[] $arrayNumber */ private $arrayNumber; - } diff --git a/samples/server/petstore/php-slim/lib/Model/ArrayTest.php b/samples/server/petstore/php-slim/lib/Model/ArrayTest.php index 08e8a8ea03a..dfc5ac6c52c 100644 --- a/samples/server/petstore/php-slim/lib/Model/ArrayTest.php +++ b/samples/server/petstore/php-slim/lib/Model/ArrayTest.php @@ -7,15 +7,15 @@ namespace OpenAPIServer\Model; /** * ArrayTest */ -class ArrayTest { - +class ArrayTest +{ + /** @var string[] $arrayOfString */ private $arrayOfString; - + /** @var int[][] $arrayArrayOfInteger */ private $arrayArrayOfInteger; - + /** @var \OpenAPIServer\Model\ReadOnlyFirst[][] $arrayArrayOfModel */ private $arrayArrayOfModel; - } diff --git a/samples/server/petstore/php-slim/lib/Model/Capitalization.php b/samples/server/petstore/php-slim/lib/Model/Capitalization.php index 8ea348becef..b31affec6a4 100644 --- a/samples/server/petstore/php-slim/lib/Model/Capitalization.php +++ b/samples/server/petstore/php-slim/lib/Model/Capitalization.php @@ -7,24 +7,24 @@ namespace OpenAPIServer\Model; /** * Capitalization */ -class Capitalization { - +class Capitalization +{ + /** @var string $smallCamel */ private $smallCamel; - + /** @var string $capitalCamel */ private $capitalCamel; - + /** @var string $smallSnake */ private $smallSnake; - + /** @var string $capitalSnake */ private $capitalSnake; - + /** @var string $sCAETHFlowPoints */ private $sCAETHFlowPoints; - + /** @var string $aTTNAME Name of the pet*/ private $aTTNAME; - } diff --git a/samples/server/petstore/php-slim/lib/Model/Cat.php b/samples/server/petstore/php-slim/lib/Model/Cat.php index 072c86d1cb8..9a800c02979 100644 --- a/samples/server/petstore/php-slim/lib/Model/Cat.php +++ b/samples/server/petstore/php-slim/lib/Model/Cat.php @@ -7,15 +7,15 @@ namespace OpenAPIServer\Model; /** * Cat */ -class Cat { - +class Cat +{ + /** @var string $className */ private $className; - + /** @var string $color */ private $color; - + /** @var bool $declawed */ private $declawed; - } diff --git a/samples/server/petstore/php-slim/lib/Model/Category.php b/samples/server/petstore/php-slim/lib/Model/Category.php index 92d49af1ba6..9bed27a1f2e 100644 --- a/samples/server/petstore/php-slim/lib/Model/Category.php +++ b/samples/server/petstore/php-slim/lib/Model/Category.php @@ -7,12 +7,12 @@ namespace OpenAPIServer\Model; /** * Category */ -class Category { - +class Category +{ + /** @var int $id */ private $id; - + /** @var string $name */ private $name; - } diff --git a/samples/server/petstore/php-slim/lib/Model/ClassModel.php b/samples/server/petstore/php-slim/lib/Model/ClassModel.php index 831e8afad41..43b08c7016e 100644 --- a/samples/server/petstore/php-slim/lib/Model/ClassModel.php +++ b/samples/server/petstore/php-slim/lib/Model/ClassModel.php @@ -7,9 +7,9 @@ namespace OpenAPIServer\Model; /** * ClassModel */ -class ClassModel { - +class ClassModel +{ + /** @var string $class */ private $class; - } diff --git a/samples/server/petstore/php-slim/lib/Model/Client.php b/samples/server/petstore/php-slim/lib/Model/Client.php index 573a7f71b09..95ded593b93 100644 --- a/samples/server/petstore/php-slim/lib/Model/Client.php +++ b/samples/server/petstore/php-slim/lib/Model/Client.php @@ -7,9 +7,9 @@ namespace OpenAPIServer\Model; /** * Client */ -class Client { - +class Client +{ + /** @var string $client */ private $client; - } diff --git a/samples/server/petstore/php-slim/lib/Model/Dog.php b/samples/server/petstore/php-slim/lib/Model/Dog.php index cbb138e2704..2af41c927e4 100644 --- a/samples/server/petstore/php-slim/lib/Model/Dog.php +++ b/samples/server/petstore/php-slim/lib/Model/Dog.php @@ -7,15 +7,15 @@ namespace OpenAPIServer\Model; /** * Dog */ -class Dog { - +class Dog +{ + /** @var string $className */ private $className; - + /** @var string $color */ private $color; - + /** @var string $breed */ private $breed; - } diff --git a/samples/server/petstore/php-slim/lib/Model/EnumArrays.php b/samples/server/petstore/php-slim/lib/Model/EnumArrays.php index 420c603ff94..0683034c18b 100644 --- a/samples/server/petstore/php-slim/lib/Model/EnumArrays.php +++ b/samples/server/petstore/php-slim/lib/Model/EnumArrays.php @@ -7,12 +7,12 @@ namespace OpenAPIServer\Model; /** * EnumArrays */ -class EnumArrays { - +class EnumArrays +{ + /** @var string $justSymbol */ private $justSymbol; - + /** @var string[] $arrayEnum */ private $arrayEnum; - } diff --git a/samples/server/petstore/php-slim/lib/Model/EnumClass.php b/samples/server/petstore/php-slim/lib/Model/EnumClass.php index b6ec1ac9421..61cf77c95ac 100644 --- a/samples/server/petstore/php-slim/lib/Model/EnumClass.php +++ b/samples/server/petstore/php-slim/lib/Model/EnumClass.php @@ -7,6 +7,6 @@ namespace OpenAPIServer\Model; /** * EnumClass */ -class EnumClass { - +class EnumClass +{ } diff --git a/samples/server/petstore/php-slim/lib/Model/EnumTest.php b/samples/server/petstore/php-slim/lib/Model/EnumTest.php index eef0cfb6aa9..b4754610cfd 100644 --- a/samples/server/petstore/php-slim/lib/Model/EnumTest.php +++ b/samples/server/petstore/php-slim/lib/Model/EnumTest.php @@ -7,21 +7,21 @@ namespace OpenAPIServer\Model; /** * EnumTest */ -class EnumTest { - +class EnumTest +{ + /** @var string $enumString */ private $enumString; - + /** @var string $enumStringRequired */ private $enumStringRequired; - + /** @var int $enumInteger */ private $enumInteger; - + /** @var double $enumNumber */ private $enumNumber; - + /** @var \OpenAPIServer\Model\OuterEnum $outerEnum */ private $outerEnum; - } diff --git a/samples/server/petstore/php-slim/lib/Model/File.php b/samples/server/petstore/php-slim/lib/Model/File.php index 8ad71447f84..18f242d8c21 100644 --- a/samples/server/petstore/php-slim/lib/Model/File.php +++ b/samples/server/petstore/php-slim/lib/Model/File.php @@ -7,9 +7,9 @@ namespace OpenAPIServer\Model; /** * File */ -class File { - +class File +{ + /** @var string $sourceURI Test capitalization*/ private $sourceURI; - } diff --git a/samples/server/petstore/php-slim/lib/Model/FileSchemaTestClass.php b/samples/server/petstore/php-slim/lib/Model/FileSchemaTestClass.php index fccee8b9535..972d7a3efce 100644 --- a/samples/server/petstore/php-slim/lib/Model/FileSchemaTestClass.php +++ b/samples/server/petstore/php-slim/lib/Model/FileSchemaTestClass.php @@ -7,12 +7,12 @@ namespace OpenAPIServer\Model; /** * FileSchemaTestClass */ -class FileSchemaTestClass { - +class FileSchemaTestClass +{ + /** @var \OpenAPIServer\Model\File $file */ private $file; - + /** @var \OpenAPIServer\Model\File[] $files */ private $files; - } diff --git a/samples/server/petstore/php-slim/lib/Model/FormatTest.php b/samples/server/petstore/php-slim/lib/Model/FormatTest.php index c04cc766ab0..878781c9d47 100644 --- a/samples/server/petstore/php-slim/lib/Model/FormatTest.php +++ b/samples/server/petstore/php-slim/lib/Model/FormatTest.php @@ -7,45 +7,45 @@ namespace OpenAPIServer\Model; /** * FormatTest */ -class FormatTest { - +class FormatTest +{ + /** @var int $integer */ private $integer; - + /** @var int $int32 */ private $int32; - + /** @var int $int64 */ private $int64; - + /** @var float $number */ private $number; - + /** @var float $float */ private $float; - + /** @var double $double */ private $double; - + /** @var string $string */ private $string; - + /** @var string $byte */ private $byte; - + /** @var \SplFileObject $binary */ private $binary; - + /** @var \DateTime $date */ private $date; - + /** @var \DateTime $dateTime */ private $dateTime; - + /** @var string $uuid */ private $uuid; - + /** @var string $password */ private $password; - } diff --git a/samples/server/petstore/php-slim/lib/Model/HasOnlyReadOnly.php b/samples/server/petstore/php-slim/lib/Model/HasOnlyReadOnly.php index de4638ac296..8403b534080 100644 --- a/samples/server/petstore/php-slim/lib/Model/HasOnlyReadOnly.php +++ b/samples/server/petstore/php-slim/lib/Model/HasOnlyReadOnly.php @@ -7,12 +7,12 @@ namespace OpenAPIServer\Model; /** * HasOnlyReadOnly */ -class HasOnlyReadOnly { - +class HasOnlyReadOnly +{ + /** @var string $bar */ private $bar; - + /** @var string $foo */ private $foo; - } diff --git a/samples/server/petstore/php-slim/lib/Model/MapTest.php b/samples/server/petstore/php-slim/lib/Model/MapTest.php index 58415e379ef..d839677195d 100644 --- a/samples/server/petstore/php-slim/lib/Model/MapTest.php +++ b/samples/server/petstore/php-slim/lib/Model/MapTest.php @@ -7,18 +7,18 @@ namespace OpenAPIServer\Model; /** * MapTest */ -class MapTest { - +class MapTest +{ + /** @var map[string,map[string,string]] $mapMapOfString */ private $mapMapOfString; - + /** @var map[string,string] $mapOfEnumString */ private $mapOfEnumString; - + /** @var map[string,bool] $directMap */ private $directMap; - - /** @var \OpenAPIServer\Model\StringBooleanMap $indirectMap */ + + /** @var map[string,bool] $indirectMap */ private $indirectMap; - } diff --git a/samples/server/petstore/php-slim/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php b/samples/server/petstore/php-slim/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php index 077a355cc1e..43fb0171408 100644 --- a/samples/server/petstore/php-slim/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php +++ b/samples/server/petstore/php-slim/lib/Model/MixedPropertiesAndAdditionalPropertiesClass.php @@ -7,15 +7,15 @@ namespace OpenAPIServer\Model; /** * MixedPropertiesAndAdditionalPropertiesClass */ -class MixedPropertiesAndAdditionalPropertiesClass { - +class MixedPropertiesAndAdditionalPropertiesClass +{ + /** @var string $uuid */ private $uuid; - + /** @var \DateTime $dateTime */ private $dateTime; - + /** @var map[string,\OpenAPIServer\Model\Animal] $map */ private $map; - } diff --git a/samples/server/petstore/php-slim/lib/Model/Model200Response.php b/samples/server/petstore/php-slim/lib/Model/Model200Response.php index 404ceaad1b7..8782c6a0f71 100644 --- a/samples/server/petstore/php-slim/lib/Model/Model200Response.php +++ b/samples/server/petstore/php-slim/lib/Model/Model200Response.php @@ -7,12 +7,12 @@ namespace OpenAPIServer\Model; /** * Model200Response */ -class Model200Response { - +class Model200Response +{ + /** @var int $name */ private $name; - + /** @var string $class */ private $class; - } diff --git a/samples/server/petstore/php-slim/lib/Model/ModelList.php b/samples/server/petstore/php-slim/lib/Model/ModelList.php index 8e668357a19..943c0d69a19 100644 --- a/samples/server/petstore/php-slim/lib/Model/ModelList.php +++ b/samples/server/petstore/php-slim/lib/Model/ModelList.php @@ -7,9 +7,9 @@ namespace OpenAPIServer\Model; /** * ModelList */ -class ModelList { - +class ModelList +{ + /** @var string $_123list */ private $_123list; - } diff --git a/samples/server/petstore/php-slim/lib/Model/ModelReturn.php b/samples/server/petstore/php-slim/lib/Model/ModelReturn.php index 5373aa2e7b1..fdc6cbcf7a5 100644 --- a/samples/server/petstore/php-slim/lib/Model/ModelReturn.php +++ b/samples/server/petstore/php-slim/lib/Model/ModelReturn.php @@ -7,9 +7,9 @@ namespace OpenAPIServer\Model; /** * ModelReturn */ -class ModelReturn { - +class ModelReturn +{ + /** @var int $return */ private $return; - } diff --git a/samples/server/petstore/php-slim/lib/Model/Name.php b/samples/server/petstore/php-slim/lib/Model/Name.php index 162aa21ebe6..bcf2a71da77 100644 --- a/samples/server/petstore/php-slim/lib/Model/Name.php +++ b/samples/server/petstore/php-slim/lib/Model/Name.php @@ -7,18 +7,18 @@ namespace OpenAPIServer\Model; /** * Name */ -class Name { - +class Name +{ + /** @var int $name */ private $name; - + /** @var int $snakeCase */ private $snakeCase; - + /** @var string $property */ private $property; - + /** @var int $_123number */ private $_123number; - } diff --git a/samples/server/petstore/php-slim/lib/Model/NumberOnly.php b/samples/server/petstore/php-slim/lib/Model/NumberOnly.php index c725eb39fdb..64d9350fc8b 100644 --- a/samples/server/petstore/php-slim/lib/Model/NumberOnly.php +++ b/samples/server/petstore/php-slim/lib/Model/NumberOnly.php @@ -7,9 +7,9 @@ namespace OpenAPIServer\Model; /** * NumberOnly */ -class NumberOnly { - +class NumberOnly +{ + /** @var float $justNumber */ private $justNumber; - } diff --git a/samples/server/petstore/php-slim/lib/Model/Order.php b/samples/server/petstore/php-slim/lib/Model/Order.php index 7295a384c8d..16da9270609 100644 --- a/samples/server/petstore/php-slim/lib/Model/Order.php +++ b/samples/server/petstore/php-slim/lib/Model/Order.php @@ -7,24 +7,24 @@ namespace OpenAPIServer\Model; /** * Order */ -class Order { - +class Order +{ + /** @var int $id */ private $id; - + /** @var int $petId */ private $petId; - + /** @var int $quantity */ private $quantity; - + /** @var \DateTime $shipDate */ private $shipDate; - + /** @var string $status Order Status*/ private $status; - + /** @var bool $complete */ private $complete; - } diff --git a/samples/server/petstore/php-slim/lib/Model/OuterComposite.php b/samples/server/petstore/php-slim/lib/Model/OuterComposite.php index 522683f125a..5521b8aec10 100644 --- a/samples/server/petstore/php-slim/lib/Model/OuterComposite.php +++ b/samples/server/petstore/php-slim/lib/Model/OuterComposite.php @@ -7,15 +7,15 @@ namespace OpenAPIServer\Model; /** * OuterComposite */ -class OuterComposite { - +class OuterComposite +{ + /** @var float $myNumber */ private $myNumber; - + /** @var string $myString */ private $myString; - + /** @var bool $myBoolean */ private $myBoolean; - } diff --git a/samples/server/petstore/php-slim/lib/Model/OuterEnum.php b/samples/server/petstore/php-slim/lib/Model/OuterEnum.php index bd529aca5ee..793e29314aa 100644 --- a/samples/server/petstore/php-slim/lib/Model/OuterEnum.php +++ b/samples/server/petstore/php-slim/lib/Model/OuterEnum.php @@ -7,6 +7,6 @@ namespace OpenAPIServer\Model; /** * OuterEnum */ -class OuterEnum { - +class OuterEnum +{ } diff --git a/samples/server/petstore/php-slim/lib/Model/Pet.php b/samples/server/petstore/php-slim/lib/Model/Pet.php index 6699506e33a..a082a16bb03 100644 --- a/samples/server/petstore/php-slim/lib/Model/Pet.php +++ b/samples/server/petstore/php-slim/lib/Model/Pet.php @@ -7,24 +7,24 @@ namespace OpenAPIServer\Model; /** * Pet */ -class Pet { - +class Pet +{ + /** @var int $id */ private $id; - + /** @var \OpenAPIServer\Model\Category $category */ private $category; - + /** @var string $name */ private $name; - + /** @var string[] $photoUrls */ private $photoUrls; - + /** @var \OpenAPIServer\Model\Tag[] $tags */ private $tags; - + /** @var string $status pet status in the store*/ private $status; - } diff --git a/samples/server/petstore/php-slim/lib/Model/ReadOnlyFirst.php b/samples/server/petstore/php-slim/lib/Model/ReadOnlyFirst.php index 17ae0f6c987..c20d8105c21 100644 --- a/samples/server/petstore/php-slim/lib/Model/ReadOnlyFirst.php +++ b/samples/server/petstore/php-slim/lib/Model/ReadOnlyFirst.php @@ -7,12 +7,12 @@ namespace OpenAPIServer\Model; /** * ReadOnlyFirst */ -class ReadOnlyFirst { - +class ReadOnlyFirst +{ + /** @var string $bar */ private $bar; - + /** @var string $baz */ private $baz; - } diff --git a/samples/server/petstore/php-slim/lib/Model/SpecialModelName.php b/samples/server/petstore/php-slim/lib/Model/SpecialModelName.php index dd1d71ff4b1..1ad7651e54d 100644 --- a/samples/server/petstore/php-slim/lib/Model/SpecialModelName.php +++ b/samples/server/petstore/php-slim/lib/Model/SpecialModelName.php @@ -7,9 +7,9 @@ namespace OpenAPIServer\Model; /** * SpecialModelName */ -class SpecialModelName { - +class SpecialModelName +{ + /** @var int $specialPropertyName */ private $specialPropertyName; - } diff --git a/samples/server/petstore/php-slim/lib/Model/StringBooleanMap.php b/samples/server/petstore/php-slim/lib/Model/StringBooleanMap.php index 1164e1d7070..5d501968961 100644 --- a/samples/server/petstore/php-slim/lib/Model/StringBooleanMap.php +++ b/samples/server/petstore/php-slim/lib/Model/StringBooleanMap.php @@ -7,6 +7,6 @@ namespace OpenAPIServer\Model; /** * StringBooleanMap */ -class StringBooleanMap { - +class StringBooleanMap +{ } diff --git a/samples/server/petstore/php-slim/lib/Model/Tag.php b/samples/server/petstore/php-slim/lib/Model/Tag.php index d4ff6fad5d5..861b2f85034 100644 --- a/samples/server/petstore/php-slim/lib/Model/Tag.php +++ b/samples/server/petstore/php-slim/lib/Model/Tag.php @@ -7,12 +7,12 @@ namespace OpenAPIServer\Model; /** * Tag */ -class Tag { - +class Tag +{ + /** @var int $id */ private $id; - + /** @var string $name */ private $name; - } diff --git a/samples/server/petstore/php-slim/lib/Model/User.php b/samples/server/petstore/php-slim/lib/Model/User.php index c68813e5a54..1696c85a0bd 100644 --- a/samples/server/petstore/php-slim/lib/Model/User.php +++ b/samples/server/petstore/php-slim/lib/Model/User.php @@ -7,30 +7,30 @@ namespace OpenAPIServer\Model; /** * User */ -class User { - +class User +{ + /** @var int $id */ private $id; - + /** @var string $username */ private $username; - + /** @var string $firstName */ private $firstName; - + /** @var string $lastName */ private $lastName; - + /** @var string $email */ private $email; - + /** @var string $password */ private $password; - + /** @var string $phone */ private $phone; - + /** @var int $userStatus User Status*/ private $userStatus; - } diff --git a/samples/server/petstore/php-slim/lib/SlimRouter.php b/samples/server/petstore/php-slim/lib/SlimRouter.php index 296e2964d86..ba105c70599 100644 --- a/samples/server/petstore/php-slim/lib/SlimRouter.php +++ b/samples/server/petstore/php-slim/lib/SlimRouter.php @@ -10,7 +10,7 @@ * @link https://github.com/openapitools/openapi-generator */ -/** +/** * 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: \" \\ @@ -46,7 +46,8 @@ use Tuupola\Middleware\HttpBasicAuthentication; * @author OpenAPI Generator team * @link https://github.com/openapitools/openapi-generator */ -class SlimRouter { +class SlimRouter +{ /** * @var $slimApp Slim\App instance @@ -59,7 +60,8 @@ class SlimRouter { * @param ContainerInterface|array $container Either a ContainerInterface or an associative array of app settings * @throws InvalidArgumentException when no container is provided that implements ContainerInterface */ - public function __construct($container = []) { + public function __construct($container = []) + { $app = new App($container); $basicAuth = new HttpBasicAuthentication([ @@ -72,108 +74,142 @@ class SlimRouter { ]); $app->PATCH( - '/v2/another-fake/dummy', AnotherFakeApi::class . ':call123TestSpecialTags' + '/v2/another-fake/dummy', + AnotherFakeApi::class . ':call123TestSpecialTags' ); $app->POST( - '/v2/fake/outer/boolean', FakeApi::class . ':fakeOuterBooleanSerialize' + '/v2/fake/outer/boolean', + FakeApi::class . ':fakeOuterBooleanSerialize' ); $app->POST( - '/v2/fake/outer/composite', FakeApi::class . ':fakeOuterCompositeSerialize' + '/v2/fake/outer/composite', + FakeApi::class . ':fakeOuterCompositeSerialize' ); $app->POST( - '/v2/fake/outer/number', FakeApi::class . ':fakeOuterNumberSerialize' + '/v2/fake/outer/number', + FakeApi::class . ':fakeOuterNumberSerialize' ); $app->POST( - '/v2/fake/outer/string', FakeApi::class . ':fakeOuterStringSerialize' + '/v2/fake/outer/string', + FakeApi::class . ':fakeOuterStringSerialize' ); $app->PUT( - '/v2/fake/body-with-file-schema', FakeApi::class . ':testBodyWithFileSchema' + '/v2/fake/body-with-file-schema', + FakeApi::class . ':testBodyWithFileSchema' ); $app->PUT( - '/v2/fake/body-with-query-params', FakeApi::class . ':testBodyWithQueryParams' + '/v2/fake/body-with-query-params', + FakeApi::class . ':testBodyWithQueryParams' ); $app->PATCH( - '/v2/fake', FakeApi::class . ':testClientModel' + '/v2/fake', + FakeApi::class . ':testClientModel' ); $app->POST( - '/v2/fake', FakeApi::class . ':testEndpointParameters' + '/v2/fake', + FakeApi::class . ':testEndpointParameters' )->add( $basicAuth ); $app->GET( - '/v2/fake', FakeApi::class . ':testEnumParameters' + '/v2/fake', + FakeApi::class . ':testEnumParameters' ); $app->POST( - '/v2/fake/inline-additionalProperties', FakeApi::class . ':testInlineAdditionalProperties' + '/v2/fake/inline-additionalProperties', + FakeApi::class . ':testInlineAdditionalProperties' ); $app->GET( - '/v2/fake/jsonFormData', FakeApi::class . ':testJsonFormData' + '/v2/fake/jsonFormData', + FakeApi::class . ':testJsonFormData' ); $app->PATCH( - '/v2/fake_classname_test', FakeClassnameTags123Api::class . ':testClassname' + '/v2/fake_classname_test', + FakeClassnameTags123Api::class . ':testClassname' ); $app->POST( - '/v2/pet', PetApi::class . ':addPet' + '/v2/pet', + PetApi::class . ':addPet' ); $app->GET( - '/v2/pet/findByStatus', PetApi::class . ':findPetsByStatus' + '/v2/pet/findByStatus', + PetApi::class . ':findPetsByStatus' ); $app->GET( - '/v2/pet/findByTags', PetApi::class . ':findPetsByTags' + '/v2/pet/findByTags', + PetApi::class . ':findPetsByTags' ); $app->PUT( - '/v2/pet', PetApi::class . ':updatePet' + '/v2/pet', + PetApi::class . ':updatePet' ); $app->DELETE( - '/v2/pet/{petId}', PetApi::class . ':deletePet' + '/v2/pet/{petId}', + PetApi::class . ':deletePet' ); $app->GET( - '/v2/pet/{petId}', PetApi::class . ':getPetById' + '/v2/pet/{petId}', + PetApi::class . ':getPetById' ); $app->POST( - '/v2/pet/{petId}', PetApi::class . ':updatePetWithForm' + '/v2/pet/{petId}', + PetApi::class . ':updatePetWithForm' ); $app->POST( - '/v2/pet/{petId}/uploadImage', PetApi::class . ':uploadFile' + '/v2/pet/{petId}/uploadImage', + PetApi::class . ':uploadFile' ); $app->POST( - '/v2/fake/{petId}/uploadImageWithRequiredFile', PetApi::class . ':uploadFileWithRequiredFile' + '/v2/fake/{petId}/uploadImageWithRequiredFile', + PetApi::class . ':uploadFileWithRequiredFile' ); $app->GET( - '/v2/store/inventory', StoreApi::class . ':getInventory' + '/v2/store/inventory', + StoreApi::class . ':getInventory' ); $app->POST( - '/v2/store/order', StoreApi::class . ':placeOrder' + '/v2/store/order', + StoreApi::class . ':placeOrder' ); $app->DELETE( - '/v2/store/order/{order_id}', StoreApi::class . ':deleteOrder' + '/v2/store/order/{order_id}', + StoreApi::class . ':deleteOrder' ); $app->GET( - '/v2/store/order/{order_id}', StoreApi::class . ':getOrderById' + '/v2/store/order/{order_id}', + StoreApi::class . ':getOrderById' ); $app->POST( - '/v2/user', UserApi::class . ':createUser' + '/v2/user', + UserApi::class . ':createUser' ); $app->POST( - '/v2/user/createWithArray', UserApi::class . ':createUsersWithArrayInput' + '/v2/user/createWithArray', + UserApi::class . ':createUsersWithArrayInput' ); $app->POST( - '/v2/user/createWithList', UserApi::class . ':createUsersWithListInput' + '/v2/user/createWithList', + UserApi::class . ':createUsersWithListInput' ); $app->GET( - '/v2/user/login', UserApi::class . ':loginUser' + '/v2/user/login', + UserApi::class . ':loginUser' ); $app->GET( - '/v2/user/logout', UserApi::class . ':logoutUser' + '/v2/user/logout', + UserApi::class . ':logoutUser' ); $app->DELETE( - '/v2/user/{username}', UserApi::class . ':deleteUser' + '/v2/user/{username}', + UserApi::class . ':deleteUser' ); $app->GET( - '/v2/user/{username}', UserApi::class . ':getUserByName' + '/v2/user/{username}', + UserApi::class . ':getUserByName' ); $app->PUT( - '/v2/user/{username}', UserApi::class . ':updateUser' + '/v2/user/{username}', + UserApi::class . ':updateUser' ); $this->slimApp = $app; @@ -183,7 +219,8 @@ class SlimRouter { * Returns Slim Framework instance * @return App */ - public function getSlimApp() { + public function getSlimApp() + { return $this->slimApp; } } diff --git a/samples/server/petstore/php-slim/test/Api/AnotherFakeApiTest.php b/samples/server/petstore/php-slim/test/Api/AnotherFakeApiTest.php index 06cd6fe39c2..fc78f599d52 100644 --- a/samples/server/petstore/php-slim/test/Api/AnotherFakeApiTest.php +++ b/samples/server/petstore/php-slim/test/Api/AnotherFakeApiTest.php @@ -36,43 +36,44 @@ use OpenAPIServer\Api\AnotherFakeApi; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\AnotherFakeApi */ -class AnotherFakeApiTest extends \PHPUnit_Framework_TestCase { +class AnotherFakeApiTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** - * Test case for testSpecialTags + * Test case for call123TestSpecialTags * * To test special tags. - * @covers ::testSpecialTags + * @covers ::call123TestSpecialTags */ - public function testTestSpecialTags() { - + public function testCall123TestSpecialTags() + { } } diff --git a/samples/server/petstore/php-slim/test/Api/FakeApiTest.php b/samples/server/petstore/php-slim/test/Api/FakeApiTest.php index f020953e05b..c5f07d79f4c 100644 --- a/samples/server/petstore/php-slim/test/Api/FakeApiTest.php +++ b/samples/server/petstore/php-slim/test/Api/FakeApiTest.php @@ -36,34 +36,35 @@ use OpenAPIServer\Api\FakeApi; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\FakeApi */ -class FakeApiTest extends \PHPUnit_Framework_TestCase { +class FakeApiTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** @@ -72,8 +73,8 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { * . * @covers ::fakeOuterBooleanSerialize */ - public function testFakeOuterBooleanSerialize() { - + public function testFakeOuterBooleanSerialize() + { } /** @@ -82,8 +83,8 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { * . * @covers ::fakeOuterCompositeSerialize */ - public function testFakeOuterCompositeSerialize() { - + public function testFakeOuterCompositeSerialize() + { } /** @@ -92,8 +93,8 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { * . * @covers ::fakeOuterNumberSerialize */ - public function testFakeOuterNumberSerialize() { - + public function testFakeOuterNumberSerialize() + { } /** @@ -102,8 +103,8 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { * . * @covers ::fakeOuterStringSerialize */ - public function testFakeOuterStringSerialize() { - + public function testFakeOuterStringSerialize() + { } /** @@ -112,8 +113,8 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { * . * @covers ::testBodyWithFileSchema */ - public function testTestBodyWithFileSchema() { - + public function testTestBodyWithFileSchema() + { } /** @@ -122,8 +123,8 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { * . * @covers ::testBodyWithQueryParams */ - public function testTestBodyWithQueryParams() { - + public function testTestBodyWithQueryParams() + { } /** @@ -132,8 +133,8 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { * To test \"client\" model. * @covers ::testClientModel */ - public function testTestClientModel() { - + public function testTestClientModel() + { } /** @@ -142,8 +143,8 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트. * @covers ::testEndpointParameters */ - public function testTestEndpointParameters() { - + public function testTestEndpointParameters() + { } /** @@ -152,8 +153,8 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { * To test enum parameters. * @covers ::testEnumParameters */ - public function testTestEnumParameters() { - + public function testTestEnumParameters() + { } /** @@ -162,8 +163,8 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { * test inline additionalProperties. * @covers ::testInlineAdditionalProperties */ - public function testTestInlineAdditionalProperties() { - + public function testTestInlineAdditionalProperties() + { } /** @@ -172,7 +173,7 @@ class FakeApiTest extends \PHPUnit_Framework_TestCase { * test json serialization of form data. * @covers ::testJsonFormData */ - public function testTestJsonFormData() { - + public function testTestJsonFormData() + { } } diff --git a/samples/server/petstore/php-slim/test/Api/FakeClassnameTags123ApiTest.php b/samples/server/petstore/php-slim/test/Api/FakeClassnameTags123ApiTest.php index de4105136e1..e06689f4289 100644 --- a/samples/server/petstore/php-slim/test/Api/FakeClassnameTags123ApiTest.php +++ b/samples/server/petstore/php-slim/test/Api/FakeClassnameTags123ApiTest.php @@ -36,34 +36,35 @@ use OpenAPIServer\Api\FakeClassnameTags123Api; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\FakeClassnameTags123Api */ -class FakeClassnameTags123ApiTest extends \PHPUnit_Framework_TestCase { +class FakeClassnameTags123ApiTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** @@ -72,7 +73,7 @@ class FakeClassnameTags123ApiTest extends \PHPUnit_Framework_TestCase { * To test class name in snake case. * @covers ::testClassname */ - public function testTestClassname() { - + public function testTestClassname() + { } } diff --git a/samples/server/petstore/php-slim/test/Api/PetApiTest.php b/samples/server/petstore/php-slim/test/Api/PetApiTest.php index 3e5f9eec211..9959ad609dd 100644 --- a/samples/server/petstore/php-slim/test/Api/PetApiTest.php +++ b/samples/server/petstore/php-slim/test/Api/PetApiTest.php @@ -36,34 +36,35 @@ use OpenAPIServer\Api\PetApi; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\PetApi */ -class PetApiTest extends \PHPUnit_Framework_TestCase { +class PetApiTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** @@ -72,8 +73,8 @@ class PetApiTest extends \PHPUnit_Framework_TestCase { * Add a new pet to the store. * @covers ::addPet */ - public function testAddPet() { - + public function testAddPet() + { } /** @@ -82,8 +83,8 @@ class PetApiTest extends \PHPUnit_Framework_TestCase { * Deletes a pet. * @covers ::deletePet */ - public function testDeletePet() { - + public function testDeletePet() + { } /** @@ -92,8 +93,8 @@ class PetApiTest extends \PHPUnit_Framework_TestCase { * Finds Pets by status. * @covers ::findPetsByStatus */ - public function testFindPetsByStatus() { - + public function testFindPetsByStatus() + { } /** @@ -102,8 +103,8 @@ class PetApiTest extends \PHPUnit_Framework_TestCase { * Finds Pets by tags. * @covers ::findPetsByTags */ - public function testFindPetsByTags() { - + public function testFindPetsByTags() + { } /** @@ -112,8 +113,8 @@ class PetApiTest extends \PHPUnit_Framework_TestCase { * Find pet by ID. * @covers ::getPetById */ - public function testGetPetById() { - + public function testGetPetById() + { } /** @@ -122,8 +123,8 @@ class PetApiTest extends \PHPUnit_Framework_TestCase { * Update an existing pet. * @covers ::updatePet */ - public function testUpdatePet() { - + public function testUpdatePet() + { } /** @@ -132,8 +133,8 @@ class PetApiTest extends \PHPUnit_Framework_TestCase { * Updates a pet in the store with form data. * @covers ::updatePetWithForm */ - public function testUpdatePetWithForm() { - + public function testUpdatePetWithForm() + { } /** @@ -142,8 +143,8 @@ class PetApiTest extends \PHPUnit_Framework_TestCase { * uploads an image. * @covers ::uploadFile */ - public function testUploadFile() { - + public function testUploadFile() + { } /** @@ -152,7 +153,7 @@ class PetApiTest extends \PHPUnit_Framework_TestCase { * uploads an image (required). * @covers ::uploadFileWithRequiredFile */ - public function testUploadFileWithRequiredFile() { - + public function testUploadFileWithRequiredFile() + { } } diff --git a/samples/server/petstore/php-slim/test/Api/StoreApiTest.php b/samples/server/petstore/php-slim/test/Api/StoreApiTest.php index 220bb260c70..f7c02fa1ba0 100644 --- a/samples/server/petstore/php-slim/test/Api/StoreApiTest.php +++ b/samples/server/petstore/php-slim/test/Api/StoreApiTest.php @@ -36,34 +36,35 @@ use OpenAPIServer\Api\StoreApi; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\StoreApi */ -class StoreApiTest extends \PHPUnit_Framework_TestCase { +class StoreApiTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** @@ -72,8 +73,8 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase { * Delete purchase order by ID. * @covers ::deleteOrder */ - public function testDeleteOrder() { - + public function testDeleteOrder() + { } /** @@ -82,8 +83,8 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase { * Returns pet inventories by status. * @covers ::getInventory */ - public function testGetInventory() { - + public function testGetInventory() + { } /** @@ -92,8 +93,8 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase { * Find purchase order by ID. * @covers ::getOrderById */ - public function testGetOrderById() { - + public function testGetOrderById() + { } /** @@ -102,7 +103,7 @@ class StoreApiTest extends \PHPUnit_Framework_TestCase { * Place an order for a pet. * @covers ::placeOrder */ - public function testPlaceOrder() { - + public function testPlaceOrder() + { } } diff --git a/samples/server/petstore/php-slim/test/Api/UserApiTest.php b/samples/server/petstore/php-slim/test/Api/UserApiTest.php index d4eb4382f22..519c10cd083 100644 --- a/samples/server/petstore/php-slim/test/Api/UserApiTest.php +++ b/samples/server/petstore/php-slim/test/Api/UserApiTest.php @@ -36,34 +36,35 @@ use OpenAPIServer\Api\UserApi; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\UserApi */ -class UserApiTest extends \PHPUnit_Framework_TestCase { +class UserApiTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** @@ -72,8 +73,8 @@ class UserApiTest extends \PHPUnit_Framework_TestCase { * Create user. * @covers ::createUser */ - public function testCreateUser() { - + public function testCreateUser() + { } /** @@ -82,8 +83,8 @@ class UserApiTest extends \PHPUnit_Framework_TestCase { * Creates list of users with given input array. * @covers ::createUsersWithArrayInput */ - public function testCreateUsersWithArrayInput() { - + public function testCreateUsersWithArrayInput() + { } /** @@ -92,8 +93,8 @@ class UserApiTest extends \PHPUnit_Framework_TestCase { * Creates list of users with given input array. * @covers ::createUsersWithListInput */ - public function testCreateUsersWithListInput() { - + public function testCreateUsersWithListInput() + { } /** @@ -102,8 +103,8 @@ class UserApiTest extends \PHPUnit_Framework_TestCase { * Delete user. * @covers ::deleteUser */ - public function testDeleteUser() { - + public function testDeleteUser() + { } /** @@ -112,8 +113,8 @@ class UserApiTest extends \PHPUnit_Framework_TestCase { * Get user by user name. * @covers ::getUserByName */ - public function testGetUserByName() { - + public function testGetUserByName() + { } /** @@ -122,8 +123,8 @@ class UserApiTest extends \PHPUnit_Framework_TestCase { * Logs user into the system. * @covers ::loginUser */ - public function testLoginUser() { - + public function testLoginUser() + { } /** @@ -132,8 +133,8 @@ class UserApiTest extends \PHPUnit_Framework_TestCase { * Logs out current logged in user session. * @covers ::logoutUser */ - public function testLogoutUser() { - + public function testLogoutUser() + { } /** @@ -142,7 +143,7 @@ class UserApiTest extends \PHPUnit_Framework_TestCase { * Updated user. * @covers ::updateUser */ - public function testUpdateUser() { - + public function testUpdateUser() + { } } diff --git a/samples/server/petstore/php-slim/test/Model/AdditionalPropertiesClassTest.php b/samples/server/petstore/php-slim/test/Model/AdditionalPropertiesClassTest.php index 0dc870c25f1..14d94718ead 100644 --- a/samples/server/petstore/php-slim/test/Model/AdditionalPropertiesClassTest.php +++ b/samples/server/petstore/php-slim/test/Model/AdditionalPropertiesClassTest.php @@ -36,55 +36,56 @@ use OpenAPIServer\Model\AdditionalPropertiesClass; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\AdditionalPropertiesClass */ -class AdditionalPropertiesClassTest extends \PHPUnit_Framework_TestCase { +class AdditionalPropertiesClassTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "AdditionalPropertiesClass" */ - public function testAdditionalPropertiesClass() { + public function testAdditionalPropertiesClass() + { $testAdditionalPropertiesClass = new AdditionalPropertiesClass(); } /** * Test attribute "mapProperty" */ - public function testPropertyMapProperty() { - + public function testPropertyMapProperty() + { } /** * Test attribute "mapOfMapProperty" */ - public function testPropertyMapOfMapProperty() { - + public function testPropertyMapOfMapProperty() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/AnimalFarmTest.php b/samples/server/petstore/php-slim/test/Model/AnimalFarmTest.php index b10de6ebe5c..93e748a8c6e 100644 --- a/samples/server/petstore/php-slim/test/Model/AnimalFarmTest.php +++ b/samples/server/petstore/php-slim/test/Model/AnimalFarmTest.php @@ -36,41 +36,42 @@ use OpenAPIServer\Model\AnimalFarm; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\AnimalFarm */ -class AnimalFarmTest extends \PHPUnit_Framework_TestCase { +class AnimalFarmTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "AnimalFarm" */ - public function testAnimalFarm() { + public function testAnimalFarm() + { $testAnimalFarm = new AnimalFarm(); } } - diff --git a/samples/server/petstore/php-slim/test/Model/AnimalTest.php b/samples/server/petstore/php-slim/test/Model/AnimalTest.php index e2e9955cb78..bd6e2f4b976 100644 --- a/samples/server/petstore/php-slim/test/Model/AnimalTest.php +++ b/samples/server/petstore/php-slim/test/Model/AnimalTest.php @@ -36,55 +36,56 @@ use OpenAPIServer\Model\Animal; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\Animal */ -class AnimalTest extends \PHPUnit_Framework_TestCase { +class AnimalTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "Animal" */ - public function testAnimal() { + public function testAnimal() + { $testAnimal = new Animal(); } /** * Test attribute "className" */ - public function testPropertyClassName() { - + public function testPropertyClassName() + { } /** * Test attribute "color" */ - public function testPropertyColor() { - + public function testPropertyColor() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/ApiResponseTest.php b/samples/server/petstore/php-slim/test/Model/ApiResponseTest.php index de1e64136b8..ac3378cc3bd 100644 --- a/samples/server/petstore/php-slim/test/Model/ApiResponseTest.php +++ b/samples/server/petstore/php-slim/test/Model/ApiResponseTest.php @@ -36,62 +36,63 @@ use OpenAPIServer\Model\ApiResponse; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\ApiResponse */ -class ApiResponseTest extends \PHPUnit_Framework_TestCase { +class ApiResponseTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "ApiResponse" */ - public function testApiResponse() { + public function testApiResponse() + { $testApiResponse = new ApiResponse(); } /** * Test attribute "code" */ - public function testPropertyCode() { - + public function testPropertyCode() + { } /** * Test attribute "type" */ - public function testPropertyType() { - + public function testPropertyType() + { } /** * Test attribute "message" */ - public function testPropertyMessage() { - + public function testPropertyMessage() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/ArrayOfArrayOfNumberOnlyTest.php b/samples/server/petstore/php-slim/test/Model/ArrayOfArrayOfNumberOnlyTest.php index e0e2bded85e..bbc5077b1ca 100644 --- a/samples/server/petstore/php-slim/test/Model/ArrayOfArrayOfNumberOnlyTest.php +++ b/samples/server/petstore/php-slim/test/Model/ArrayOfArrayOfNumberOnlyTest.php @@ -36,48 +36,49 @@ use OpenAPIServer\Model\ArrayOfArrayOfNumberOnly; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\ArrayOfArrayOfNumberOnly */ -class ArrayOfArrayOfNumberOnlyTest extends \PHPUnit_Framework_TestCase { +class ArrayOfArrayOfNumberOnlyTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "ArrayOfArrayOfNumberOnly" */ - public function testArrayOfArrayOfNumberOnly() { + public function testArrayOfArrayOfNumberOnly() + { $testArrayOfArrayOfNumberOnly = new ArrayOfArrayOfNumberOnly(); } /** * Test attribute "arrayArrayNumber" */ - public function testPropertyArrayArrayNumber() { - + public function testPropertyArrayArrayNumber() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/ArrayOfNumberOnlyTest.php b/samples/server/petstore/php-slim/test/Model/ArrayOfNumberOnlyTest.php index 4e6b319009a..ce575e4b926 100644 --- a/samples/server/petstore/php-slim/test/Model/ArrayOfNumberOnlyTest.php +++ b/samples/server/petstore/php-slim/test/Model/ArrayOfNumberOnlyTest.php @@ -36,48 +36,49 @@ use OpenAPIServer\Model\ArrayOfNumberOnly; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\ArrayOfNumberOnly */ -class ArrayOfNumberOnlyTest extends \PHPUnit_Framework_TestCase { +class ArrayOfNumberOnlyTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "ArrayOfNumberOnly" */ - public function testArrayOfNumberOnly() { + public function testArrayOfNumberOnly() + { $testArrayOfNumberOnly = new ArrayOfNumberOnly(); } /** * Test attribute "arrayNumber" */ - public function testPropertyArrayNumber() { - + public function testPropertyArrayNumber() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/ArrayTestTest.php b/samples/server/petstore/php-slim/test/Model/ArrayTestTest.php index b3def0a71b4..236b83b3a85 100644 --- a/samples/server/petstore/php-slim/test/Model/ArrayTestTest.php +++ b/samples/server/petstore/php-slim/test/Model/ArrayTestTest.php @@ -36,62 +36,63 @@ use OpenAPIServer\Model\ArrayTest; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\ArrayTest */ -class ArrayTestTest extends \PHPUnit_Framework_TestCase { +class ArrayTestTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "ArrayTest" */ - public function testArrayTest() { + public function testArrayTest() + { $testArrayTest = new ArrayTest(); } /** * Test attribute "arrayOfString" */ - public function testPropertyArrayOfString() { - + public function testPropertyArrayOfString() + { } /** * Test attribute "arrayArrayOfInteger" */ - public function testPropertyArrayArrayOfInteger() { - + public function testPropertyArrayArrayOfInteger() + { } /** * Test attribute "arrayArrayOfModel" */ - public function testPropertyArrayArrayOfModel() { - + public function testPropertyArrayArrayOfModel() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/CapitalizationTest.php b/samples/server/petstore/php-slim/test/Model/CapitalizationTest.php index 5e13387834c..bbd0bf6a827 100644 --- a/samples/server/petstore/php-slim/test/Model/CapitalizationTest.php +++ b/samples/server/petstore/php-slim/test/Model/CapitalizationTest.php @@ -36,83 +36,84 @@ use OpenAPIServer\Model\Capitalization; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\Capitalization */ -class CapitalizationTest extends \PHPUnit_Framework_TestCase { +class CapitalizationTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "Capitalization" */ - public function testCapitalization() { + public function testCapitalization() + { $testCapitalization = new Capitalization(); } /** * Test attribute "smallCamel" */ - public function testPropertySmallCamel() { - + public function testPropertySmallCamel() + { } /** * Test attribute "capitalCamel" */ - public function testPropertyCapitalCamel() { - + public function testPropertyCapitalCamel() + { } /** * Test attribute "smallSnake" */ - public function testPropertySmallSnake() { - + public function testPropertySmallSnake() + { } /** * Test attribute "capitalSnake" */ - public function testPropertyCapitalSnake() { - + public function testPropertyCapitalSnake() + { } /** * Test attribute "sCAETHFlowPoints" */ - public function testPropertySCAETHFlowPoints() { - + public function testPropertySCAETHFlowPoints() + { } /** * Test attribute "aTTNAME" */ - public function testPropertyATTNAME() { - + public function testPropertyATTNAME() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/CatTest.php b/samples/server/petstore/php-slim/test/Model/CatTest.php index 13a542dd77e..b534aecf025 100644 --- a/samples/server/petstore/php-slim/test/Model/CatTest.php +++ b/samples/server/petstore/php-slim/test/Model/CatTest.php @@ -36,62 +36,63 @@ use OpenAPIServer\Model\Cat; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\Cat */ -class CatTest extends \PHPUnit_Framework_TestCase { +class CatTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "Cat" */ - public function testCat() { + public function testCat() + { $testCat = new Cat(); } /** * Test attribute "className" */ - public function testPropertyClassName() { - + public function testPropertyClassName() + { } /** * Test attribute "color" */ - public function testPropertyColor() { - + public function testPropertyColor() + { } /** * Test attribute "declawed" */ - public function testPropertyDeclawed() { - + public function testPropertyDeclawed() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/CategoryTest.php b/samples/server/petstore/php-slim/test/Model/CategoryTest.php index ade7b72a959..0fb02647384 100644 --- a/samples/server/petstore/php-slim/test/Model/CategoryTest.php +++ b/samples/server/petstore/php-slim/test/Model/CategoryTest.php @@ -36,55 +36,56 @@ use OpenAPIServer\Model\Category; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\Category */ -class CategoryTest extends \PHPUnit_Framework_TestCase { +class CategoryTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "Category" */ - public function testCategory() { + public function testCategory() + { $testCategory = new Category(); } /** * Test attribute "id" */ - public function testPropertyId() { - + public function testPropertyId() + { } /** * Test attribute "name" */ - public function testPropertyName() { - + public function testPropertyName() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/ClassModelTest.php b/samples/server/petstore/php-slim/test/Model/ClassModelTest.php index efcbec71f63..74a06642eb4 100644 --- a/samples/server/petstore/php-slim/test/Model/ClassModelTest.php +++ b/samples/server/petstore/php-slim/test/Model/ClassModelTest.php @@ -36,48 +36,49 @@ use OpenAPIServer\Model\ClassModel; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\ClassModel */ -class ClassModelTest extends \PHPUnit_Framework_TestCase { +class ClassModelTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "ClassModel" */ - public function testClassModel() { + public function testClassModel() + { $testClassModel = new ClassModel(); } /** * Test attribute "class" */ - public function testPropertyClass() { - + public function testPropertyClass() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/ClientTest.php b/samples/server/petstore/php-slim/test/Model/ClientTest.php index c1eba0c3621..56c29cc683f 100644 --- a/samples/server/petstore/php-slim/test/Model/ClientTest.php +++ b/samples/server/petstore/php-slim/test/Model/ClientTest.php @@ -36,48 +36,49 @@ use OpenAPIServer\Model\Client; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\Client */ -class ClientTest extends \PHPUnit_Framework_TestCase { +class ClientTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "Client" */ - public function testClient() { + public function testClient() + { $testClient = new Client(); } /** * Test attribute "client" */ - public function testPropertyClient() { - + public function testPropertyClient() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/DogTest.php b/samples/server/petstore/php-slim/test/Model/DogTest.php index 0a240c78c3a..93654a68641 100644 --- a/samples/server/petstore/php-slim/test/Model/DogTest.php +++ b/samples/server/petstore/php-slim/test/Model/DogTest.php @@ -36,62 +36,63 @@ use OpenAPIServer\Model\Dog; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\Dog */ -class DogTest extends \PHPUnit_Framework_TestCase { +class DogTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "Dog" */ - public function testDog() { + public function testDog() + { $testDog = new Dog(); } /** * Test attribute "className" */ - public function testPropertyClassName() { - + public function testPropertyClassName() + { } /** * Test attribute "color" */ - public function testPropertyColor() { - + public function testPropertyColor() + { } /** * Test attribute "breed" */ - public function testPropertyBreed() { - + public function testPropertyBreed() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/EnumArraysTest.php b/samples/server/petstore/php-slim/test/Model/EnumArraysTest.php index 9d11e5cdaca..467139153a2 100644 --- a/samples/server/petstore/php-slim/test/Model/EnumArraysTest.php +++ b/samples/server/petstore/php-slim/test/Model/EnumArraysTest.php @@ -36,55 +36,56 @@ use OpenAPIServer\Model\EnumArrays; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\EnumArrays */ -class EnumArraysTest extends \PHPUnit_Framework_TestCase { +class EnumArraysTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "EnumArrays" */ - public function testEnumArrays() { + public function testEnumArrays() + { $testEnumArrays = new EnumArrays(); } /** * Test attribute "justSymbol" */ - public function testPropertyJustSymbol() { - + public function testPropertyJustSymbol() + { } /** * Test attribute "arrayEnum" */ - public function testPropertyArrayEnum() { - + public function testPropertyArrayEnum() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/EnumClassTest.php b/samples/server/petstore/php-slim/test/Model/EnumClassTest.php index 95ed9693c71..95784e82aed 100644 --- a/samples/server/petstore/php-slim/test/Model/EnumClassTest.php +++ b/samples/server/petstore/php-slim/test/Model/EnumClassTest.php @@ -36,41 +36,42 @@ use OpenAPIServer\Model\EnumClass; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\EnumClass */ -class EnumClassTest extends \PHPUnit_Framework_TestCase { +class EnumClassTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "EnumClass" */ - public function testEnumClass() { + public function testEnumClass() + { $testEnumClass = new EnumClass(); } } - diff --git a/samples/server/petstore/php-slim/test/Model/EnumTestTest.php b/samples/server/petstore/php-slim/test/Model/EnumTestTest.php index fd95271cb1a..dc8ae643280 100644 --- a/samples/server/petstore/php-slim/test/Model/EnumTestTest.php +++ b/samples/server/petstore/php-slim/test/Model/EnumTestTest.php @@ -36,76 +36,77 @@ use OpenAPIServer\Model\EnumTest; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\EnumTest */ -class EnumTestTest extends \PHPUnit_Framework_TestCase { +class EnumTestTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "EnumTest" */ - public function testEnumTest() { + public function testEnumTest() + { $testEnumTest = new EnumTest(); } /** * Test attribute "enumString" */ - public function testPropertyEnumString() { - + public function testPropertyEnumString() + { } /** * Test attribute "enumStringRequired" */ - public function testPropertyEnumStringRequired() { - + public function testPropertyEnumStringRequired() + { } /** * Test attribute "enumInteger" */ - public function testPropertyEnumInteger() { - + public function testPropertyEnumInteger() + { } /** * Test attribute "enumNumber" */ - public function testPropertyEnumNumber() { - + public function testPropertyEnumNumber() + { } /** * Test attribute "outerEnum" */ - public function testPropertyOuterEnum() { - + public function testPropertyOuterEnum() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/FileSchemaTestClassTest.php b/samples/server/petstore/php-slim/test/Model/FileSchemaTestClassTest.php index 7416c0bd6cf..38bc7db0868 100644 --- a/samples/server/petstore/php-slim/test/Model/FileSchemaTestClassTest.php +++ b/samples/server/petstore/php-slim/test/Model/FileSchemaTestClassTest.php @@ -36,55 +36,56 @@ use OpenAPIServer\Model\FileSchemaTestClass; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\FileSchemaTestClass */ -class FileSchemaTestClassTest extends \PHPUnit_Framework_TestCase { +class FileSchemaTestClassTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "FileSchemaTestClass" */ - public function testFileSchemaTestClass() { + public function testFileSchemaTestClass() + { $testFileSchemaTestClass = new FileSchemaTestClass(); } /** * Test attribute "file" */ - public function testPropertyFile() { - + public function testPropertyFile() + { } /** * Test attribute "files" */ - public function testPropertyFiles() { - + public function testPropertyFiles() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/FileTest.php b/samples/server/petstore/php-slim/test/Model/FileTest.php index 01d6820a80b..57129a8c54c 100644 --- a/samples/server/petstore/php-slim/test/Model/FileTest.php +++ b/samples/server/petstore/php-slim/test/Model/FileTest.php @@ -36,48 +36,49 @@ use OpenAPIServer\Model\File; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\File */ -class FileTest extends \PHPUnit_Framework_TestCase { +class FileTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "File" */ - public function testFile() { + public function testFile() + { $testFile = new File(); } /** * Test attribute "sourceURI" */ - public function testPropertySourceURI() { - + public function testPropertySourceURI() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/FormatTestTest.php b/samples/server/petstore/php-slim/test/Model/FormatTestTest.php index ee6f993c3de..90cb8475b1b 100644 --- a/samples/server/petstore/php-slim/test/Model/FormatTestTest.php +++ b/samples/server/petstore/php-slim/test/Model/FormatTestTest.php @@ -36,132 +36,133 @@ use OpenAPIServer\Model\FormatTest; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\FormatTest */ -class FormatTestTest extends \PHPUnit_Framework_TestCase { +class FormatTestTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "FormatTest" */ - public function testFormatTest() { + public function testFormatTest() + { $testFormatTest = new FormatTest(); } /** * Test attribute "integer" */ - public function testPropertyInteger() { - + public function testPropertyInteger() + { } /** * Test attribute "int32" */ - public function testPropertyInt32() { - + public function testPropertyInt32() + { } /** * Test attribute "int64" */ - public function testPropertyInt64() { - + public function testPropertyInt64() + { } /** * Test attribute "number" */ - public function testPropertyNumber() { - + public function testPropertyNumber() + { } /** * Test attribute "float" */ - public function testPropertyFloat() { - + public function testPropertyFloat() + { } /** * Test attribute "double" */ - public function testPropertyDouble() { - + public function testPropertyDouble() + { } /** * Test attribute "string" */ - public function testPropertyString() { - + public function testPropertyString() + { } /** * Test attribute "byte" */ - public function testPropertyByte() { - + public function testPropertyByte() + { } /** * Test attribute "binary" */ - public function testPropertyBinary() { - + public function testPropertyBinary() + { } /** * Test attribute "date" */ - public function testPropertyDate() { - + public function testPropertyDate() + { } /** * Test attribute "dateTime" */ - public function testPropertyDateTime() { - + public function testPropertyDateTime() + { } /** * Test attribute "uuid" */ - public function testPropertyUuid() { - + public function testPropertyUuid() + { } /** * Test attribute "password" */ - public function testPropertyPassword() { - + public function testPropertyPassword() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/HasOnlyReadOnlyTest.php b/samples/server/petstore/php-slim/test/Model/HasOnlyReadOnlyTest.php index 67b16311563..d886b0c9643 100644 --- a/samples/server/petstore/php-slim/test/Model/HasOnlyReadOnlyTest.php +++ b/samples/server/petstore/php-slim/test/Model/HasOnlyReadOnlyTest.php @@ -36,55 +36,56 @@ use OpenAPIServer\Model\HasOnlyReadOnly; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\HasOnlyReadOnly */ -class HasOnlyReadOnlyTest extends \PHPUnit_Framework_TestCase { +class HasOnlyReadOnlyTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "HasOnlyReadOnly" */ - public function testHasOnlyReadOnly() { + public function testHasOnlyReadOnly() + { $testHasOnlyReadOnly = new HasOnlyReadOnly(); } /** * Test attribute "bar" */ - public function testPropertyBar() { - + public function testPropertyBar() + { } /** * Test attribute "foo" */ - public function testPropertyFoo() { - + public function testPropertyFoo() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/MapTestTest.php b/samples/server/petstore/php-slim/test/Model/MapTestTest.php index 47bbd8a3301..d3c0b8e1361 100644 --- a/samples/server/petstore/php-slim/test/Model/MapTestTest.php +++ b/samples/server/petstore/php-slim/test/Model/MapTestTest.php @@ -36,69 +36,70 @@ use OpenAPIServer\Model\MapTest; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\MapTest */ -class MapTestTest extends \PHPUnit_Framework_TestCase { +class MapTestTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "MapTest" */ - public function testMapTest() { + public function testMapTest() + { $testMapTest = new MapTest(); } /** * Test attribute "mapMapOfString" */ - public function testPropertyMapMapOfString() { - + public function testPropertyMapMapOfString() + { } /** * Test attribute "mapOfEnumString" */ - public function testPropertyMapOfEnumString() { - + public function testPropertyMapOfEnumString() + { } /** * Test attribute "directMap" */ - public function testPropertyDirectMap() { - + public function testPropertyDirectMap() + { } /** * Test attribute "indirectMap" */ - public function testPropertyIndirectMap() { - + public function testPropertyIndirectMap() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/MixedPropertiesAndAdditionalPropertiesClassTest.php b/samples/server/petstore/php-slim/test/Model/MixedPropertiesAndAdditionalPropertiesClassTest.php index 7356a017be6..5ee64f596d4 100644 --- a/samples/server/petstore/php-slim/test/Model/MixedPropertiesAndAdditionalPropertiesClassTest.php +++ b/samples/server/petstore/php-slim/test/Model/MixedPropertiesAndAdditionalPropertiesClassTest.php @@ -36,62 +36,63 @@ use OpenAPIServer\Model\MixedPropertiesAndAdditionalPropertiesClass; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\MixedPropertiesAndAdditionalPropertiesClass */ -class MixedPropertiesAndAdditionalPropertiesClassTest extends \PHPUnit_Framework_TestCase { +class MixedPropertiesAndAdditionalPropertiesClassTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "MixedPropertiesAndAdditionalPropertiesClass" */ - public function testMixedPropertiesAndAdditionalPropertiesClass() { + public function testMixedPropertiesAndAdditionalPropertiesClass() + { $testMixedPropertiesAndAdditionalPropertiesClass = new MixedPropertiesAndAdditionalPropertiesClass(); } /** * Test attribute "uuid" */ - public function testPropertyUuid() { - + public function testPropertyUuid() + { } /** * Test attribute "dateTime" */ - public function testPropertyDateTime() { - + public function testPropertyDateTime() + { } /** * Test attribute "map" */ - public function testPropertyMap() { - + public function testPropertyMap() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/Model200ResponseTest.php b/samples/server/petstore/php-slim/test/Model/Model200ResponseTest.php index 01301c810bd..36706cf0c2a 100644 --- a/samples/server/petstore/php-slim/test/Model/Model200ResponseTest.php +++ b/samples/server/petstore/php-slim/test/Model/Model200ResponseTest.php @@ -36,55 +36,56 @@ use OpenAPIServer\Model\Model200Response; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\Model200Response */ -class Model200ResponseTest extends \PHPUnit_Framework_TestCase { +class Model200ResponseTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "Model200Response" */ - public function testModel200Response() { + public function testModel200Response() + { $testModel200Response = new Model200Response(); } /** * Test attribute "name" */ - public function testPropertyName() { - + public function testPropertyName() + { } /** * Test attribute "class" */ - public function testPropertyClass() { - + public function testPropertyClass() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/ModelListTest.php b/samples/server/petstore/php-slim/test/Model/ModelListTest.php index 4f8b1713292..c73f1a80e9e 100644 --- a/samples/server/petstore/php-slim/test/Model/ModelListTest.php +++ b/samples/server/petstore/php-slim/test/Model/ModelListTest.php @@ -36,48 +36,49 @@ use OpenAPIServer\Model\ModelList; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\ModelList */ -class ModelListTest extends \PHPUnit_Framework_TestCase { +class ModelListTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "ModelList" */ - public function testModelList() { + public function testModelList() + { $testModelList = new ModelList(); } /** * Test attribute "_123list" */ - public function testProperty123list() { - + public function testProperty123list() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/ModelReturnTest.php b/samples/server/petstore/php-slim/test/Model/ModelReturnTest.php index d087f796c72..1ba2a4eba69 100644 --- a/samples/server/petstore/php-slim/test/Model/ModelReturnTest.php +++ b/samples/server/petstore/php-slim/test/Model/ModelReturnTest.php @@ -36,48 +36,49 @@ use OpenAPIServer\Model\ModelReturn; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\ModelReturn */ -class ModelReturnTest extends \PHPUnit_Framework_TestCase { +class ModelReturnTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "ModelReturn" */ - public function testModelReturn() { + public function testModelReturn() + { $testModelReturn = new ModelReturn(); } /** * Test attribute "return" */ - public function testPropertyReturn() { - + public function testPropertyReturn() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/NameTest.php b/samples/server/petstore/php-slim/test/Model/NameTest.php index 8e8104c7a24..70558568c0e 100644 --- a/samples/server/petstore/php-slim/test/Model/NameTest.php +++ b/samples/server/petstore/php-slim/test/Model/NameTest.php @@ -36,69 +36,70 @@ use OpenAPIServer\Model\Name; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\Name */ -class NameTest extends \PHPUnit_Framework_TestCase { +class NameTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "Name" */ - public function testName() { + public function testName() + { $testName = new Name(); } /** * Test attribute "name" */ - public function testPropertyName() { - + public function testPropertyName() + { } /** * Test attribute "snakeCase" */ - public function testPropertySnakeCase() { - + public function testPropertySnakeCase() + { } /** * Test attribute "property" */ - public function testPropertyProperty() { - + public function testPropertyProperty() + { } /** * Test attribute "_123number" */ - public function testProperty123number() { - + public function testProperty123number() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/NumberOnlyTest.php b/samples/server/petstore/php-slim/test/Model/NumberOnlyTest.php index 68320527de8..38f10551023 100644 --- a/samples/server/petstore/php-slim/test/Model/NumberOnlyTest.php +++ b/samples/server/petstore/php-slim/test/Model/NumberOnlyTest.php @@ -36,48 +36,49 @@ use OpenAPIServer\Model\NumberOnly; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\NumberOnly */ -class NumberOnlyTest extends \PHPUnit_Framework_TestCase { +class NumberOnlyTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "NumberOnly" */ - public function testNumberOnly() { + public function testNumberOnly() + { $testNumberOnly = new NumberOnly(); } /** * Test attribute "justNumber" */ - public function testPropertyJustNumber() { - + public function testPropertyJustNumber() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/OrderTest.php b/samples/server/petstore/php-slim/test/Model/OrderTest.php index 615dd0797bc..7542b27a8c6 100644 --- a/samples/server/petstore/php-slim/test/Model/OrderTest.php +++ b/samples/server/petstore/php-slim/test/Model/OrderTest.php @@ -36,83 +36,84 @@ use OpenAPIServer\Model\Order; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\Order */ -class OrderTest extends \PHPUnit_Framework_TestCase { +class OrderTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "Order" */ - public function testOrder() { + public function testOrder() + { $testOrder = new Order(); } /** * Test attribute "id" */ - public function testPropertyId() { - + public function testPropertyId() + { } /** * Test attribute "petId" */ - public function testPropertyPetId() { - + public function testPropertyPetId() + { } /** * Test attribute "quantity" */ - public function testPropertyQuantity() { - + public function testPropertyQuantity() + { } /** * Test attribute "shipDate" */ - public function testPropertyShipDate() { - + public function testPropertyShipDate() + { } /** * Test attribute "status" */ - public function testPropertyStatus() { - + public function testPropertyStatus() + { } /** * Test attribute "complete" */ - public function testPropertyComplete() { - + public function testPropertyComplete() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/OuterCompositeTest.php b/samples/server/petstore/php-slim/test/Model/OuterCompositeTest.php index ba5c4e87ee2..4afa5838af2 100644 --- a/samples/server/petstore/php-slim/test/Model/OuterCompositeTest.php +++ b/samples/server/petstore/php-slim/test/Model/OuterCompositeTest.php @@ -36,62 +36,63 @@ use OpenAPIServer\Model\OuterComposite; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\OuterComposite */ -class OuterCompositeTest extends \PHPUnit_Framework_TestCase { +class OuterCompositeTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "OuterComposite" */ - public function testOuterComposite() { + public function testOuterComposite() + { $testOuterComposite = new OuterComposite(); } /** * Test attribute "myNumber" */ - public function testPropertyMyNumber() { - + public function testPropertyMyNumber() + { } /** * Test attribute "myString" */ - public function testPropertyMyString() { - + public function testPropertyMyString() + { } /** * Test attribute "myBoolean" */ - public function testPropertyMyBoolean() { - + public function testPropertyMyBoolean() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/OuterEnumTest.php b/samples/server/petstore/php-slim/test/Model/OuterEnumTest.php index 8f4f9ed9f2d..45e7df7fbed 100644 --- a/samples/server/petstore/php-slim/test/Model/OuterEnumTest.php +++ b/samples/server/petstore/php-slim/test/Model/OuterEnumTest.php @@ -36,41 +36,42 @@ use OpenAPIServer\Model\OuterEnum; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\OuterEnum */ -class OuterEnumTest extends \PHPUnit_Framework_TestCase { +class OuterEnumTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "OuterEnum" */ - public function testOuterEnum() { + public function testOuterEnum() + { $testOuterEnum = new OuterEnum(); } } - diff --git a/samples/server/petstore/php-slim/test/Model/PetTest.php b/samples/server/petstore/php-slim/test/Model/PetTest.php index 6f962d1aae2..0bf28bb7040 100644 --- a/samples/server/petstore/php-slim/test/Model/PetTest.php +++ b/samples/server/petstore/php-slim/test/Model/PetTest.php @@ -36,83 +36,84 @@ use OpenAPIServer\Model\Pet; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\Pet */ -class PetTest extends \PHPUnit_Framework_TestCase { +class PetTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "Pet" */ - public function testPet() { + public function testPet() + { $testPet = new Pet(); } /** * Test attribute "id" */ - public function testPropertyId() { - + public function testPropertyId() + { } /** * Test attribute "category" */ - public function testPropertyCategory() { - + public function testPropertyCategory() + { } /** * Test attribute "name" */ - public function testPropertyName() { - + public function testPropertyName() + { } /** * Test attribute "photoUrls" */ - public function testPropertyPhotoUrls() { - + public function testPropertyPhotoUrls() + { } /** * Test attribute "tags" */ - public function testPropertyTags() { - + public function testPropertyTags() + { } /** * Test attribute "status" */ - public function testPropertyStatus() { - + public function testPropertyStatus() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/ReadOnlyFirstTest.php b/samples/server/petstore/php-slim/test/Model/ReadOnlyFirstTest.php index b26d3317d7f..d47f78d8bb5 100644 --- a/samples/server/petstore/php-slim/test/Model/ReadOnlyFirstTest.php +++ b/samples/server/petstore/php-slim/test/Model/ReadOnlyFirstTest.php @@ -36,55 +36,56 @@ use OpenAPIServer\Model\ReadOnlyFirst; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\ReadOnlyFirst */ -class ReadOnlyFirstTest extends \PHPUnit_Framework_TestCase { +class ReadOnlyFirstTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "ReadOnlyFirst" */ - public function testReadOnlyFirst() { + public function testReadOnlyFirst() + { $testReadOnlyFirst = new ReadOnlyFirst(); } /** * Test attribute "bar" */ - public function testPropertyBar() { - + public function testPropertyBar() + { } /** * Test attribute "baz" */ - public function testPropertyBaz() { - + public function testPropertyBaz() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/SpecialModelNameTest.php b/samples/server/petstore/php-slim/test/Model/SpecialModelNameTest.php index 391d12f8b7e..197e25622de 100644 --- a/samples/server/petstore/php-slim/test/Model/SpecialModelNameTest.php +++ b/samples/server/petstore/php-slim/test/Model/SpecialModelNameTest.php @@ -36,48 +36,49 @@ use OpenAPIServer\Model\SpecialModelName; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\SpecialModelName */ -class SpecialModelNameTest extends \PHPUnit_Framework_TestCase { +class SpecialModelNameTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "SpecialModelName" */ - public function testSpecialModelName() { + public function testSpecialModelName() + { $testSpecialModelName = new SpecialModelName(); } /** * Test attribute "specialPropertyName" */ - public function testPropertySpecialPropertyName() { - + public function testPropertySpecialPropertyName() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/StringBooleanMapTest.php b/samples/server/petstore/php-slim/test/Model/StringBooleanMapTest.php index 600f610a3e6..41fe1a9f8d5 100644 --- a/samples/server/petstore/php-slim/test/Model/StringBooleanMapTest.php +++ b/samples/server/petstore/php-slim/test/Model/StringBooleanMapTest.php @@ -36,41 +36,42 @@ use OpenAPIServer\Model\StringBooleanMap; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\StringBooleanMap */ -class StringBooleanMapTest extends \PHPUnit_Framework_TestCase { +class StringBooleanMapTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "StringBooleanMap" */ - public function testStringBooleanMap() { + public function testStringBooleanMap() + { $testStringBooleanMap = new StringBooleanMap(); } } - diff --git a/samples/server/petstore/php-slim/test/Model/TagTest.php b/samples/server/petstore/php-slim/test/Model/TagTest.php index 3289c8a7794..69f2abeb0b7 100644 --- a/samples/server/petstore/php-slim/test/Model/TagTest.php +++ b/samples/server/petstore/php-slim/test/Model/TagTest.php @@ -36,55 +36,56 @@ use OpenAPIServer\Model\Tag; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\Tag */ -class TagTest extends \PHPUnit_Framework_TestCase { +class TagTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "Tag" */ - public function testTag() { + public function testTag() + { $testTag = new Tag(); } /** * Test attribute "id" */ - public function testPropertyId() { - + public function testPropertyId() + { } /** * Test attribute "name" */ - public function testPropertyName() { - + public function testPropertyName() + { } } - diff --git a/samples/server/petstore/php-slim/test/Model/UserTest.php b/samples/server/petstore/php-slim/test/Model/UserTest.php index 9bd3a0e2c1a..7f40f26f10a 100644 --- a/samples/server/petstore/php-slim/test/Model/UserTest.php +++ b/samples/server/petstore/php-slim/test/Model/UserTest.php @@ -36,97 +36,98 @@ use OpenAPIServer\Model\User; * @link https://github.com/openapitools/openapi-generator * @coversDefaultClass \OpenAPIServer\Model\User */ -class UserTest extends \PHPUnit_Framework_TestCase { +class UserTest extends \PHPUnit_Framework_TestCase +{ /** * Setup before running any test cases */ - public static function setUpBeforeClass() { - + public static function setUpBeforeClass() + { } /** * Setup before running each test case */ - public function setUp() { - + public function setUp() + { } /** * Clean up after running each test case */ - public function tearDown() { - + public function tearDown() + { } /** * Clean up after running all test cases */ - public static function tearDownAfterClass() { - + public static function tearDownAfterClass() + { } /** * Test "User" */ - public function testUser() { + public function testUser() + { $testUser = new User(); } /** * Test attribute "id" */ - public function testPropertyId() { - + public function testPropertyId() + { } /** * Test attribute "username" */ - public function testPropertyUsername() { - + public function testPropertyUsername() + { } /** * Test attribute "firstName" */ - public function testPropertyFirstName() { - + public function testPropertyFirstName() + { } /** * Test attribute "lastName" */ - public function testPropertyLastName() { - + public function testPropertyLastName() + { } /** * Test attribute "email" */ - public function testPropertyEmail() { - + public function testPropertyEmail() + { } /** * Test attribute "password" */ - public function testPropertyPassword() { - + public function testPropertyPassword() + { } /** * Test attribute "phone" */ - public function testPropertyPhone() { - + public function testPropertyPhone() + { } /** * Test attribute "userStatus" */ - public function testPropertyUserStatus() { - + public function testPropertyUserStatus() + { } } - diff --git a/samples/server/petstore/php-ze-ph/src/App/DTO/MapTest.php b/samples/server/petstore/php-ze-ph/src/App/DTO/MapTest.php index 0f933f96c12..cdafc69a0e0 100644 --- a/samples/server/petstore/php-ze-ph/src/App/DTO/MapTest.php +++ b/samples/server/petstore/php-ze-ph/src/App/DTO/MapTest.php @@ -38,9 +38,11 @@ class MapTest public $direct_map; /** * @DTA\Data(field="indirect_map", nullable=true) - * @DTA\Strategy(name="Object", options={"type":\App\DTO\StringBooleanMap::class}) - * @DTA\Validator(name="Dictionary", options={"type":\App\DTO\StringBooleanMap::class}) - * @var \App\DTO\StringBooleanMap + * TODO check validator and strategy are correct and can handle container item type + * @DTA\Validator(name="Collection", options={"validators":{ + * {"name":"Type", "options":{"type":"bool"}} + * }}) + * @var map[string,bool] */ public $indirect_map; } diff --git a/samples/server/petstore/rust-server/output/rust-server-test/api/openapi.yaml b/samples/server/petstore/rust-server/output/rust-server-test/api/openapi.yaml index 65b747a3f8b..3ad35a166ff 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/api/openapi.yaml +++ b/samples/server/petstore/rust-server/output/rust-server-test/api/openapi.yaml @@ -3,6 +3,8 @@ info: description: This spec is for testing rust-server-specific things title: rust-server-test version: 1.0.0 +servers: +- url: / paths: /dummy: get: @@ -19,4 +21,15 @@ components: description: An additionalPropertiesObject example: foo type: object + aNullableContainer: + properties: + NullableThing: + nullable: true + type: string + RequiredNullableThing: + nullable: true + type: string + required: + - RequiredNullableThing + type: object diff --git a/samples/server/petstore/rust-server/output/rust-server-test/src/models.rs b/samples/server/petstore/rust-server/output/rust-server-test/src/models.rs index 796339d1303..f4c3e1b36a3 100644 --- a/samples/server/petstore/rust-server/output/rust-server-test/src/models.rs +++ b/samples/server/petstore/rust-server/output/rust-server-test/src/models.rs @@ -10,6 +10,28 @@ use models; use swagger; +#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] +pub struct ANullableContainer { + #[serde(rename = "NullableThing")] + #[serde(deserialize_with = "swagger::nullable_format::deserialize_optional_nullable")] + #[serde(default = "swagger::nullable_format::default_optional_nullable")] + #[serde(skip_serializing_if="Option::is_none")] + pub nullable_thing: Option>, + + #[serde(rename = "RequiredNullableThing")] + pub required_nullable_thing: swagger::Nullable, + +} + +impl ANullableContainer { + pub fn new(required_nullable_thing: swagger::Nullable, ) -> ANullableContainer { + ANullableContainer { + nullable_thing: None, + required_nullable_thing: required_nullable_thing, + } + } +} + /// An additionalPropertiesObject #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct AdditionalPropertiesObject { diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/ApiUtil.java index c5f5cc143a1..3ecc0972d94 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/ApiUtil.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/ApiUtil.java @@ -8,8 +8,10 @@ import java.io.IOException; public class ApiUtil { public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { try { - req.getNativeResponse(HttpServletResponse.class).addHeader("Content-Type", contentType); - req.getNativeResponse(HttpServletResponse.class).getOutputStream().print(example); + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); } catch (IOException e) { throw new RuntimeException(e); } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeApi.java index ca3b84e1516..19ecdbcf5a4 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/FakeApi.java @@ -52,17 +52,7 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default CompletableFuture> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { - return CompletableFuture.supplyAsync(()-> { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); - return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); - }, Runnable::run); + return CompletableFuture.completedFuture(new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED)); } @@ -96,17 +86,7 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default CompletableFuture> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { - return CompletableFuture.supplyAsync(()-> { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); - return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); - }, Runnable::run); + return CompletableFuture.completedFuture(new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED)); } @@ -118,17 +98,7 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default CompletableFuture> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { - return CompletableFuture.supplyAsync(()-> { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); - return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); - }, Runnable::run); + return CompletableFuture.completedFuture(new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED)); } @@ -189,7 +159,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default CompletableFuture> testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @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 = "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) { return CompletableFuture.completedFuture(new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED)); } @@ -202,7 +172,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default CompletableFuture> 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=">, $", defaultValue="$") @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) { + default CompletableFuture> testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<>()") @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 = ">, $", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList<>()") 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=">, $", defaultValue="$") @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 CompletableFuture.completedFuture(new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED)); } @@ -226,7 +196,7 @@ public interface FakeApi { @RequestMapping(value = "/fake/jsonFormData", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default CompletableFuture> testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2) { + default CompletableFuture> 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 CompletableFuture.completedFuture(new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED)); } @@ -244,7 +214,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", defaultValue="null") @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 detail") @Valid @RequestPart("file") 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/PetApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/api/PetApi.java index 6a684880a1f..db2f5d95484 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 @@ -83,7 +83,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default 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) { + default CompletableFuture>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList<>()") List status) { return CompletableFuture.supplyAsync(()-> { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { @@ -115,7 +115,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default CompletableFuture>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { + default CompletableFuture>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList<>()") List tags) { return CompletableFuture.supplyAsync(()-> { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { @@ -195,7 +195,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status) { + default 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) { return CompletableFuture.completedFuture(new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED)); } @@ -213,7 +213,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", defaultValue="null") @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 detail") @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/model/Animal.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Animal.java index 5bc21a6e60b..b9df0761fa2 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Animal.java @@ -22,7 +22,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Capitalization.java index 2f67e3d6ed8..cf8e0184c75 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Capitalization.java @@ -14,22 +14,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Cat.java index b0ee4437409..db751abc2d8 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Cat.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Category.java index ede08450019..ab96fdce16a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Category.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ClassModel.java index b7c7d9330a0..1a44b03b0bc 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ClassModel.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Client.java index 68e888388b1..cf73d18603d 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Client.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Dog.java index 9b877bb8029..59f5507d573 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Dog.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/EnumArrays.java index 7c15608894d..1bf86d35fa3 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/EnumArrays.java @@ -48,7 +48,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/EnumTest.java index 26a8bce4e7c..dcb97236e4b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/EnumTest.java @@ -49,7 +49,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -85,7 +85,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -119,7 +119,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -153,7 +153,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/FormatTest.java index 31638e0ed66..6b1af9b08be 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/FormatTest.java @@ -19,43 +19,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private Resource binary = null; + private Resource binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index 13a6378b53e..1818546ce32 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; public HasOnlyReadOnly bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/MapTest.java index a6acaa59d1a..93a2b1e7b22 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/MapTest.java @@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.Valid; import javax.validation.constraints.*; @@ -62,7 +61,8 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + @Valid + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -149,24 +149,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - @Valid - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 452da256d01..5f1212179a3 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -20,10 +20,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") @Valid diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Model200Response.java index fdbe2056875..6a77de5e22a 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Model200Response.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ModelApiResponse.java index deb0fd9924f..a05b204bece 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -14,13 +14,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ModelReturn.java index 10684b30f81..b21e712510d 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ModelReturn.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Name.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Name.java index ba33f48731a..ba9701e1b7d 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Name.java @@ -15,16 +15,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/NumberOnly.java index 158b899847f..275529bafe1 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/NumberOnly.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Order.java index 946ce8f756d..0a09f15f309 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Order.java @@ -16,16 +16,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -61,7 +61,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/OuterComposite.java index c343b0b39ed..f522765ede1 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/OuterComposite.java @@ -15,13 +15,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Pet.java index 502146abefc..d3bca13a64b 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Pet.java @@ -19,13 +19,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") @Valid @@ -69,7 +69,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ReadOnlyFirst.java index 321c3bddc68..f0c6b763e9f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; public ReadOnlyFirst bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/SpecialModelName.java index 14741b1d224..6b445cfa0d9 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/SpecialModelName.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Tag.java index c9655217d9c..d9a99a54704 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/Tag.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/User.java index b1e7e56281a..d934073c84f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/org/openapitools/model/User.java @@ -14,28 +14,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/ApiUtil.java index c5f5cc143a1..3ecc0972d94 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/ApiUtil.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/ApiUtil.java @@ -8,8 +8,10 @@ import java.io.IOException; public class ApiUtil { public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { try { - req.getNativeResponse(HttpServletResponse.class).addHeader("Content-Type", contentType); - req.getNativeResponse(HttpServletResponse.class).getOutputStream().print(example); + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); } catch (IOException e) { throw new RuntimeException(e); } 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 c9e5393c8af..c0161fc2f13 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 @@ -51,14 +51,6 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -91,14 +83,6 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -111,14 +95,6 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -178,7 +154,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) LocalDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @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 = "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) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -191,7 +167,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default 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=">, $", defaultValue="$") @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) { + default ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<>()") @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 = ">, $", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList<>()") 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=">, $", defaultValue="$") @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); } @@ -215,7 +191,7 @@ public interface FakeApi { @RequestMapping(value = "/fake/jsonFormData", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2) { + default 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); } @@ -233,7 +209,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", defaultValue="null") @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 detail") @Valid @RequestPart("file") 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/PetApi.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/api/PetApi.java index cd7fb1b1a17..4fadfa5b944 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 @@ -82,7 +82,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default 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) { + default ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList<>()") List status) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -112,7 +112,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { + default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList<>()") List tags) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -188,7 +188,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status) { + default 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); } @@ -206,7 +206,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", defaultValue="null") @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 detail") @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/model/Animal.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Animal.java index 5bc21a6e60b..b9df0761fa2 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Animal.java @@ -22,7 +22,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Capitalization.java index 2f67e3d6ed8..cf8e0184c75 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Capitalization.java @@ -14,22 +14,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Cat.java index b0ee4437409..db751abc2d8 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Cat.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Category.java index ede08450019..ab96fdce16a 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Category.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ClassModel.java index b7c7d9330a0..1a44b03b0bc 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ClassModel.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Client.java index 68e888388b1..cf73d18603d 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Client.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Dog.java index 9b877bb8029..59f5507d573 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Dog.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/EnumArrays.java index 7c15608894d..1bf86d35fa3 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/EnumArrays.java @@ -48,7 +48,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/EnumTest.java index 26a8bce4e7c..dcb97236e4b 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/EnumTest.java @@ -49,7 +49,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -85,7 +85,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -119,7 +119,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -153,7 +153,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/FormatTest.java index 16e24750b32..25e4f22e27d 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/FormatTest.java @@ -19,43 +19,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private Resource binary = null; + private Resource binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private LocalDateTime dateTime = null; + private LocalDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index 13a6378b53e..1818546ce32 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; public HasOnlyReadOnly bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/MapTest.java index a6acaa59d1a..93a2b1e7b22 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/MapTest.java @@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.Valid; import javax.validation.constraints.*; @@ -62,7 +61,8 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + @Valid + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -149,24 +149,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - @Valid - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 0c6122cdb4c..3a30f4a90cc 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -20,10 +20,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private LocalDateTime dateTime = null; + private LocalDateTime dateTime; @JsonProperty("map") @Valid diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Model200Response.java index fdbe2056875..6a77de5e22a 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Model200Response.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ModelApiResponse.java index deb0fd9924f..a05b204bece 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -14,13 +14,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ModelReturn.java index 10684b30f81..b21e712510d 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ModelReturn.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Name.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Name.java index ba33f48731a..ba9701e1b7d 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Name.java @@ -15,16 +15,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/NumberOnly.java index 158b899847f..275529bafe1 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/NumberOnly.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Order.java index bb7ade10655..99e9c3bde59 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Order.java @@ -16,16 +16,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private LocalDateTime shipDate = null; + private LocalDateTime shipDate; /** * Order Status @@ -61,7 +61,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/OuterComposite.java index c343b0b39ed..f522765ede1 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/OuterComposite.java @@ -15,13 +15,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Pet.java index 502146abefc..d3bca13a64b 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Pet.java @@ -19,13 +19,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") @Valid @@ -69,7 +69,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ReadOnlyFirst.java index 321c3bddc68..f0c6b763e9f 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; public ReadOnlyFirst bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/SpecialModelName.java index 14741b1d224..6b445cfa0d9 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/SpecialModelName.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Tag.java index c9655217d9c..d9a99a54704 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/Tag.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/User.java index b1e7e56281a..d934073c84f 100644 --- a/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/spring-mvc-j8-localdatetime/src/main/java/org/openapitools/model/User.java @@ -14,28 +14,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiUtil.java index c5f5cc143a1..3ecc0972d94 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiUtil.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/api/ApiUtil.java @@ -8,8 +8,10 @@ import java.io.IOException; public class ApiUtil { public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { try { - req.getNativeResponse(HttpServletResponse.class).addHeader("Content-Type", contentType); - req.getNativeResponse(HttpServletResponse.class).getOutputStream().print(example); + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); } catch (IOException e) { throw new RuntimeException(e); } 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 354f6133919..6605d282465 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 @@ -109,7 +109,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @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 = "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); @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @@ -119,7 +119,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - 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=">, $", defaultValue="$") @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); + ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()") @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 = ">, $", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList()") 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=">, $", defaultValue="$") @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); @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @@ -137,7 +137,7 @@ public interface FakeApi { @RequestMapping(value = "/fake/jsonFormData", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2); + 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); @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @@ -152,6 +152,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", defaultValue="null") @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 detail") @Valid @RequestPart("file") 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 70ab648075c..481c3797c6f 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,12 +41,6 @@ public class FakeApiController implements FakeApi { } public ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -63,23 +57,11 @@ public class FakeApiController implements FakeApi { } public ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } public ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -105,12 +87,12 @@ public class FakeApiController implements FakeApi { } - public ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="callback", required=false) String paramCallback) { + 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) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } - 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=">, $", defaultValue="$") @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) { + public ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()") @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 = ">, $", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList()") 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=">, $", defaultValue="$") @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); } @@ -120,12 +102,12 @@ public class FakeApiController implements FakeApi { } - public ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2) { + 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); } - 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", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + 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) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}"); 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 e7ad9e683bb..83094336b69 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 @@ -68,7 +68,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - 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); + ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList()") List status); @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 = { @@ -83,7 +83,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags); + ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList()") List tags); @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -126,7 +126,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status); + 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); @ApiOperation(value = "uploads an image", nickname = "uploadFile", notes = "", response = ModelApiResponse.class, authorizations = { @@ -141,6 +141,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", defaultValue="null") @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 detail") @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 20ea8d651a4..049bfc7c538 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 @@ -43,7 +43,7 @@ public class PetApiController implements PetApi { } - 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) { + public ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList()") List status) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); @@ -58,7 +58,7 @@ public class PetApiController implements PetApi { } - public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { + public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList()") List tags) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); @@ -93,12 +93,12 @@ public class PetApiController implements PetApi { } - 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status) { + 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", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + 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) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}"); diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Animal.java index 5bc21a6e60b..b9df0761fa2 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Animal.java @@ -22,7 +22,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Capitalization.java index 2f67e3d6ed8..cf8e0184c75 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Capitalization.java @@ -14,22 +14,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Cat.java index b0ee4437409..db751abc2d8 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Cat.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Category.java index ede08450019..ab96fdce16a 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Category.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ClassModel.java index b7c7d9330a0..1a44b03b0bc 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ClassModel.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Client.java index 68e888388b1..cf73d18603d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Client.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Dog.java index 9b877bb8029..59f5507d573 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Dog.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumArrays.java index 562664bc716..1a511c9422c 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumArrays.java @@ -48,7 +48,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumTest.java index 26a8bce4e7c..dcb97236e4b 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/EnumTest.java @@ -49,7 +49,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -85,7 +85,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -119,7 +119,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -153,7 +153,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/FormatTest.java index fb4fde245e3..766d254301e 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/FormatTest.java @@ -19,43 +19,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private Resource binary = null; + private Resource binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index 13a6378b53e..1818546ce32 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; public HasOnlyReadOnly bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MapTest.java index 67a3bfdd866..9909e432f63 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MapTest.java @@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.Valid; import javax.validation.constraints.*; @@ -62,7 +61,8 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + @Valid + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -149,24 +149,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - @Valid - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 9195299efe4..5f4e900364e 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -20,10 +20,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") @Valid diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Model200Response.java index fdbe2056875..6a77de5e22a 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Model200Response.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ModelApiResponse.java index deb0fd9924f..a05b204bece 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -14,13 +14,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ModelReturn.java index 10684b30f81..b21e712510d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ModelReturn.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Name.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Name.java index ba33f48731a..ba9701e1b7d 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Name.java @@ -15,16 +15,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/NumberOnly.java index 158b899847f..275529bafe1 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/NumberOnly.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Order.java index 810b3a67397..af33e77e1ef 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Order.java @@ -16,16 +16,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -61,7 +61,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/OuterComposite.java index c343b0b39ed..f522765ede1 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/OuterComposite.java @@ -15,13 +15,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Pet.java index 9c4f5d894cc..4e99f847257 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Pet.java @@ -19,13 +19,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") @Valid @@ -69,7 +69,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ReadOnlyFirst.java index 321c3bddc68..f0c6b763e9f 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; public ReadOnlyFirst bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/SpecialModelName.java index 14741b1d224..6b445cfa0d9 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/SpecialModelName.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Tag.java index c9655217d9c..d9a99a54704 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/Tag.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/User.java index b1e7e56281a..d934073c84f 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/spring-mvc/src/main/java/org/openapitools/model/User.java @@ -14,28 +14,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiUtil.java index c5f5cc143a1..3ecc0972d94 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiUtil.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/api/ApiUtil.java @@ -8,8 +8,10 @@ import java.io.IOException; public class ApiUtil { public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { try { - req.getNativeResponse(HttpServletResponse.class).addHeader("Content-Type", contentType); - req.getNativeResponse(HttpServletResponse.class).getOutputStream().print(example); + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); } catch (IOException e) { throw new RuntimeException(e); } 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 354f6133919..6605d282465 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 @@ -109,7 +109,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @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 = "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); @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @@ -119,7 +119,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - 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=">, $", defaultValue="$") @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); + ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()") @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 = ">, $", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList()") 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=">, $", defaultValue="$") @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); @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @@ -137,7 +137,7 @@ public interface FakeApi { @RequestMapping(value = "/fake/jsonFormData", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2); + 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); @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @@ -152,6 +152,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", defaultValue="null") @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 detail") @Valid @RequestPart("file") 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 61c00424a18..b7d39d47476 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,12 +41,6 @@ public class FakeApiController implements FakeApi { } public ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -63,23 +57,11 @@ public class FakeApiController implements FakeApi { } public ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } public ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -105,12 +87,12 @@ public class FakeApiController implements FakeApi { } - public ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="callback", required=false) String paramCallback) { + 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) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } - 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=">, $", defaultValue="$") @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) { + public ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()") @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 = ">, $", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList()") 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=">, $", defaultValue="$") @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); } @@ -120,12 +102,12 @@ public class FakeApiController implements FakeApi { } - public ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2) { + 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); } - 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", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + 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) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}"); 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 e7ad9e683bb..83094336b69 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 @@ -68,7 +68,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - 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); + ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList()") List status); @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 = { @@ -83,7 +83,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags); + ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList()") List tags); @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -126,7 +126,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status); + 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); @ApiOperation(value = "uploads an image", nickname = "uploadFile", notes = "", response = ModelApiResponse.class, authorizations = { @@ -141,6 +141,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", defaultValue="null") @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 detail") @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 b01cdf874b3..b71655507f5 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 @@ -43,7 +43,7 @@ public class PetApiController implements PetApi { } - 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) { + public ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList()") List status) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); @@ -58,7 +58,7 @@ public class PetApiController implements PetApi { } - public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { + public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList()") List tags) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); @@ -93,12 +93,12 @@ public class PetApiController implements PetApi { } - 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status) { + 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", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + 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) { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}"); diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Animal.java index 5bc21a6e60b..b9df0761fa2 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Animal.java @@ -22,7 +22,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Capitalization.java index 2f67e3d6ed8..cf8e0184c75 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Capitalization.java @@ -14,22 +14,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Cat.java index b0ee4437409..db751abc2d8 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Cat.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Category.java index ede08450019..ab96fdce16a 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Category.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ClassModel.java index b7c7d9330a0..1a44b03b0bc 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ClassModel.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Client.java index 68e888388b1..cf73d18603d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Client.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Dog.java index 9b877bb8029..59f5507d573 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Dog.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/EnumArrays.java index 562664bc716..1a511c9422c 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/EnumArrays.java @@ -48,7 +48,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/EnumTest.java index 26a8bce4e7c..dcb97236e4b 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/EnumTest.java @@ -49,7 +49,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -85,7 +85,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -119,7 +119,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -153,7 +153,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java index fb4fde245e3..766d254301e 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/FormatTest.java @@ -19,43 +19,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private Resource binary = null; + private Resource binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index 13a6378b53e..1818546ce32 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; public HasOnlyReadOnly bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/MapTest.java index 67a3bfdd866..9909e432f63 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/MapTest.java @@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.Valid; import javax.validation.constraints.*; @@ -62,7 +61,8 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + @Valid + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -149,24 +149,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - @Valid - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 9195299efe4..5f4e900364e 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -20,10 +20,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") @Valid diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Model200Response.java index fdbe2056875..6a77de5e22a 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Model200Response.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ModelApiResponse.java index deb0fd9924f..a05b204bece 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -14,13 +14,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ModelReturn.java index 10684b30f81..b21e712510d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ModelReturn.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Name.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Name.java index ba33f48731a..ba9701e1b7d 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Name.java @@ -15,16 +15,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/NumberOnly.java index 158b899847f..275529bafe1 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/NumberOnly.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Order.java index 810b3a67397..af33e77e1ef 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Order.java @@ -16,16 +16,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -61,7 +61,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OuterComposite.java index c343b0b39ed..f522765ede1 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/OuterComposite.java @@ -15,13 +15,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Pet.java index 9c4f5d894cc..4e99f847257 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Pet.java @@ -19,13 +19,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") @Valid @@ -69,7 +69,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ReadOnlyFirst.java index 321c3bddc68..f0c6b763e9f 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; public ReadOnlyFirst bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/SpecialModelName.java index 14741b1d224..6b445cfa0d9 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/SpecialModelName.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Tag.java index c9655217d9c..d9a99a54704 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/Tag.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/User.java index b1e7e56281a..d934073c84f 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/org/openapitools/model/User.java @@ -14,28 +14,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/resources/application.properties b/samples/server/petstore/springboot-beanvalidation/src/main/resources/application.properties index 13b0dc6ab96..ceca4a9e0d0 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/resources/application.properties +++ b/samples/server/petstore/springboot-beanvalidation/src/main/resources/application.properties @@ -1,4 +1,4 @@ springfox.documentation.swagger.v2.path=/api-docs server.port=80 spring.jackson.date-format=org.openapitools.RFC3339DateFormat -spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false 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 4db33947735..597b34a8c3a 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 @@ -26,7 +26,7 @@ public interface AnotherFakeApiDelegate { /** * @see AnotherFakeApi#call123testSpecialTags */ - default ResponseEntity call123testSpecialTags( Client client) { + default ResponseEntity call123testSpecialTags(Client client) { 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-delegate-j8/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/ApiUtil.java index c5f5cc143a1..3ecc0972d94 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/ApiUtil.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/api/ApiUtil.java @@ -8,8 +8,10 @@ import java.io.IOException; public class ApiUtil { public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { try { - req.getNativeResponse(HttpServletResponse.class).addHeader("Content-Type", contentType); - req.getNativeResponse(HttpServletResponse.class).getOutputStream().print(example); + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); } catch (IOException e) { throw new RuntimeException(e); } 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 b783da7b56b..52cac558634 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 @@ -127,7 +127,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @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 = "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) { return getDelegate().testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } @@ -139,7 +139,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default 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=">, $", defaultValue="$") @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) { + default ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<>()") @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 = ">, $", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList<>()") 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=">, $", defaultValue="$") @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 getDelegate().testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString); } @@ -161,7 +161,7 @@ public interface FakeApi { @RequestMapping(value = "/fake/jsonFormData", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2) { + default 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 getDelegate().testJsonFormData(param, param2); } @@ -178,7 +178,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", defaultValue="null") @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 detail") @Valid @RequestPart("file") 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 6dfe4160b17..9adde87bc49 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 @@ -35,15 +35,7 @@ public interface FakeApiDelegate { /** * @see FakeApi#fakeOuterBooleanSerialize */ - default ResponseEntity fakeOuterBooleanSerialize( Boolean body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); + default ResponseEntity fakeOuterBooleanSerialize(Boolean body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -51,7 +43,7 @@ public interface FakeApiDelegate { /** * @see FakeApi#fakeOuterCompositeSerialize */ - default ResponseEntity fakeOuterCompositeSerialize( OuterComposite outerComposite) { + default ResponseEntity fakeOuterCompositeSerialize(OuterComposite outerComposite) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { @@ -67,15 +59,7 @@ public interface FakeApiDelegate { /** * @see FakeApi#fakeOuterNumberSerialize */ - default ResponseEntity fakeOuterNumberSerialize( BigDecimal body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); + default ResponseEntity fakeOuterNumberSerialize(BigDecimal body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -83,15 +67,7 @@ public interface FakeApiDelegate { /** * @see FakeApi#fakeOuterStringSerialize */ - default ResponseEntity fakeOuterStringSerialize( String body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); + default ResponseEntity fakeOuterStringSerialize(String body) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -99,7 +75,7 @@ public interface FakeApiDelegate { /** * @see FakeApi#testBodyWithFileSchema */ - default ResponseEntity testBodyWithFileSchema( FileSchemaTestClass fileSchemaTestClass) { + default ResponseEntity testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -107,8 +83,8 @@ public interface FakeApiDelegate { /** * @see FakeApi#testBodyWithQueryParams */ - default ResponseEntity testBodyWithQueryParams( String query, - User user) { + default ResponseEntity testBodyWithQueryParams(String query, + User user) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -116,7 +92,7 @@ public interface FakeApiDelegate { /** * @see FakeApi#testClientModel */ - default ResponseEntity testClientModel( Client client) { + default ResponseEntity testClientModel(Client client) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -132,20 +108,20 @@ public interface FakeApiDelegate { /** * @see FakeApi#testEndpointParameters */ - default ResponseEntity testEndpointParameters( BigDecimal number, - Double _double, - String patternWithoutDelimiter, - byte[] _byte, - Integer integer, - Integer int32, - Long int64, - Float _float, - String string, + default ResponseEntity testEndpointParameters(BigDecimal number, + Double _double, + String patternWithoutDelimiter, + byte[] _byte, + Integer integer, + Integer int32, + Long int64, + Float _float, + String string, MultipartFile binary, - LocalDate date, - OffsetDateTime dateTime, - String password, - String paramCallback) { + LocalDate date, + OffsetDateTime dateTime, + String password, + String paramCallback) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -153,14 +129,14 @@ public interface FakeApiDelegate { /** * @see FakeApi#testEnumParameters */ - default ResponseEntity testEnumParameters( List enumHeaderStringArray, - String enumHeaderString, - List enumQueryStringArray, - String enumQueryString, - Integer enumQueryInteger, - Double enumQueryDouble, - List enumFormStringArray, - String enumFormString) { + default ResponseEntity testEnumParameters(List enumHeaderStringArray, + String enumHeaderString, + List enumQueryStringArray, + String enumQueryString, + Integer enumQueryInteger, + Double enumQueryDouble, + List enumFormStringArray, + String enumFormString) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -168,7 +144,7 @@ public interface FakeApiDelegate { /** * @see FakeApi#testInlineAdditionalProperties */ - default ResponseEntity testInlineAdditionalProperties( Map requestBody) { + default ResponseEntity testInlineAdditionalProperties(Map requestBody) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -176,8 +152,8 @@ public interface FakeApiDelegate { /** * @see FakeApi#testJsonFormData */ - default ResponseEntity testJsonFormData( String param, - String param2) { + default ResponseEntity testJsonFormData(String param, + String param2) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -185,9 +161,9 @@ public interface FakeApiDelegate { /** * @see FakeApi#uploadFileWithRequiredFile */ - default ResponseEntity uploadFileWithRequiredFile( Long petId, + default ResponseEntity uploadFileWithRequiredFile(Long petId, MultipartFile requiredFile, - String additionalMetadata) { + 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-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 6cd8c3eb203..e94d222a6c7 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 @@ -26,7 +26,7 @@ public interface FakeClassnameTestApiDelegate { /** * @see FakeClassnameTestApi#testClassname */ - default ResponseEntity testClassname( Client client) { + default ResponseEntity testClassname(Client client) { 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-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 74c0c8d1705..b2481031328 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 @@ -76,7 +76,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default 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) { + default ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList<>()") List status) { return getDelegate().findPetsByStatus(status); } @@ -93,7 +93,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { + default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList<>()") List tags) { return getDelegate().findPetsByTags(tags); } @@ -142,7 +142,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status) { + default 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 getDelegate().updatePetWithForm(petId, name, status); } @@ -159,7 +159,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", defaultValue="null") @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 detail") @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 88a778effd8..65c95bf1c1e 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 @@ -28,7 +28,7 @@ public interface PetApiDelegate { /** * @see PetApi#addPet */ - default ResponseEntity addPet( Pet pet) { + default ResponseEntity addPet(Pet pet) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -36,8 +36,8 @@ public interface PetApiDelegate { /** * @see PetApi#deletePet */ - default ResponseEntity deletePet( Long petId, - String apiKey) { + default ResponseEntity deletePet(Long petId, + String apiKey) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -45,7 +45,7 @@ public interface PetApiDelegate { /** * @see PetApi#findPetsByStatus */ - default ResponseEntity> findPetsByStatus( List status) { + default ResponseEntity> findPetsByStatus(List status) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -65,7 +65,7 @@ public interface PetApiDelegate { /** * @see PetApi#findPetsByTags */ - default ResponseEntity> findPetsByTags( List tags) { + default ResponseEntity> findPetsByTags(List tags) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -85,7 +85,7 @@ public interface PetApiDelegate { /** * @see PetApi#getPetById */ - default ResponseEntity getPetById( Long petId) { + default ResponseEntity getPetById(Long petId) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -105,7 +105,7 @@ public interface PetApiDelegate { /** * @see PetApi#updatePet */ - default ResponseEntity updatePet( Pet pet) { + default ResponseEntity updatePet(Pet pet) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -113,9 +113,9 @@ public interface PetApiDelegate { /** * @see PetApi#updatePetWithForm */ - default ResponseEntity updatePetWithForm( Long petId, - String name, - String status) { + default ResponseEntity updatePetWithForm(Long petId, + String name, + String status) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -123,8 +123,8 @@ public interface PetApiDelegate { /** * @see PetApi#uploadFile */ - default ResponseEntity uploadFile( Long petId, - String additionalMetadata, + default ResponseEntity uploadFile(Long petId, + String additionalMetadata, MultipartFile file) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { 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 c0a27ceb4ef..85a55dfcbda 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 @@ -27,7 +27,7 @@ public interface StoreApiDelegate { /** * @see StoreApi#deleteOrder */ - default ResponseEntity deleteOrder( String orderId) { + default ResponseEntity deleteOrder(String orderId) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -43,7 +43,7 @@ public interface StoreApiDelegate { /** * @see StoreApi#getOrderById */ - default ResponseEntity getOrderById( Long orderId) { + default ResponseEntity getOrderById(Long orderId) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -63,7 +63,7 @@ public interface StoreApiDelegate { /** * @see StoreApi#placeOrder */ - default ResponseEntity placeOrder( Order order) { + default ResponseEntity placeOrder(Order order) { 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-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 1920c36711a..aaf9227ee56 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 @@ -27,7 +27,7 @@ public interface UserApiDelegate { /** * @see UserApi#createUser */ - default ResponseEntity createUser( User user) { + default ResponseEntity createUser(User user) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -35,7 +35,7 @@ public interface UserApiDelegate { /** * @see UserApi#createUsersWithArrayInput */ - default ResponseEntity createUsersWithArrayInput( List user) { + default ResponseEntity createUsersWithArrayInput(List user) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -43,7 +43,7 @@ public interface UserApiDelegate { /** * @see UserApi#createUsersWithListInput */ - default ResponseEntity createUsersWithListInput( List user) { + default ResponseEntity createUsersWithListInput(List user) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -51,7 +51,7 @@ public interface UserApiDelegate { /** * @see UserApi#deleteUser */ - default ResponseEntity deleteUser( String username) { + default ResponseEntity deleteUser(String username) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -59,7 +59,7 @@ public interface UserApiDelegate { /** * @see UserApi#getUserByName */ - default ResponseEntity getUserByName( String username) { + default ResponseEntity getUserByName(String username) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -79,8 +79,8 @@ public interface UserApiDelegate { /** * @see UserApi#loginUser */ - default ResponseEntity loginUser( String username, - String password) { + default ResponseEntity loginUser(String username, + String password) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -96,8 +96,8 @@ public interface UserApiDelegate { /** * @see UserApi#updateUser */ - default ResponseEntity updateUser( String username, - User user) { + default ResponseEntity updateUser(String username, + User user) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Animal.java index 5bc21a6e60b..b9df0761fa2 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Animal.java @@ -22,7 +22,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Capitalization.java index 2f67e3d6ed8..cf8e0184c75 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Capitalization.java @@ -14,22 +14,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Cat.java index b0ee4437409..db751abc2d8 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Cat.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Category.java index ede08450019..ab96fdce16a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Category.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ClassModel.java index b7c7d9330a0..1a44b03b0bc 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ClassModel.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Client.java index 68e888388b1..cf73d18603d 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Client.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Dog.java index 9b877bb8029..59f5507d573 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Dog.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/EnumArrays.java index 7c15608894d..1bf86d35fa3 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/EnumArrays.java @@ -48,7 +48,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/EnumTest.java index 26a8bce4e7c..dcb97236e4b 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/EnumTest.java @@ -49,7 +49,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -85,7 +85,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -119,7 +119,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -153,7 +153,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java index 31638e0ed66..6b1af9b08be 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/FormatTest.java @@ -19,43 +19,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private Resource binary = null; + private Resource binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index 13a6378b53e..1818546ce32 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; public HasOnlyReadOnly bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/MapTest.java index a6acaa59d1a..93a2b1e7b22 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/MapTest.java @@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.Valid; import javax.validation.constraints.*; @@ -62,7 +61,8 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + @Valid + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -149,24 +149,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - @Valid - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 452da256d01..5f1212179a3 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -20,10 +20,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") @Valid diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Model200Response.java index fdbe2056875..6a77de5e22a 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Model200Response.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ModelApiResponse.java index deb0fd9924f..a05b204bece 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -14,13 +14,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ModelReturn.java index 10684b30f81..b21e712510d 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ModelReturn.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Name.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Name.java index ba33f48731a..ba9701e1b7d 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Name.java @@ -15,16 +15,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/NumberOnly.java index 158b899847f..275529bafe1 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/NumberOnly.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Order.java index 946ce8f756d..0a09f15f309 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Order.java @@ -16,16 +16,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -61,7 +61,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OuterComposite.java index c343b0b39ed..f522765ede1 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/OuterComposite.java @@ -15,13 +15,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Pet.java index 502146abefc..d3bca13a64b 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Pet.java @@ -19,13 +19,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") @Valid @@ -69,7 +69,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ReadOnlyFirst.java index 321c3bddc68..f0c6b763e9f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; public ReadOnlyFirst bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/SpecialModelName.java index 14741b1d224..6b445cfa0d9 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/SpecialModelName.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Tag.java index c9655217d9c..d9a99a54704 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/Tag.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/User.java index b1e7e56281a..d934073c84f 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/org/openapitools/model/User.java @@ -14,28 +14,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/resources/application.properties b/samples/server/petstore/springboot-delegate-j8/src/main/resources/application.properties index 13b0dc6ab96..ceca4a9e0d0 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/resources/application.properties +++ b/samples/server/petstore/springboot-delegate-j8/src/main/resources/application.properties @@ -1,4 +1,4 @@ springfox.documentation.swagger.v2.path=/api-docs server.port=80 spring.jackson.date-format=org.openapitools.RFC3339DateFormat -spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false 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 569d1299b99..0e835519fc6 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 @@ -18,6 +18,6 @@ public interface AnotherFakeApiDelegate { /** * @see AnotherFakeApi#call123testSpecialTags */ - ResponseEntity call123testSpecialTags( Client client); + ResponseEntity call123testSpecialTags(Client client); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiUtil.java index c5f5cc143a1..3ecc0972d94 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiUtil.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/api/ApiUtil.java @@ -8,8 +8,10 @@ import java.io.IOException; public class ApiUtil { public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { try { - req.getNativeResponse(HttpServletResponse.class).addHeader("Content-Type", contentType); - req.getNativeResponse(HttpServletResponse.class).getOutputStream().print(example); + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); } catch (IOException e) { throw new RuntimeException(e); } 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 354f6133919..6605d282465 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 @@ -109,7 +109,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @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 = "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); @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) @@ -119,7 +119,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - 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=">, $", defaultValue="$") @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); + ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()") @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 = ">, $", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList()") 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=">, $", defaultValue="$") @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); @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) @@ -137,7 +137,7 @@ public interface FakeApi { @RequestMapping(value = "/fake/jsonFormData", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2); + 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); @ApiOperation(value = "uploads an image (required)", nickname = "uploadFileWithRequiredFile", notes = "", response = ModelApiResponse.class, authorizations = { @@ -152,6 +152,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", defaultValue="null") @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 detail") @Valid @RequestPart("file") 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 55116d6a765..8bdad30ceb5 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 @@ -66,11 +66,11 @@ public class FakeApiController implements FakeApi { return delegate.testClientModel(client); } - public ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="callback", required=false) String paramCallback) { + 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) { return delegate.testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback); } - 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=">, $", defaultValue="$") @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) { + public ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList()") @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 = ">, $", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList()") 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=">, $", defaultValue="$") @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); } @@ -78,11 +78,11 @@ public class FakeApiController implements FakeApi { return delegate.testInlineAdditionalProperties(requestBody); } - public ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2) { + 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); } - 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", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata) { + 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) { 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 48963d95265..0d6eb018765 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 @@ -27,85 +27,85 @@ public interface FakeApiDelegate { /** * @see FakeApi#fakeOuterBooleanSerialize */ - ResponseEntity fakeOuterBooleanSerialize( Boolean body); + ResponseEntity fakeOuterBooleanSerialize(Boolean body); /** * @see FakeApi#fakeOuterCompositeSerialize */ - ResponseEntity fakeOuterCompositeSerialize( OuterComposite outerComposite); + ResponseEntity fakeOuterCompositeSerialize(OuterComposite outerComposite); /** * @see FakeApi#fakeOuterNumberSerialize */ - ResponseEntity fakeOuterNumberSerialize( BigDecimal body); + ResponseEntity fakeOuterNumberSerialize(BigDecimal body); /** * @see FakeApi#fakeOuterStringSerialize */ - ResponseEntity fakeOuterStringSerialize( String body); + ResponseEntity fakeOuterStringSerialize(String body); /** * @see FakeApi#testBodyWithFileSchema */ - ResponseEntity testBodyWithFileSchema( FileSchemaTestClass fileSchemaTestClass); + ResponseEntity testBodyWithFileSchema(FileSchemaTestClass fileSchemaTestClass); /** * @see FakeApi#testBodyWithQueryParams */ - ResponseEntity testBodyWithQueryParams( String query, - User user); + ResponseEntity testBodyWithQueryParams(String query, + User user); /** * @see FakeApi#testClientModel */ - ResponseEntity testClientModel( Client client); + ResponseEntity testClientModel(Client client); /** * @see FakeApi#testEndpointParameters */ - ResponseEntity testEndpointParameters( BigDecimal number, - Double _double, - String patternWithoutDelimiter, - byte[] _byte, - Integer integer, - Integer int32, - Long int64, - Float _float, - String string, + ResponseEntity testEndpointParameters(BigDecimal number, + Double _double, + String patternWithoutDelimiter, + byte[] _byte, + Integer integer, + Integer int32, + Long int64, + Float _float, + String string, MultipartFile binary, - LocalDate date, - OffsetDateTime dateTime, - String password, - String paramCallback); + LocalDate date, + OffsetDateTime dateTime, + String password, + String paramCallback); /** * @see FakeApi#testEnumParameters */ - ResponseEntity testEnumParameters( List enumHeaderStringArray, - String enumHeaderString, - List enumQueryStringArray, - String enumQueryString, - Integer enumQueryInteger, - Double enumQueryDouble, - List enumFormStringArray, - String enumFormString); + ResponseEntity testEnumParameters(List enumHeaderStringArray, + String enumHeaderString, + List enumQueryStringArray, + String enumQueryString, + Integer enumQueryInteger, + Double enumQueryDouble, + List enumFormStringArray, + String enumFormString); /** * @see FakeApi#testInlineAdditionalProperties */ - ResponseEntity testInlineAdditionalProperties( Map requestBody); + ResponseEntity testInlineAdditionalProperties(Map requestBody); /** * @see FakeApi#testJsonFormData */ - ResponseEntity testJsonFormData( String param, - String param2); + ResponseEntity testJsonFormData(String param, + String param2); /** * @see FakeApi#uploadFileWithRequiredFile */ - ResponseEntity uploadFileWithRequiredFile( Long petId, + ResponseEntity uploadFileWithRequiredFile(Long petId, MultipartFile requiredFile, - String additionalMetadata); + String additionalMetadata); } 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 c81f614a811..c0d42c3a3e7 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 @@ -18,6 +18,6 @@ public interface FakeClassnameTestApiDelegate { /** * @see FakeClassnameTestApi#testClassname */ - ResponseEntity testClassname( Client client); + ResponseEntity testClassname(Client client); } 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 e7ad9e683bb..83094336b69 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 @@ -68,7 +68,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - 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); + ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList()") List status); @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 = { @@ -83,7 +83,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags); + ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList()") List tags); @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -126,7 +126,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status); + 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); @ApiOperation(value = "uploads an image", nickname = "uploadFile", notes = "", response = ModelApiResponse.class, authorizations = { @@ -141,6 +141,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", defaultValue="null") @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 detail") @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 4e56a593144..a721a03d78d 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 @@ -39,11 +39,11 @@ public class PetApiController implements PetApi { return delegate.deletePet(petId, apiKey); } - 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) { + public ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList()") List status) { return delegate.findPetsByStatus(status); } - public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { + public ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList()") List tags) { return delegate.findPetsByTags(tags); } @@ -55,11 +55,11 @@ public class PetApiController implements PetApi { return delegate.updatePet(pet); } - 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status) { + 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", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + 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) { 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 13f6acf44c7..bae746c1414 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 @@ -20,46 +20,46 @@ public interface PetApiDelegate { /** * @see PetApi#addPet */ - ResponseEntity addPet( Pet pet); + ResponseEntity addPet(Pet pet); /** * @see PetApi#deletePet */ - ResponseEntity deletePet( Long petId, - String apiKey); + ResponseEntity deletePet(Long petId, + String apiKey); /** * @see PetApi#findPetsByStatus */ - ResponseEntity> findPetsByStatus( List status); + ResponseEntity> findPetsByStatus(List status); /** * @see PetApi#findPetsByTags */ - ResponseEntity> findPetsByTags( List tags); + ResponseEntity> findPetsByTags(List tags); /** * @see PetApi#getPetById */ - ResponseEntity getPetById( Long petId); + ResponseEntity getPetById(Long petId); /** * @see PetApi#updatePet */ - ResponseEntity updatePet( Pet pet); + ResponseEntity updatePet(Pet pet); /** * @see PetApi#updatePetWithForm */ - ResponseEntity updatePetWithForm( Long petId, - String name, - String status); + ResponseEntity updatePetWithForm(Long petId, + String name, + String status); /** * @see PetApi#uploadFile */ - ResponseEntity uploadFile( Long petId, - String additionalMetadata, + ResponseEntity uploadFile(Long petId, + String additionalMetadata, MultipartFile file); } 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 1967f371327..6fa60ee6c17 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 @@ -19,7 +19,7 @@ public interface StoreApiDelegate { /** * @see StoreApi#deleteOrder */ - ResponseEntity deleteOrder( String orderId); + ResponseEntity deleteOrder(String orderId); /** * @see StoreApi#getInventory @@ -29,11 +29,11 @@ public interface StoreApiDelegate { /** * @see StoreApi#getOrderById */ - ResponseEntity getOrderById( Long orderId); + ResponseEntity getOrderById(Long orderId); /** * @see StoreApi#placeOrder */ - ResponseEntity placeOrder( Order order); + ResponseEntity placeOrder(Order order); } 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 1aefe4ec201..70404052360 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 @@ -19,33 +19,33 @@ public interface UserApiDelegate { /** * @see UserApi#createUser */ - ResponseEntity createUser( User user); + ResponseEntity createUser(User user); /** * @see UserApi#createUsersWithArrayInput */ - ResponseEntity createUsersWithArrayInput( List user); + ResponseEntity createUsersWithArrayInput(List user); /** * @see UserApi#createUsersWithListInput */ - ResponseEntity createUsersWithListInput( List user); + ResponseEntity createUsersWithListInput(List user); /** * @see UserApi#deleteUser */ - ResponseEntity deleteUser( String username); + ResponseEntity deleteUser(String username); /** * @see UserApi#getUserByName */ - ResponseEntity getUserByName( String username); + ResponseEntity getUserByName(String username); /** * @see UserApi#loginUser */ - ResponseEntity loginUser( String username, - String password); + ResponseEntity loginUser(String username, + String password); /** * @see UserApi#logoutUser @@ -55,7 +55,7 @@ public interface UserApiDelegate { /** * @see UserApi#updateUser */ - ResponseEntity updateUser( String username, - User user); + ResponseEntity updateUser(String username, + User user); } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Animal.java index 5bc21a6e60b..b9df0761fa2 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Animal.java @@ -22,7 +22,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Capitalization.java index 2f67e3d6ed8..cf8e0184c75 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Capitalization.java @@ -14,22 +14,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java index b0ee4437409..db751abc2d8 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Cat.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Category.java index ede08450019..ab96fdce16a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Category.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ClassModel.java index b7c7d9330a0..1a44b03b0bc 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ClassModel.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Client.java index 68e888388b1..cf73d18603d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Client.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java index 9b877bb8029..59f5507d573 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Dog.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumArrays.java index 562664bc716..1a511c9422c 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumArrays.java @@ -48,7 +48,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumTest.java index 26a8bce4e7c..dcb97236e4b 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/EnumTest.java @@ -49,7 +49,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -85,7 +85,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -119,7 +119,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -153,7 +153,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java index fb4fde245e3..766d254301e 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/FormatTest.java @@ -19,43 +19,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private Resource binary = null; + private Resource binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index 13a6378b53e..1818546ce32 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; public HasOnlyReadOnly bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MapTest.java index 67a3bfdd866..9909e432f63 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MapTest.java @@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.Valid; import javax.validation.constraints.*; @@ -62,7 +61,8 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + @Valid + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -149,24 +149,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - @Valid - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 9195299efe4..5f4e900364e 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -20,10 +20,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") @Valid diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Model200Response.java index fdbe2056875..6a77de5e22a 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Model200Response.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelApiResponse.java index deb0fd9924f..a05b204bece 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -14,13 +14,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelReturn.java index 10684b30f81..b21e712510d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ModelReturn.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Name.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Name.java index ba33f48731a..ba9701e1b7d 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Name.java @@ -15,16 +15,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NumberOnly.java index 158b899847f..275529bafe1 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/NumberOnly.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java index 810b3a67397..af33e77e1ef 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Order.java @@ -16,16 +16,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -61,7 +61,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OuterComposite.java index c343b0b39ed..f522765ede1 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/OuterComposite.java @@ -15,13 +15,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Pet.java index 9c4f5d894cc..4e99f847257 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Pet.java @@ -19,13 +19,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") @Valid @@ -69,7 +69,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ReadOnlyFirst.java index 321c3bddc68..f0c6b763e9f 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; public ReadOnlyFirst bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/SpecialModelName.java index 14741b1d224..6b445cfa0d9 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/SpecialModelName.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Tag.java index c9655217d9c..d9a99a54704 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Tag.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/User.java index b1e7e56281a..d934073c84f 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/User.java @@ -14,28 +14,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-delegate/src/main/resources/application.properties b/samples/server/petstore/springboot-delegate/src/main/resources/application.properties index 13b0dc6ab96..ceca4a9e0d0 100644 --- a/samples/server/petstore/springboot-delegate/src/main/resources/application.properties +++ b/samples/server/petstore/springboot-delegate/src/main/resources/application.properties @@ -1,4 +1,4 @@ springfox.documentation.swagger.v2.path=/api-docs server.port=80 spring.jackson.date-format=org.openapitools.RFC3339DateFormat -spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiUtil.java index c5f5cc143a1..3ecc0972d94 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiUtil.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/ApiUtil.java @@ -8,8 +8,10 @@ import java.io.IOException; public class ApiUtil { public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { try { - req.getNativeResponse(HttpServletResponse.class).addHeader("Content-Type", contentType); - req.getNativeResponse(HttpServletResponse.class).getOutputStream().print(example); + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); } catch (IOException e) { throw new RuntimeException(e); } 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 4edf55f3032..66fa4cd9bcd 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 @@ -53,14 +53,6 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -97,14 +89,6 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -119,14 +103,6 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -194,7 +170,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @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 = "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) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -211,7 +187,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default ResponseEntity testEnumParameters(@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=">, $", defaultValue="$") @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) { + default ResponseEntity testEnumParameters(@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList<>()") 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=">, $", defaultValue="$") @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); } @@ -239,7 +215,7 @@ public interface FakeApi { @RequestMapping(value = "/fake/jsonFormData", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2) { + default 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); } @@ -259,7 +235,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", defaultValue="null") @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 detail") @Valid @RequestPart("file") 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/PetApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/api/PetApi.java index e5ba5584010..c73ab0ebc74 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 @@ -89,7 +89,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default 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) { + default ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList<>()") List status) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -121,7 +121,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { + default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList<>()") List tags) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -203,7 +203,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status) { + default 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); } @@ -223,7 +223,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", defaultValue="null") @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 detail") @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/model/Animal.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Animal.java index 5bc21a6e60b..b9df0761fa2 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Animal.java @@ -22,7 +22,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Capitalization.java index 2f67e3d6ed8..cf8e0184c75 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Capitalization.java @@ -14,22 +14,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java index b0ee4437409..db751abc2d8 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Cat.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Category.java index ede08450019..ab96fdce16a 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Category.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ClassModel.java index b7c7d9330a0..1a44b03b0bc 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ClassModel.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Client.java index 68e888388b1..cf73d18603d 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Client.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java index 9b877bb8029..59f5507d573 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Dog.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/EnumArrays.java index 7c15608894d..1bf86d35fa3 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/EnumArrays.java @@ -48,7 +48,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/EnumTest.java index 26a8bce4e7c..dcb97236e4b 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/EnumTest.java @@ -49,7 +49,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -85,7 +85,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -119,7 +119,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -153,7 +153,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java index 31638e0ed66..6b1af9b08be 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/FormatTest.java @@ -19,43 +19,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private Resource binary = null; + private Resource binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index 13a6378b53e..1818546ce32 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; public HasOnlyReadOnly bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/MapTest.java index a6acaa59d1a..93a2b1e7b22 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/MapTest.java @@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.Valid; import javax.validation.constraints.*; @@ -62,7 +61,8 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + @Valid + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -149,24 +149,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - @Valid - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 452da256d01..5f1212179a3 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -20,10 +20,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") @Valid diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Model200Response.java index fdbe2056875..6a77de5e22a 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Model200Response.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ModelApiResponse.java index deb0fd9924f..a05b204bece 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -14,13 +14,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ModelReturn.java index 10684b30f81..b21e712510d 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ModelReturn.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Name.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Name.java index ba33f48731a..ba9701e1b7d 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Name.java @@ -15,16 +15,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NumberOnly.java index 158b899847f..275529bafe1 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/NumberOnly.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Order.java index 946ce8f756d..0a09f15f309 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Order.java @@ -16,16 +16,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -61,7 +61,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OuterComposite.java index c343b0b39ed..f522765ede1 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/OuterComposite.java @@ -15,13 +15,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Pet.java index 502146abefc..d3bca13a64b 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Pet.java @@ -19,13 +19,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") @Valid @@ -69,7 +69,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ReadOnlyFirst.java index 321c3bddc68..f0c6b763e9f 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; public ReadOnlyFirst bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/SpecialModelName.java index 14741b1d224..6b445cfa0d9 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/SpecialModelName.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Tag.java index c9655217d9c..d9a99a54704 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Tag.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/User.java index b1e7e56281a..d934073c84f 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/User.java @@ -14,28 +14,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/resources/application.properties b/samples/server/petstore/springboot-implicitHeaders/src/main/resources/application.properties index 13b0dc6ab96..ceca4a9e0d0 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/resources/application.properties +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/resources/application.properties @@ -1,4 +1,4 @@ springfox.documentation.swagger.v2.path=/api-docs server.port=80 spring.jackson.date-format=org.openapitools.RFC3339DateFormat -spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false 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 6f607601a7a..cd52147fa57 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 @@ -7,8 +7,6 @@ package org.openapitools.api; import org.openapitools.model.Client; import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PathVariable; @@ -27,12 +25,15 @@ import javax.validation.Valid; import javax.validation.constraints.*; import java.util.List; import java.util.Map; -import java.util.Optional; @Validated @Api(value = "another-fake", description = "the another-fake API") public interface AnotherFakeApi { + default AnotherFakeApiDelegate getDelegate() { + return new AnotherFakeApiDelegate() {}; + } + @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) }) @@ -40,17 +41,8 @@ public interface AnotherFakeApi { produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - default ResponseEntity> call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Mono client, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"client\" : \"client\"}") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(client.then(result)); - + default Mono> call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Mono client, ServerWebExchange exchange) { + return getDelegate().call123testSpecialTags(client, exchange); } } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiController.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiController.java index 997ef4798bb..3bc2df15df6 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiController.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiController.java @@ -2,11 +2,21 @@ package org.openapitools.api; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.request.NativeWebRequest; import java.util.Optional; @Controller @RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") public class AnotherFakeApiController implements AnotherFakeApi { + private final AnotherFakeApiDelegate delegate; + + public AnotherFakeApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) AnotherFakeApiDelegate delegate) { + this.delegate = Optional.ofNullable(delegate).orElse(new AnotherFakeApiDelegate() {}); + } + + @Override + public AnotherFakeApiDelegate getDelegate() { + return delegate; + } + } 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 new file mode 100644 index 00000000000..ddc7c2a0e8f --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/AnotherFakeApiDelegate.java @@ -0,0 +1,46 @@ +package org.openapitools.api; + +import org.openapitools.model.Client; +import io.swagger.annotations.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * A delegate to be called by the {@link AnotherFakeApiController}}. + * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. + */ + +public interface AnotherFakeApiDelegate { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * @see AnotherFakeApi#call123testSpecialTags + */ + default Mono> call123testSpecialTags(Mono client, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + result = ApiUtil.getExampleResponse(exchange, "{ \"client\" : \"client\"}"); + break; + } + } + return result.then(Mono.empty()); + + } + +} 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 8a6f941d19b..bb46f8aef8c 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 @@ -16,8 +16,6 @@ import org.openapitools.model.OuterComposite; import org.springframework.core.io.Resource; import org.openapitools.model.User; import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PathVariable; @@ -36,29 +34,23 @@ import javax.validation.Valid; import javax.validation.constraints.*; import java.util.List; import java.util.Map; -import java.util.Optional; @Validated @Api(value = "fake", description = "the fake API") public interface FakeApi { + default FakeApiDelegate getDelegate() { + return new FakeApiDelegate() {}; + } + @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) }) @RequestMapping(value = "/fake/outer/boolean", produces = { "*/*" }, method = RequestMethod.POST) - default ResponseEntity> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Mono body, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - result = ApiUtil.getExampleResponse(exchange, "null") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(body.then(result)); - + default Mono> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Mono body, ServerWebExchange exchange) { + return getDelegate().fakeOuterBooleanSerialize(body, exchange); } @@ -68,17 +60,8 @@ public interface FakeApi { @RequestMapping(value = "/fake/outer/composite", produces = { "*/*" }, method = RequestMethod.POST) - default ResponseEntity> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody Mono outerComposite, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"my_string\" : \"my_string\", \"my_number\" : 0.80082819046101150206595775671303272247314453125, \"my_boolean\" : true}") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(outerComposite.then(result)); - + default Mono> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody Mono outerComposite, ServerWebExchange exchange) { + return getDelegate().fakeOuterCompositeSerialize(outerComposite, exchange); } @@ -88,17 +71,8 @@ public interface FakeApi { @RequestMapping(value = "/fake/outer/number", produces = { "*/*" }, method = RequestMethod.POST) - default ResponseEntity> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody Mono body, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - result = ApiUtil.getExampleResponse(exchange, "null") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(body.then(result)); - + default Mono> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody Mono body, ServerWebExchange exchange) { + return getDelegate().fakeOuterNumberSerialize(body, exchange); } @@ -108,17 +82,8 @@ public interface FakeApi { @RequestMapping(value = "/fake/outer/string", produces = { "*/*" }, method = RequestMethod.POST) - default ResponseEntity> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody Mono body, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - result = ApiUtil.getExampleResponse(exchange, "null") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(body.then(result)); - + default Mono> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody Mono body, ServerWebExchange exchange) { + return getDelegate().fakeOuterStringSerialize(body, exchange); } @@ -128,10 +93,8 @@ public interface FakeApi { @RequestMapping(value = "/fake/body-with-file-schema", consumes = { "application/json" }, method = RequestMethod.PUT) - default ResponseEntity> testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody Mono fileSchemaTestClass, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(fileSchemaTestClass.then(result)); - + default Mono> testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody Mono fileSchemaTestClass, ServerWebExchange exchange) { + return getDelegate().testBodyWithFileSchema(fileSchemaTestClass, exchange); } @@ -141,10 +104,8 @@ public interface FakeApi { @RequestMapping(value = "/fake/body-with-query-params", consumes = { "application/json" }, method = RequestMethod.PUT) - default ResponseEntity> testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody Mono user, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(user.then(result)); - + default Mono> testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody Mono user, ServerWebExchange exchange) { + return getDelegate().testBodyWithQueryParams(query, user, exchange); } @@ -155,17 +116,8 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - default ResponseEntity> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Mono client, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"client\" : \"client\"}") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(client.then(result)); - + default Mono> testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Mono client, ServerWebExchange exchange) { + return getDelegate().testClientModel(client, exchange); } @@ -178,10 +130,8 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity> testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="callback", required=false) String paramCallback, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + 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) { + return getDelegate().testEndpointParameters(number, _double, patternWithoutDelimiter, _byte, integer, int32, int64, _float, string, binary, date, dateTime, password, paramCallback, exchange); } @@ -192,10 +142,8 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default 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=">, $", defaultValue="$") @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, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono> testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<>()") @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 = ">, $", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList<>()") 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=">, $", defaultValue="$") @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, ServerWebExchange exchange) { + return getDelegate().testEnumParameters(enumHeaderStringArray, enumHeaderString, enumQueryStringArray, enumQueryString, enumQueryInteger, enumQueryDouble, enumFormStringArray, enumFormString, exchange); } @@ -205,10 +153,8 @@ public interface FakeApi { @RequestMapping(value = "/fake/inline-additionalProperties", consumes = { "application/json" }, method = RequestMethod.POST) - default ResponseEntity> testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Mono requestBody, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(requestBody.then(result)); - + default Mono> testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Mono requestBody, ServerWebExchange exchange) { + return getDelegate().testInlineAdditionalProperties(requestBody, exchange); } @@ -218,10 +164,8 @@ public interface FakeApi { @RequestMapping(value = "/fake/jsonFormData", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default ResponseEntity> testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono> 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, ServerWebExchange exchange) { + return getDelegate().testJsonFormData(param, param2, exchange); } @@ -237,17 +181,8 @@ 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", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + 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) { + return getDelegate().uploadFileWithRequiredFile(petId, requiredFile, additionalMetadata, exchange); } } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiController.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiController.java index 9d4b5917508..75c4b5587be 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiController.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiController.java @@ -2,11 +2,21 @@ package org.openapitools.api; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.request.NativeWebRequest; import java.util.Optional; @Controller @RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") public class FakeApiController implements FakeApi { + private final FakeApiDelegate delegate; + + public FakeApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) FakeApiDelegate delegate) { + this.delegate = Optional.ofNullable(delegate).orElse(new FakeApiDelegate() {}); + } + + @Override + public FakeApiDelegate getDelegate() { + return delegate; + } + } 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 new file mode 100644 index 00000000000..10b7912741c --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeApiDelegate.java @@ -0,0 +1,212 @@ +package org.openapitools.api; + +import java.math.BigDecimal; +import org.openapitools.model.Client; +import org.openapitools.model.FileSchemaTestClass; +import java.time.LocalDate; +import java.util.Map; +import org.openapitools.model.ModelApiResponse; +import java.time.OffsetDateTime; +import org.openapitools.model.OuterComposite; +import org.springframework.core.io.Resource; +import org.openapitools.model.User; +import io.swagger.annotations.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * A delegate to be called by the {@link FakeApiController}}. + * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. + */ + +public interface FakeApiDelegate { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * @see FakeApi#fakeOuterBooleanSerialize + */ + default Mono> fakeOuterBooleanSerialize(Mono body, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see FakeApi#fakeOuterCompositeSerialize + */ + default Mono> fakeOuterCompositeSerialize(Mono outerComposite, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { + result = ApiUtil.getExampleResponse(exchange, "{ \"my_string\" : \"my_string\", \"my_number\" : 0.80082819046101150206595775671303272247314453125, \"my_boolean\" : true}"); + break; + } + } + return result.then(Mono.empty()); + + } + + /** + * @see FakeApi#fakeOuterNumberSerialize + */ + default Mono> fakeOuterNumberSerialize(Mono body, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see FakeApi#fakeOuterStringSerialize + */ + default Mono> fakeOuterStringSerialize(Mono body, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see FakeApi#testBodyWithFileSchema + */ + default Mono> testBodyWithFileSchema(Mono fileSchemaTestClass, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see FakeApi#testBodyWithQueryParams + */ + default Mono> testBodyWithQueryParams(String query, + Mono user, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see FakeApi#testClientModel + */ + default Mono> testClientModel(Mono client, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + result = ApiUtil.getExampleResponse(exchange, "{ \"client\" : \"client\"}"); + break; + } + } + return result.then(Mono.empty()); + + } + + /** + * @see FakeApi#testEndpointParameters + */ + default Mono> testEndpointParameters(BigDecimal number, + Double _double, + String patternWithoutDelimiter, + byte[] _byte, + Integer integer, + Integer int32, + Long int64, + Float _float, + String string, + MultipartFile binary, + LocalDate date, + OffsetDateTime dateTime, + String password, + String paramCallback, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see FakeApi#testEnumParameters + */ + default Mono> testEnumParameters(List enumHeaderStringArray, + String enumHeaderString, + List enumQueryStringArray, + String enumQueryString, + Integer enumQueryInteger, + Double enumQueryDouble, + List enumFormStringArray, + String enumFormString, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see FakeApi#testInlineAdditionalProperties + */ + default Mono> testInlineAdditionalProperties(Mono requestBody, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see FakeApi#testJsonFormData + */ + default Mono> testJsonFormData(String param, + String param2, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see FakeApi#uploadFileWithRequiredFile + */ + default Mono> uploadFileWithRequiredFile(Long petId, + MultipartFile requiredFile, + String additionalMetadata, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + result = ApiUtil.getExampleResponse(exchange, "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}"); + break; + } + } + return result.then(Mono.empty()); + + } + +} 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 162b83043e5..fe82590b74d 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 @@ -7,8 +7,6 @@ package org.openapitools.api; import org.openapitools.model.Client; import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PathVariable; @@ -27,12 +25,15 @@ import javax.validation.Valid; import javax.validation.constraints.*; import java.util.List; import java.util.Map; -import java.util.Optional; @Validated @Api(value = "fake_classname_test", description = "the fake_classname_test API") public interface FakeClassnameTestApi { + default FakeClassnameTestApiDelegate getDelegate() { + return new FakeClassnameTestApiDelegate() {}; + } + @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#$%^", }) @@ -42,17 +43,8 @@ public interface FakeClassnameTestApi { produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - default ResponseEntity> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Mono client, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"client\" : \"client\"}") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(client.then(result)); - + default Mono> testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Mono client, ServerWebExchange exchange) { + return getDelegate().testClassname(client, exchange); } } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java index 905d8b60bd7..6566359e66f 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiController.java @@ -2,11 +2,21 @@ package org.openapitools.api; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.request.NativeWebRequest; import java.util.Optional; @Controller @RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") public class FakeClassnameTestApiController implements FakeClassnameTestApi { + private final FakeClassnameTestApiDelegate delegate; + + public FakeClassnameTestApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) FakeClassnameTestApiDelegate delegate) { + this.delegate = Optional.ofNullable(delegate).orElse(new FakeClassnameTestApiDelegate() {}); + } + + @Override + public FakeClassnameTestApiDelegate getDelegate() { + return delegate; + } + } 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 new file mode 100644 index 00000000000..bffd475ef6b --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/FakeClassnameTestApiDelegate.java @@ -0,0 +1,46 @@ +package org.openapitools.api; + +import org.openapitools.model.Client; +import io.swagger.annotations.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * A delegate to be called by the {@link FakeClassnameTestApiController}}. + * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. + */ + +public interface FakeClassnameTestApiDelegate { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * @see FakeClassnameTestApi#testClassname + */ + default Mono> testClassname(Mono client, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + result = ApiUtil.getExampleResponse(exchange, "{ \"client\" : \"client\"}"); + break; + } + } + return result.then(Mono.empty()); + + } + +} 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 ab4a031ef19..a4c058a49ab 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 @@ -9,8 +9,6 @@ import org.openapitools.model.ModelApiResponse; import org.openapitools.model.Pet; import org.springframework.core.io.Resource; import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PathVariable; @@ -29,12 +27,15 @@ import javax.validation.Valid; import javax.validation.constraints.*; import java.util.List; import java.util.Map; -import java.util.Optional; @Validated @Api(value = "pet", description = "the pet API") public interface PetApi { + default PetApiDelegate getDelegate() { + return new PetApiDelegate() {}; + } + @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"), @@ -46,10 +47,8 @@ public interface PetApi { @RequestMapping(value = "/pet", consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - default ResponseEntity> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Mono pet, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(pet.then(result)); - + default Mono> addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Mono pet, ServerWebExchange exchange) { + return getDelegate().addPet(pet, exchange); } @@ -63,10 +62,8 @@ public interface PetApi { @ApiResponse(code = 400, message = "Invalid pet value") }) @RequestMapping(value = "/pet/{petId}", method = RequestMethod.DELETE) - default ResponseEntity> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono> deletePet(@ApiParam(value = "Pet id to delete",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "" ) @RequestHeader(value="api_key", required=false) String apiKey, ServerWebExchange exchange) { + return getDelegate().deletePet(petId, apiKey, exchange); } @@ -82,22 +79,8 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default 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, ServerWebExchange exchange) { - Flux result = Flux.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}") - .thenMany(Mono.empty()); - break; - } - if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - result = ApiUtil.getExampleResponse(exchange, " 123456789 doggie aeiou aeiou") - .thenMany(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono>> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList<>()") List status, ServerWebExchange exchange) { + return getDelegate().findPetsByStatus(status, exchange); } @@ -113,22 +96,8 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags, ServerWebExchange exchange) { - Flux result = Flux.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}") - .thenMany(Mono.empty()); - break; - } - if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - result = ApiUtil.getExampleResponse(exchange, " 123456789 doggie aeiou aeiou") - .thenMany(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono>> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList<>()") List tags, ServerWebExchange exchange) { + return getDelegate().findPetsByTags(tags, exchange); } @@ -142,22 +111,8 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}") - .then(Mono.empty()); - break; - } - if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - result = ApiUtil.getExampleResponse(exchange, " 123456789 doggie aeiou aeiou") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono> getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId, ServerWebExchange exchange) { + return getDelegate().getPetById(petId, exchange); } @@ -174,10 +129,8 @@ public interface PetApi { @RequestMapping(value = "/pet", consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - default ResponseEntity> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Mono pet, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(pet.then(result)); - + default Mono> updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Mono pet, ServerWebExchange exchange) { + return getDelegate().updatePet(pet, exchange); } @@ -192,10 +145,8 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono> 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, ServerWebExchange exchange) { + return getDelegate().updatePetWithForm(petId, name, status, exchange); } @@ -211,17 +162,8 @@ 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", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + 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) { + return getDelegate().uploadFile(petId, additionalMetadata, file, exchange); } } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiController.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiController.java index dba362fde18..a8c8c3765a6 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiController.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiController.java @@ -2,11 +2,21 @@ package org.openapitools.api; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.request.NativeWebRequest; import java.util.Optional; @Controller @RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") public class PetApiController implements PetApi { + private final PetApiDelegate delegate; + + public PetApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) PetApiDelegate delegate) { + this.delegate = Optional.ofNullable(delegate).orElse(new PetApiDelegate() {}); + } + + @Override + public PetApiDelegate getDelegate() { + return delegate; + } + } 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 new file mode 100644 index 00000000000..1084c1bfe49 --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/PetApiDelegate.java @@ -0,0 +1,160 @@ +package org.openapitools.api; + +import org.openapitools.model.ModelApiResponse; +import org.openapitools.model.Pet; +import org.springframework.core.io.Resource; +import io.swagger.annotations.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * A delegate to be called by the {@link PetApiController}}. + * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. + */ + +public interface PetApiDelegate { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * @see PetApi#addPet + */ + default Mono> addPet(Mono pet, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see PetApi#deletePet + */ + default Mono> deletePet(Long petId, + String apiKey, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see PetApi#findPetsByStatus + */ + default Mono>> findPetsByStatus(List status, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { + result = ApiUtil.getExampleResponse(exchange, " 123456789 doggie aeiou aeiou"); + break; + } + } + return result.then(Mono.empty()); + + } + + /** + * @see PetApi#findPetsByTags + */ + default Mono>> findPetsByTags(List tags, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { + result = ApiUtil.getExampleResponse(exchange, " 123456789 doggie aeiou aeiou"); + break; + } + } + return result.then(Mono.empty()); + + } + + /** + * @see PetApi#getPetById + */ + default Mono> getPetById(Long petId, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + result = ApiUtil.getExampleResponse(exchange, "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { + result = ApiUtil.getExampleResponse(exchange, " 123456789 doggie aeiou aeiou"); + break; + } + } + return result.then(Mono.empty()); + + } + + /** + * @see PetApi#updatePet + */ + default Mono> updatePet(Mono pet, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see PetApi#updatePetWithForm + */ + default Mono> updatePetWithForm(Long petId, + String name, + String status, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see PetApi#uploadFile + */ + default Mono> uploadFile(Long petId, + String additionalMetadata, + MultipartFile file, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + result = ApiUtil.getExampleResponse(exchange, "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}"); + break; + } + } + return result.then(Mono.empty()); + + } + +} 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 b0b0671286e..63775b7aebd 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 @@ -8,8 +8,6 @@ package org.openapitools.api; import java.util.Map; import org.openapitools.model.Order; import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PathVariable; @@ -28,22 +26,23 @@ import javax.validation.Valid; import javax.validation.constraints.*; import java.util.List; import java.util.Map; -import java.util.Optional; @Validated @Api(value = "store", description = "the store API") public interface StoreApi { + default StoreApiDelegate getDelegate() { + return new StoreApiDelegate() {}; + } + @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"), @ApiResponse(code = 404, message = "Order not found") }) @RequestMapping(value = "/store/order/{order_id}", method = RequestMethod.DELETE) - default ResponseEntity> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono> deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true) @PathVariable("order_id") String orderId, ServerWebExchange exchange) { + return getDelegate().deleteOrder(orderId, exchange); } @@ -55,10 +54,8 @@ public interface StoreApi { @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - default ResponseEntity>> getInventory(ServerWebExchange exchange) { - Mono> result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono>> getInventory(ServerWebExchange exchange) { + return getDelegate().getInventory(exchange); } @@ -70,22 +67,8 @@ public interface StoreApi { @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}") - .then(Mono.empty()); - break; - } - if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - result = ApiUtil.getExampleResponse(exchange, " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono> getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId, ServerWebExchange exchange) { + return getDelegate().getOrderById(orderId, exchange); } @@ -96,22 +79,8 @@ public interface StoreApi { @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - default ResponseEntity> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Mono order, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}") - .then(Mono.empty()); - break; - } - if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - result = ApiUtil.getExampleResponse(exchange, " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(order.then(result)); - + default Mono> placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Mono order, ServerWebExchange exchange) { + return getDelegate().placeOrder(order, exchange); } } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiController.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiController.java index f6d80aa6cce..d00b4841fc0 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiController.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiController.java @@ -2,11 +2,21 @@ package org.openapitools.api; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.request.NativeWebRequest; import java.util.Optional; @Controller @RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") public class StoreApiController implements StoreApi { + private final StoreApiDelegate delegate; + + public StoreApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) StoreApiDelegate delegate) { + this.delegate = Optional.ofNullable(delegate).orElse(new StoreApiDelegate() {}); + } + + @Override + public StoreApiDelegate getDelegate() { + return delegate; + } + } 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 new file mode 100644 index 00000000000..8e95e0178b0 --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/StoreApiDelegate.java @@ -0,0 +1,93 @@ +package org.openapitools.api; + +import java.util.Map; +import org.openapitools.model.Order; +import io.swagger.annotations.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * A delegate to be called by the {@link StoreApiController}}. + * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. + */ + +public interface StoreApiDelegate { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * @see StoreApi#deleteOrder + */ + default Mono> deleteOrder(String orderId, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see StoreApi#getInventory + */ + default Mono>> getInventory(ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see StoreApi#getOrderById + */ + default Mono> getOrderById(Long orderId, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + result = ApiUtil.getExampleResponse(exchange, "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}"); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { + result = ApiUtil.getExampleResponse(exchange, " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true"); + break; + } + } + return result.then(Mono.empty()); + + } + + /** + * @see StoreApi#placeOrder + */ + default Mono> placeOrder(Mono order, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + result = ApiUtil.getExampleResponse(exchange, "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}"); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { + result = ApiUtil.getExampleResponse(exchange, " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true"); + break; + } + } + return result.then(Mono.empty()); + + } + +} 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 d247b746ca2..e0674fd5edd 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 @@ -8,8 +8,6 @@ package org.openapitools.api; import java.util.List; import org.openapitools.model.User; import io.swagger.annotations.*; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PathVariable; @@ -28,21 +26,22 @@ import javax.validation.Valid; import javax.validation.constraints.*; import java.util.List; import java.util.Map; -import java.util.Optional; @Validated @Api(value = "user", description = "the user API") public interface UserApi { + default UserApiDelegate getDelegate() { + return new UserApiDelegate() {}; + } + @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") }) @RequestMapping(value = "/user", method = RequestMethod.POST) - default ResponseEntity> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody Mono user, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(user.then(result)); - + default Mono> createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody Mono user, ServerWebExchange exchange) { + return getDelegate().createUser(user, exchange); } @@ -51,10 +50,8 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/user/createWithArray", method = RequestMethod.POST) - default ResponseEntity> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody Flux user, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(user.then(result)); - + default Mono> createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody Flux user, ServerWebExchange exchange) { + return getDelegate().createUsersWithArrayInput(user, exchange); } @@ -63,10 +60,8 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/user/createWithList", method = RequestMethod.POST) - default ResponseEntity> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody Flux user, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(user.then(result)); - + default Mono> createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody Flux user, ServerWebExchange exchange) { + return getDelegate().createUsersWithListInput(user, exchange); } @@ -76,10 +71,8 @@ public interface UserApi { @ApiResponse(code = 404, message = "User not found") }) @RequestMapping(value = "/user/{username}", method = RequestMethod.DELETE) - default ResponseEntity> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono> deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username, ServerWebExchange exchange) { + return getDelegate().deleteUser(username, exchange); } @@ -91,22 +84,8 @@ public interface UserApi { @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username, ServerWebExchange exchange) { - Mono result = Mono.empty(); - for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { - if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { - result = ApiUtil.getExampleResponse(exchange, "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\"}") - .then(Mono.empty()); - break; - } - if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { - result = ApiUtil.getExampleResponse(exchange, " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123") - .then(Mono.empty()); - break; - } - } - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono> getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username, ServerWebExchange exchange) { + return getDelegate().getUserByName(username, exchange); } @@ -117,10 +96,8 @@ public interface UserApi { @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default 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, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono> 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, ServerWebExchange exchange) { + return getDelegate().loginUser(username, password, exchange); } @@ -129,10 +106,8 @@ public interface UserApi { @ApiResponse(code = 200, message = "successful operation") }) @RequestMapping(value = "/user/logout", method = RequestMethod.GET) - default ResponseEntity> logoutUser(ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(result); - + default Mono> logoutUser(ServerWebExchange exchange) { + return getDelegate().logoutUser(exchange); } @@ -142,10 +117,8 @@ public interface UserApi { @ApiResponse(code = 404, message = "User not found") }) @RequestMapping(value = "/user/{username}", method = RequestMethod.PUT) - default 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 Mono user, ServerWebExchange exchange) { - Mono result = Mono.empty(); - return ResponseEntity.status(HttpStatus.NOT_IMPLEMENTED).body(user.then(result)); - + default Mono> updateUser(@ApiParam(value = "name that need to be deleted",required=true) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody Mono user, ServerWebExchange exchange) { + return getDelegate().updateUser(username, user, exchange); } } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiController.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiController.java index 570a05d8d37..5bd8c1f9f57 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiController.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiController.java @@ -2,11 +2,21 @@ package org.openapitools.api; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.request.NativeWebRequest; import java.util.Optional; @Controller @RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") public class UserApiController implements UserApi { + private final UserApiDelegate delegate; + + public UserApiController(@org.springframework.beans.factory.annotation.Autowired(required = false) UserApiDelegate delegate) { + this.delegate = Optional.ofNullable(delegate).orElse(new UserApiDelegate() {}); + } + + @Override + public UserApiDelegate getDelegate() { + return delegate; + } + } 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 new file mode 100644 index 00000000000..03de7cd2b49 --- /dev/null +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/api/UserApiDelegate.java @@ -0,0 +1,129 @@ +package org.openapitools.api; + +import java.util.List; +import org.openapitools.model.User; +import io.swagger.annotations.*; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.server.ServerWebExchange; +import reactor.core.publisher.Flux; +import reactor.core.publisher.Mono; + +import java.util.List; +import java.util.Map; +import java.util.Optional; + +/** + * A delegate to be called by the {@link UserApiController}}. + * Implement this interface with a {@link org.springframework.stereotype.Service} annotated class. + */ + +public interface UserApiDelegate { + + default Optional getRequest() { + return Optional.empty(); + } + + /** + * @see UserApi#createUser + */ + default Mono> createUser(Mono user, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see UserApi#createUsersWithArrayInput + */ + default Mono> createUsersWithArrayInput(Flux user, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see UserApi#createUsersWithListInput + */ + default Mono> createUsersWithListInput(Flux user, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see UserApi#deleteUser + */ + default Mono> deleteUser(String username, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see UserApi#getUserByName + */ + default Mono> getUserByName(String username, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + for (MediaType mediaType : exchange.getRequest().getHeaders().getAccept()) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + result = ApiUtil.getExampleResponse(exchange, "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\"}"); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { + result = ApiUtil.getExampleResponse(exchange, " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123"); + break; + } + } + return result.then(Mono.empty()); + + } + + /** + * @see UserApi#loginUser + */ + default Mono> loginUser(String username, + String password, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see UserApi#logoutUser + */ + default Mono> logoutUser(ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + + /** + * @see UserApi#updateUser + */ + default Mono> updateUser(String username, + Mono user, + ServerWebExchange exchange) { + exchange.getResponse().setStatusCode(HttpStatus.NOT_IMPLEMENTED); + Mono result = Mono.empty(); + return result.then(Mono.empty()); + + } + +} diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Animal.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Animal.java index 5bc21a6e60b..b9df0761fa2 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Animal.java @@ -22,7 +22,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Capitalization.java index 2f67e3d6ed8..cf8e0184c75 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Capitalization.java @@ -14,22 +14,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java index b0ee4437409..db751abc2d8 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Cat.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Category.java index ede08450019..ab96fdce16a 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Category.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ClassModel.java index b7c7d9330a0..1a44b03b0bc 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ClassModel.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Client.java index 68e888388b1..cf73d18603d 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Client.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java index 9b877bb8029..59f5507d573 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Dog.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/EnumArrays.java index 7c15608894d..1bf86d35fa3 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/EnumArrays.java @@ -48,7 +48,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/EnumTest.java index 26a8bce4e7c..dcb97236e4b 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/EnumTest.java @@ -49,7 +49,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -85,7 +85,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -119,7 +119,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -153,7 +153,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java index 31638e0ed66..6b1af9b08be 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/FormatTest.java @@ -19,43 +19,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private Resource binary = null; + private Resource binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index 13a6378b53e..1818546ce32 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; public HasOnlyReadOnly bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/MapTest.java index a6acaa59d1a..93a2b1e7b22 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/MapTest.java @@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.Valid; import javax.validation.constraints.*; @@ -62,7 +61,8 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + @Valid + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -149,24 +149,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - @Valid - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 452da256d01..5f1212179a3 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -20,10 +20,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") @Valid diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Model200Response.java index fdbe2056875..6a77de5e22a 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Model200Response.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ModelApiResponse.java index deb0fd9924f..a05b204bece 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -14,13 +14,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ModelReturn.java index 10684b30f81..b21e712510d 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ModelReturn.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Name.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Name.java index ba33f48731a..ba9701e1b7d 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Name.java @@ -15,16 +15,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/NumberOnly.java index 158b899847f..275529bafe1 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/NumberOnly.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Order.java index 946ce8f756d..0a09f15f309 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Order.java @@ -16,16 +16,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -61,7 +61,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OuterComposite.java index c343b0b39ed..f522765ede1 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/OuterComposite.java @@ -15,13 +15,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Pet.java index 502146abefc..d3bca13a64b 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Pet.java @@ -19,13 +19,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") @Valid @@ -69,7 +69,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ReadOnlyFirst.java index 321c3bddc68..f0c6b763e9f 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; public ReadOnlyFirst bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/SpecialModelName.java index 14741b1d224..6b445cfa0d9 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/SpecialModelName.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Tag.java index c9655217d9c..d9a99a54704 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Tag.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/User.java index b1e7e56281a..d934073c84f 100644 --- a/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/User.java @@ -14,28 +14,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-reactive/src/main/resources/application.properties b/samples/server/petstore/springboot-reactive/src/main/resources/application.properties index 6512a5b02e4..9d06609db66 100644 --- a/samples/server/petstore/springboot-reactive/src/main/resources/application.properties +++ b/samples/server/petstore/springboot-reactive/src/main/resources/application.properties @@ -1,3 +1,3 @@ server.port=80 spring.jackson.date-format=org.openapitools.RFC3339DateFormat -spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false diff --git a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml index 5765e33f9c1..66e8f0dcd22 100644 --- a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml @@ -1614,7 +1614,9 @@ components: type: boolean type: object indirect_map: - $ref: '#/components/schemas/StringBooleanMap' + additionalProperties: + type: boolean + type: object type: object Tag: example: diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiUtil.java index c5f5cc143a1..3ecc0972d94 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiUtil.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/ApiUtil.java @@ -8,8 +8,10 @@ import java.io.IOException; public class ApiUtil { public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { try { - req.getNativeResponse(HttpServletResponse.class).addHeader("Content-Type", contentType); - req.getNativeResponse(HttpServletResponse.class).getOutputStream().print(example); + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); } catch (IOException e) { throw new RuntimeException(e); } 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 f829e70def3..5378f64c258 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 @@ -51,14 +51,6 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -91,14 +83,6 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -111,14 +95,6 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -178,7 +154,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @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 = "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) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -191,7 +167,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $") @RequestHeader(value="enum_header_string_array", required=false) Optional> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) Optional enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @Valid @RequestParam(value = "enum_query_string_array", required = false) Optional> enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") Optional enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Optional enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Optional enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $", defaultValue="$") @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) { + default ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<>()") @RequestHeader(value="enum_header_string_array", required=false) Optional> enumHeaderStringArray,@ApiParam(value = "Header parameter enum test (string)" , allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestHeader(value="enum_header_string", required=false) Optional enumHeaderString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList<>()") Optional> enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @Valid @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") Optional enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @Valid @RequestParam(value = "enum_query_integer", required = false) Optional enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1.1, -1.2") @Valid @RequestParam(value = "enum_query_double", required = false) Optional enumQueryDouble,@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $", defaultValue="$") @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); } @@ -215,7 +191,7 @@ public interface FakeApi { @RequestMapping(value = "/fake/jsonFormData", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2) { + default 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); } @@ -233,7 +209,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", defaultValue="null") @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 detail") @Valid @RequestPart("file") 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/PetApi.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/api/PetApi.java index 52f977853a7..a1b949b75fc 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 @@ -82,7 +82,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default 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) { + default ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList<>()") List status) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -112,7 +112,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { + default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList<>()") List tags) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -188,7 +188,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status) { + default 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); } @@ -206,7 +206,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", defaultValue="null") @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 detail") @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/model/Animal.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java index 5bc21a6e60b..b9df0761fa2 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Animal.java @@ -22,7 +22,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Capitalization.java index 2f67e3d6ed8..cf8e0184c75 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Capitalization.java @@ -14,22 +14,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java index b0ee4437409..db751abc2d8 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Cat.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java index ede08450019..ab96fdce16a 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Category.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ClassModel.java index b7c7d9330a0..1a44b03b0bc 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ClassModel.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Client.java index 68e888388b1..cf73d18603d 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Client.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java index 9b877bb8029..59f5507d573 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Dog.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumArrays.java index 7c15608894d..1bf86d35fa3 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumArrays.java @@ -48,7 +48,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumTest.java index 26a8bce4e7c..dcb97236e4b 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/EnumTest.java @@ -49,7 +49,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -85,7 +85,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -119,7 +119,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -153,7 +153,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java index 31638e0ed66..6b1af9b08be 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/FormatTest.java @@ -19,43 +19,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private Resource binary = null; + private Resource binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index 13a6378b53e..1818546ce32 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; public HasOnlyReadOnly bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MapTest.java index a6acaa59d1a..93a2b1e7b22 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MapTest.java @@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.Valid; import javax.validation.constraints.*; @@ -62,7 +61,8 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + @Valid + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -149,24 +149,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - @Valid - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 452da256d01..5f1212179a3 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -20,10 +20,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") @Valid diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Model200Response.java index fdbe2056875..6a77de5e22a 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Model200Response.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelApiResponse.java index deb0fd9924f..a05b204bece 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -14,13 +14,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelReturn.java index 10684b30f81..b21e712510d 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ModelReturn.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Name.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Name.java index ba33f48731a..ba9701e1b7d 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Name.java @@ -15,16 +15,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NumberOnly.java index 158b899847f..275529bafe1 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/NumberOnly.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java index 946ce8f756d..0a09f15f309 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Order.java @@ -16,16 +16,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -61,7 +61,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OuterComposite.java index c343b0b39ed..f522765ede1 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/OuterComposite.java @@ -15,13 +15,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Pet.java index 502146abefc..d3bca13a64b 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Pet.java @@ -19,13 +19,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") @Valid @@ -69,7 +69,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ReadOnlyFirst.java index 321c3bddc68..f0c6b763e9f 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; public ReadOnlyFirst bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/SpecialModelName.java index 14741b1d224..6b445cfa0d9 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/SpecialModelName.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Tag.java index c9655217d9c..d9a99a54704 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/Tag.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/User.java index b1e7e56281a..d934073c84f 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/springboot-useoptional/src/main/java/org/openapitools/model/User.java @@ -14,28 +14,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot-useoptional/src/main/resources/application.properties b/samples/server/petstore/springboot-useoptional/src/main/resources/application.properties index 13b0dc6ab96..ceca4a9e0d0 100644 --- a/samples/server/petstore/springboot-useoptional/src/main/resources/application.properties +++ b/samples/server/petstore/springboot-useoptional/src/main/resources/application.properties @@ -1,4 +1,4 @@ springfox.documentation.swagger.v2.path=/api-docs server.port=80 spring.jackson.date-format=org.openapitools.RFC3339DateFormat -spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false diff --git a/samples/server/petstore/springboot-virtualan/.openapi-generator-ignore b/samples/server/petstore/springboot-virtualan/.openapi-generator-ignore new file mode 100644 index 00000000000..7484ee590a3 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/.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/springboot-virtualan/.openapi-generator/VERSION b/samples/server/petstore/springboot-virtualan/.openapi-generator/VERSION new file mode 100644 index 00000000000..6d94c9c2e12 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/.openapi-generator/VERSION @@ -0,0 +1 @@ +3.3.0-SNAPSHOT \ No newline at end of file diff --git a/samples/server/petstore/springboot-virtualan/README.md b/samples/server/petstore/springboot-virtualan/README.md new file mode 100644 index 00000000000..34d7562140a --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/README.md @@ -0,0 +1,26 @@ +# OpenAPI generated server + +Spring Boot Server + + +## Overview +This server was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. +By using the [OpenAPI-Spec](https://openapis.org), you can easily generate a server stub. +This is an example of building a OpenAPI-enabled server in Java using the SpringBoot framework. + +The underlying library integrating OpenAPI to SpringBoot is [springfox](https://github.com/springfox/springfox) + +Start your server as a simple java application + +You can view the api documentation in swagger-ui by pointing to +http://localhost:80/ + +Change default port value in application.properties + +## Virtualan : + +You can view Virtualan UI by pointing to +http://localhost:80//virtualan-ui.html. + +How to use guide available in the Virtualan wiki +https://github.com/elan-venture/virtualan/wiki diff --git a/samples/server/petstore/springboot-virtualan/pom.xml b/samples/server/petstore/springboot-virtualan/pom.xml new file mode 100644 index 00000000000..c13fb400aff --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/pom.xml @@ -0,0 +1,79 @@ + + 4.0.0 + org.openapitools + springboot-virtualan + jar + springboot-virtualan + 1.0.0 + + 1.8 + ${java.version} + ${java.version} + 2.8.0 + + + org.springframework.boot + spring-boot-starter-parent + 2.0.1.RELEASE + + + src/main/java + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + io.springfox + springfox-swagger2 + ${springfox-version} + + + io.springfox + springfox-swagger-ui + ${springfox-version} + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + + javax.validation + validation-api + + + + io.virtualan + virtualan-plugin + 1.0.0 + + + + org.hsqldb + hsqldb + 2.3.2 + + + org.springframework.boot + spring-boot-starter-data-jpa + 1.5.9.RELEASE + + + + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/OpenAPI2SpringBoot.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/OpenAPI2SpringBoot.java new file mode 100644 index 00000000000..5f8148a921b --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/OpenAPI2SpringBoot.java @@ -0,0 +1,50 @@ +package org.openapitools; + +import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.ExitCodeGenerator; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.web.servlet.config.annotation.CorsRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +@SpringBootApplication +@ComponentScan(basePackages = {"org.openapitools", "org.openapitools.virtualan.api" , "org.openapitools.configuration"}) +public class OpenAPI2SpringBoot implements CommandLineRunner { + + @Override + public void run(String... arg0) throws Exception { + if (arg0.length > 0 && arg0[0].equals("exitcode")) { + throw new ExitException(); + } + } + + public static void main(String[] args) throws Exception { + new SpringApplication(OpenAPI2SpringBoot.class).run(args); + } + + class ExitException extends RuntimeException implements ExitCodeGenerator { + private static final long serialVersionUID = 1L; + + @Override + public int getExitCode() { + return 10; + } + + } + + @Bean + public WebMvcConfigurer webConfigurer() { + return new WebMvcConfigurer() { + /*@Override + public void addCorsMappings(CorsRegistry registry) { + registry.addMapping("/**") + .allowedOrigins("*") + .allowedMethods("*") + .allowedHeaders("Content-Type"); + }*/ + }; + } + +} diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/RFC3339DateFormat.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/RFC3339DateFormat.java new file mode 100644 index 00000000000..026bb3168c6 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/RFC3339DateFormat.java @@ -0,0 +1,22 @@ +package org.openapitools; + +import com.fasterxml.jackson.databind.util.ISO8601DateFormat; +import com.fasterxml.jackson.databind.util.ISO8601Utils; + +import java.text.FieldPosition; +import java.util.Date; + + +public class RFC3339DateFormat extends ISO8601DateFormat { + + private static final long serialVersionUID = 1L; + + // Same as ISO8601DateFormat but serializing milliseconds. + @Override + public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) { + String value = ISO8601Utils.format(date, true); + toAppendTo.append(value); + return toAppendTo; + } + +} \ No newline at end of file diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/configuration/HomeController.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/configuration/HomeController.java new file mode 100644 index 00000000000..25727830541 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/configuration/HomeController.java @@ -0,0 +1,19 @@ +package org.openapitools.configuration; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; + + +/** + * Home redirection to OpenAPI api documentation + */ +@Controller +public class HomeController { + + @RequestMapping("/") + public String index() { + return "redirect:swagger-ui.html"; + } + + +} diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java new file mode 100644 index 00000000000..b018fb7272a --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/configuration/OpenAPIDocumentationConfig.java @@ -0,0 +1,70 @@ +package org.openapitools.configuration; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import org.springframework.web.util.UriComponentsBuilder; +import springfox.documentation.builders.ApiInfoBuilder; +import springfox.documentation.builders.RequestHandlerSelectors; +import springfox.documentation.service.ApiInfo; +import springfox.documentation.service.Contact; +import springfox.documentation.spi.DocumentationType; +import springfox.documentation.spring.web.paths.Paths; +import springfox.documentation.spring.web.paths.RelativePathProvider; +import springfox.documentation.spring.web.plugins.Docket; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +import javax.servlet.ServletContext; + + +@Configuration +@EnableSwagger2 +public class OpenAPIDocumentationConfig { + + ApiInfo apiInfo() { + return new ApiInfoBuilder() + .title("OpenAPI Petstore") + .description("This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\") + .license("Apache-2.0") + .licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html") + .termsOfServiceUrl("") + .version("1.0.0") + .contact(new Contact("","", "")) + .build(); + } + + @Bean + public Docket customImplementation(ServletContext servletContext, @Value("${openapi.openAPIPetstore.base-path:/v2}") String basePath) { + return new Docket(DocumentationType.SWAGGER_2) + .select() + .apis(RequestHandlerSelectors.basePackage("org.openapitools.virtualan.api")) + .build() + .pathProvider(new BasePathAwareRelativePathProvider(servletContext, basePath)) + .directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class) + .directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class) + .apiInfo(apiInfo()); + } + + class BasePathAwareRelativePathProvider extends RelativePathProvider { + private String basePath; + + public BasePathAwareRelativePathProvider(ServletContext servletContext, String basePath) { + super(servletContext); + this.basePath = basePath; + } + + @Override + protected String applicationPath() { + return Paths.removeAdjacentForwardSlashes(UriComponentsBuilder.fromPath(super.applicationPath()).path(basePath).build().toString()); + } + + @Override + public String getOperationPath(String operationPath) { + UriComponentsBuilder uriComponentsBuilder = UriComponentsBuilder.fromPath("/"); + return Paths.removeAdjacentForwardSlashes( + uriComponentsBuilder.path(operationPath.replaceFirst("^" + basePath, "")).build().toString()); + } + } + +} 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 new file mode 100644 index 00000000000..7106b763d21 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/AnotherFakeApi.java @@ -0,0 +1,62 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.3.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.virtualan.api; + +import org.openapitools.virtualan.model.Client; +import io.swagger.annotations.*; +import io.virtualan.annotation.ApiVirtual; +import io.virtualan.annotation.VirtualService; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +@Validated +@Api(value = "another-fake", description = "the another-fake API") +@VirtualService +public interface AnotherFakeApi { + + default Optional getRequest() { + return Optional.empty(); + } + + @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 = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/another-fake/dummy", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + default ResponseEntity call123testSpecialTags(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client client) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + ApiUtil.setExampleResponse(request, "application/json", "{ \"client\" : \"client\"}"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/AnotherFakeApiController.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/AnotherFakeApiController.java new file mode 100644 index 00000000000..8ba61766e9e --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/AnotherFakeApiController.java @@ -0,0 +1,24 @@ +package org.openapitools.virtualan.api; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.request.NativeWebRequest; +import java.util.Optional; + +@Controller +@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") +public class AnotherFakeApiController implements AnotherFakeApi { + + private final NativeWebRequest request; + + @org.springframework.beans.factory.annotation.Autowired + public AnotherFakeApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/ApiUtil.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/ApiUtil.java new file mode 100644 index 00000000000..a1b15b821fb --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/ApiUtil.java @@ -0,0 +1,17 @@ +package org.openapitools.virtualan.api; + +import org.springframework.web.context.request.NativeWebRequest; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; + +public class ApiUtil { + public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { + try { + req.getNativeResponse(HttpServletResponse.class).addHeader("Content-Type", contentType); + req.getNativeResponse(HttpServletResponse.class).getOutputStream().print(example); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} \ No newline at end of file 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 new file mode 100644 index 00000000000..0555f06748f --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApi.java @@ -0,0 +1,264 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.3.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.virtualan.api; + +import java.math.BigDecimal; +import org.openapitools.virtualan.model.Client; +import org.openapitools.virtualan.model.FileSchemaTestClass; +import java.time.LocalDate; +import java.util.Map; +import org.openapitools.virtualan.model.ModelApiResponse; +import java.time.OffsetDateTime; +import org.openapitools.virtualan.model.OuterComposite; +import org.springframework.core.io.Resource; +import org.openapitools.virtualan.model.User; +import io.swagger.annotations.*; +import io.virtualan.annotation.ApiVirtual; +import io.virtualan.annotation.VirtualService; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +@Validated +@Api(value = "fake", description = "the fake API") +@VirtualService +public interface FakeApi { + + default Optional getRequest() { + return Optional.empty(); + } + + @ApiVirtual + @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) }) + @RequestMapping(value = "/fake/outer/boolean", + produces = { "*/*" }, + method = RequestMethod.POST) + default ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { + ApiUtil.setExampleResponse(request, "*/*", "null"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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) }) + @RequestMapping(value = "/fake/outer/composite", + produces = { "*/*" }, + method = RequestMethod.POST) + default ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite outerComposite) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { + ApiUtil.setExampleResponse(request, "*/*", "{ \"my_string\" : \"my_string\", \"my_number\" : 0.80082819046101150206595775671303272247314453125, \"my_boolean\" : true}"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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) }) + @RequestMapping(value = "/fake/outer/number", + produces = { "*/*" }, + method = RequestMethod.POST) + default ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { + ApiUtil.setExampleResponse(request, "*/*", "null"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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) }) + @RequestMapping(value = "/fake/outer/string", + produces = { "*/*" }, + method = RequestMethod.POST) + default ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { + ApiUtil.setExampleResponse(request, "*/*", "null"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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") }) + @RequestMapping(value = "/fake/body-with-file-schema", + consumes = { "application/json" }, + method = RequestMethod.PUT) + default ResponseEntity testBodyWithFileSchema(@ApiParam(value = "" ,required=true ) @Valid @RequestBody FileSchemaTestClass fileSchemaTestClass) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @ApiOperation(value = "", nickname = "testBodyWithQueryParams", notes = "", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Success") }) + @RequestMapping(value = "/fake/body-with-query-params", + consumes = { "application/json" }, + method = RequestMethod.PUT) + default ResponseEntity testBodyWithQueryParams(@NotNull @ApiParam(value = "", required = true) @Valid @RequestParam(value = "query", required = true) String query,@ApiParam(value = "" ,required=true ) @Valid @RequestBody User user) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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) }) + @RequestMapping(value = "/fake", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + default ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client client) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + ApiUtil.setExampleResponse(request, "application/json", "{ \"client\" : \"client\"}"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid username supplied"), + @ApiResponse(code = 404, message = "User not found") }) + @RequestMapping(value = "/fake", + consumes = { "application/x-www-form-urlencoded" }, + method = RequestMethod.POST) + default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="callback", required=false) String paramCallback) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @ApiOperation(value = "To test enum parameters", nickname = "testEnumParameters", notes = "To test enum parameters", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid request"), + @ApiResponse(code = 404, message = "Not found") }) + @RequestMapping(value = "/fake", + consumes = { "application/x-www-form-urlencoded" }, + method = RequestMethod.GET) + default 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=">, $", defaultValue="$") @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); + + } + + + @ApiVirtual + @ApiOperation(value = "test inline additionalProperties", nickname = "testInlineAdditionalProperties", notes = "", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + @RequestMapping(value = "/fake/inline-additionalProperties", + consumes = { "application/json" }, + method = RequestMethod.POST) + default ResponseEntity testInlineAdditionalProperties(@ApiParam(value = "request body" ,required=true ) @Valid @RequestBody Map requestBody) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @ApiOperation(value = "test json serialization of form data", nickname = "testJsonFormData", notes = "", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + @RequestMapping(value = "/fake/jsonFormData", + consumes = { "application/x-www-form-urlencoded" }, + method = RequestMethod.GET) + default ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = ModelApiResponse.class) }) + @RequestMapping(value = "/fake/{petId}/uploadImageWithRequiredFile", + 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", defaultValue="null") @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"))) { + ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApiController.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApiController.java new file mode 100644 index 00000000000..4b2e463440d --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeApiController.java @@ -0,0 +1,24 @@ +package org.openapitools.virtualan.api; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.request.NativeWebRequest; +import java.util.Optional; + +@Controller +@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") +public class FakeApiController implements FakeApi { + + private final NativeWebRequest request; + + @org.springframework.beans.factory.annotation.Autowired + public FakeApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} 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 new file mode 100644 index 00000000000..d83dcb48787 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApi.java @@ -0,0 +1,64 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.3.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.virtualan.api; + +import org.openapitools.virtualan.model.Client; +import io.swagger.annotations.*; +import io.virtualan.annotation.ApiVirtual; +import io.virtualan.annotation.VirtualService; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +@Validated +@Api(value = "fake_classname_test", description = "the fake_classname_test API") +@VirtualService +public interface FakeClassnameTestApi { + + default Optional getRequest() { + return Optional.empty(); + } + + @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") + }, tags={ "fake_classname_tags 123#$%^", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) + @RequestMapping(value = "/fake_classname_test", + produces = { "application/json" }, + consumes = { "application/json" }, + method = RequestMethod.PATCH) + default ResponseEntity testClassname(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client client) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + ApiUtil.setExampleResponse(request, "application/json", "{ \"client\" : \"client\"}"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApiController.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApiController.java new file mode 100644 index 00000000000..9a048c36e72 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/FakeClassnameTestApiController.java @@ -0,0 +1,24 @@ +package org.openapitools.virtualan.api; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.request.NativeWebRequest; +import java.util.Optional; + +@Controller +@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") +public class FakeClassnameTestApiController implements FakeClassnameTestApi { + + private final NativeWebRequest request; + + @org.springframework.beans.factory.annotation.Autowired + public FakeClassnameTestApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} 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 new file mode 100644 index 00000000000..21ad9cccb25 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/PetApi.java @@ -0,0 +1,233 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.3.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.virtualan.api; + +import org.openapitools.virtualan.model.ModelApiResponse; +import org.openapitools.virtualan.model.Pet; +import org.springframework.core.io.Resource; +import io.swagger.annotations.*; +import io.virtualan.annotation.ApiVirtual; +import io.virtualan.annotation.VirtualService; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +@Validated +@Api(value = "pet", description = "the pet API") +@VirtualService +public interface PetApi { + + default Optional getRequest() { + return Optional.empty(); + } + + @ApiVirtual + @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") + }) + }, tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input") }) + @RequestMapping(value = "/pet", + consumes = { "application/json", "application/xml" }, + method = RequestMethod.POST) + default ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet pet) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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") + }) + }, tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 400, message = "Invalid pet value") }) + @RequestMapping(value = "/pet/{petId}", + method = RequestMethod.DELETE) + default 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); + + } + + + @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 = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @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) + default 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) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { + ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @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 = { + @AuthorizationScope(scope = "write:pets", description = "modify pets in your account"), + @AuthorizationScope(scope = "read:pets", description = "read your pets") + }) + }, tags={ "pet", }) + @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) + default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { + ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @ApiOperation(value = "Find pet by ID", nickname = "getPetById", notes = "Returns a single pet", response = Pet.class, authorizations = { + @Authorization(value = "api_key") + }, tags={ "pet", }) + @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) + default ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true) @PathVariable("petId") Long petId) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + ApiUtil.setExampleResponse(request, "application/json", "{ \"photoUrls\" : [ \"photoUrls\", \"photoUrls\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"name\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"name\", \"id\" : 1 }, { \"name\" : \"name\", \"id\" : 1 } ], \"status\" : \"available\"}"); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { + ApiUtil.setExampleResponse(request, "application/xml", " 123456789 doggie aeiou aeiou"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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") + }) + }, tags={ "pet", }) + @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) + default ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet pet) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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") + }) + }, tags={ "pet", }) + @ApiResponses(value = { + @ApiResponse(code = 405, message = "Invalid input") }) + @RequestMapping(value = "/pet/{petId}", + consumes = { "application/x-www-form-urlencoded" }, + method = RequestMethod.POST) + default 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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") + }) + }, tags={ "pet", }) + @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) + default ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server", defaultValue="null") @RequestParam(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile file) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + ApiUtil.setExampleResponse(request, "application/json", "{ \"code\" : 0, \"type\" : \"type\", \"message\" : \"message\"}"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/PetApiController.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/PetApiController.java new file mode 100644 index 00000000000..d9f4d8f1264 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/PetApiController.java @@ -0,0 +1,24 @@ +package org.openapitools.virtualan.api; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.request.NativeWebRequest; +import java.util.Optional; + +@Controller +@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") +public class PetApiController implements PetApi { + + private final NativeWebRequest request; + + @org.springframework.beans.factory.annotation.Autowired + public PetApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} 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 new file mode 100644 index 00000000000..f4f013f0f55 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApi.java @@ -0,0 +1,122 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.3.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.virtualan.api; + +import java.util.Map; +import org.openapitools.virtualan.model.Order; +import io.swagger.annotations.*; +import io.virtualan.annotation.ApiVirtual; +import io.virtualan.annotation.VirtualService; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +@Validated +@Api(value = "store", description = "the store API") +@VirtualService +public interface StoreApi { + + default Optional getRequest() { + return Optional.empty(); + } + + @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 = { + @ApiResponse(code = 400, message = "Invalid ID supplied"), + @ApiResponse(code = 404, message = "Order not found") }) + @RequestMapping(value = "/store/order/{order_id}", + method = RequestMethod.DELETE) + default 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); + + } + + + @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") + }, tags={ "store", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation", response = Map.class, responseContainer = "Map") }) + @RequestMapping(value = "/store/inventory", + produces = { "application/json" }, + method = RequestMethod.GET) + default ResponseEntity> getInventory() { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @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 = { + @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/{order_id}", + produces = { "application/xml", "application/json" }, + method = RequestMethod.GET) + default ResponseEntity getOrderById(@Min(1L) @Max(5L) @ApiParam(value = "ID of pet that needs to be fetched",required=true) @PathVariable("order_id") Long orderId) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + ApiUtil.setExampleResponse(request, "application/json", "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}"); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { + ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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), + @ApiResponse(code = 400, message = "Invalid Order") }) + @RequestMapping(value = "/store/order", + produces = { "application/xml", "application/json" }, + method = RequestMethod.POST) + default ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order order) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + ApiUtil.setExampleResponse(request, "application/json", "{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}"); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { + ApiUtil.setExampleResponse(request, "application/xml", " 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApiController.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApiController.java new file mode 100644 index 00000000000..abb0e0f5370 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/StoreApiController.java @@ -0,0 +1,24 @@ +package org.openapitools.virtualan.api; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.request.NativeWebRequest; +import java.util.Optional; + +@Controller +@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") +public class StoreApiController implements StoreApi { + + private final NativeWebRequest request; + + @org.springframework.beans.factory.annotation.Autowired + public StoreApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} 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 new file mode 100644 index 00000000000..36d28a4b1f7 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApi.java @@ -0,0 +1,156 @@ +/** + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.3.0-SNAPSHOT). + * https://openapi-generator.tech + * Do not edit the class manually. + */ +package org.openapitools.virtualan.api; + +import java.util.List; +import org.openapitools.virtualan.model.User; +import io.swagger.annotations.*; +import io.virtualan.annotation.ApiVirtual; +import io.virtualan.annotation.VirtualService; +import org.springframework.http.HttpStatus; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RequestPart; +import org.springframework.web.context.request.NativeWebRequest; +import org.springframework.web.multipart.MultipartFile; + +import javax.validation.Valid; +import javax.validation.constraints.*; +import java.util.List; +import java.util.Map; +import java.util.Optional; + +@Validated +@Api(value = "user", description = "the user API") +@VirtualService +public interface UserApi { + + default Optional getRequest() { + return Optional.empty(); + } + + @ApiVirtual + @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") }) + @RequestMapping(value = "/user", + method = RequestMethod.POST) + default ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User user) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithArrayInput", notes = "", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + @RequestMapping(value = "/user/createWithArray", + method = RequestMethod.POST) + default ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List user) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @ApiOperation(value = "Creates list of users with given input array", nickname = "createUsersWithListInput", notes = "", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + @RequestMapping(value = "/user/createWithList", + method = RequestMethod.POST) + default ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List user) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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"), + @ApiResponse(code = 404, message = "User not found") }) + @RequestMapping(value = "/user/{username}", + method = RequestMethod.DELETE) + default ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true) @PathVariable("username") String username) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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), + @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) + default ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing.",required=true) @PathVariable("username") String username) { + getRequest().ifPresent(request -> { + for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { + if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { + ApiUtil.setExampleResponse(request, "application/json", "{ \"firstName\" : \"firstName\", \"lastName\" : \"lastName\", \"password\" : \"password\", \"userStatus\" : 6, \"phone\" : \"phone\", \"id\" : 0, \"email\" : \"email\", \"username\" : \"username\"}"); + break; + } + if (mediaType.isCompatibleWith(MediaType.valueOf("application/xml"))) { + ApiUtil.setExampleResponse(request, "application/xml", " 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123"); + break; + } + } + }); + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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), + @ApiResponse(code = 400, message = "Invalid username/password supplied") }) + @RequestMapping(value = "/user/login", + produces = { "application/xml", "application/json" }, + method = RequestMethod.GET) + default 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); + + } + + + @ApiVirtual + @ApiOperation(value = "Logs out current logged in user session", nickname = "logoutUser", notes = "", tags={ "user", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "successful operation") }) + @RequestMapping(value = "/user/logout", + method = RequestMethod.GET) + default ResponseEntity logoutUser() { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + + + @ApiVirtual + @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"), + @ApiResponse(code = 404, message = "User not found") }) + @RequestMapping(value = "/user/{username}", + method = RequestMethod.PUT) + default 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 user) { + return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); + + } + +} diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApiController.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApiController.java new file mode 100644 index 00000000000..01ceadc0d00 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/api/UserApiController.java @@ -0,0 +1,24 @@ +package org.openapitools.virtualan.api; + +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.context.request.NativeWebRequest; +import java.util.Optional; + +@Controller +@RequestMapping("${openapi.openAPIPetstore.base-path:/v2}") +public class UserApiController implements UserApi { + + private final NativeWebRequest request; + + @org.springframework.beans.factory.annotation.Autowired + public UserApiController(NativeWebRequest request) { + this.request = request; + } + + @Override + public Optional getRequest() { + return Optional.ofNullable(request); + } + +} diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AdditionalPropertiesClass.java new file mode 100644 index 00000000000..3fbea03c759 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AdditionalPropertiesClass.java @@ -0,0 +1,125 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * AdditionalPropertiesClass + */ + +public class AdditionalPropertiesClass { + @JsonProperty("map_property") + @Valid + private Map mapProperty = null; + + @JsonProperty("map_of_map_property") + @Valid + private Map> mapOfMapProperty = null; + + public AdditionalPropertiesClass mapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + return this; + } + + public AdditionalPropertiesClass putMapPropertyItem(String key, String mapPropertyItem) { + if (this.mapProperty == null) { + this.mapProperty = new HashMap<>(); + } + this.mapProperty.put(key, mapPropertyItem); + return this; + } + + /** + * Get mapProperty + * @return mapProperty + **/ + @ApiModelProperty(value = "") + + + public Map getMapProperty() { + return mapProperty; + } + + public void setMapProperty(Map mapProperty) { + this.mapProperty = mapProperty; + } + + public AdditionalPropertiesClass mapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + return this; + } + + public AdditionalPropertiesClass putMapOfMapPropertyItem(String key, Map mapOfMapPropertyItem) { + if (this.mapOfMapProperty == null) { + this.mapOfMapProperty = new HashMap<>(); + } + this.mapOfMapProperty.put(key, mapOfMapPropertyItem); + return this; + } + + /** + * Get mapOfMapProperty + * @return mapOfMapProperty + **/ + @ApiModelProperty(value = "") + + @Valid + + public Map> getMapOfMapProperty() { + return mapOfMapProperty; + } + + public void setMapOfMapProperty(Map> mapOfMapProperty) { + this.mapOfMapProperty = mapOfMapProperty; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AdditionalPropertiesClass additionalPropertiesClass = (AdditionalPropertiesClass) o; + return Objects.equals(this.mapProperty, additionalPropertiesClass.mapProperty) && + Objects.equals(this.mapOfMapProperty, additionalPropertiesClass.mapOfMapProperty); + } + + @Override + public int hashCode() { + return Objects.hash(mapProperty, mapOfMapProperty); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AdditionalPropertiesClass {\n"); + + sb.append(" mapProperty: ").append(toIndentedString(mapProperty)).append("\n"); + sb.append(" mapOfMapProperty: ").append(toIndentedString(mapOfMapProperty)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Animal.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Animal.java new file mode 100644 index 00000000000..5c1ffdf5386 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Animal.java @@ -0,0 +1,112 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonSubTypes; +import com.fasterxml.jackson.annotation.JsonTypeInfo; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Animal + */ + +@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "className", visible = true) +@JsonSubTypes({ + @JsonSubTypes.Type(value = Dog.class, name = "Dog"), + @JsonSubTypes.Type(value = Cat.class, name = "Cat"), +}) + +public class Animal { + @JsonProperty("className") + private String className = null; + + @JsonProperty("color") + private String color = "red"; + + public Animal className(String className) { + this.className = className; + return this; + } + + /** + * Get className + * @return className + **/ + @ApiModelProperty(required = true, value = "") + @NotNull + + + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public Animal color(String color) { + this.color = color; + return this; + } + + /** + * Get color + * @return color + **/ + @ApiModelProperty(value = "") + + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Animal animal = (Animal) o; + return Objects.equals(this.className, animal.className) && + Objects.equals(this.color, animal.color); + } + + @Override + public int hashCode() { + return Objects.hash(className, color); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Animal {\n"); + + sb.append(" className: ").append(toIndentedString(className)).append("\n"); + sb.append(" color: ").append(toIndentedString(color)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AnimalFarm.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AnimalFarm.java new file mode 100644 index 00000000000..225ae3beb87 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/AnimalFarm.java @@ -0,0 +1,52 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.virtualan.model.Animal; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * AnimalFarm + */ + +public class AnimalFarm extends ArrayList { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class AnimalFarm {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ArrayOfArrayOfNumberOnly.java new file mode 100644 index 00000000000..486702883d2 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ArrayOfArrayOfNumberOnly.java @@ -0,0 +1,91 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * ArrayOfArrayOfNumberOnly + */ + +public class ArrayOfArrayOfNumberOnly { + @JsonProperty("ArrayArrayNumber") + @Valid + private List> arrayArrayNumber = null; + + public ArrayOfArrayOfNumberOnly arrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + return this; + } + + public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayArrayNumberItem) { + if (this.arrayArrayNumber == null) { + this.arrayArrayNumber = new ArrayList<>(); + } + this.arrayArrayNumber.add(arrayArrayNumberItem); + return this; + } + + /** + * Get arrayArrayNumber + * @return arrayArrayNumber + **/ + @ApiModelProperty(value = "") + + @Valid + + public List> getArrayArrayNumber() { + return arrayArrayNumber; + } + + public void setArrayArrayNumber(List> arrayArrayNumber) { + this.arrayArrayNumber = arrayArrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfArrayOfNumberOnly arrayOfArrayOfNumberOnly = (ArrayOfArrayOfNumberOnly) o; + return Objects.equals(this.arrayArrayNumber, arrayOfArrayOfNumberOnly.arrayArrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayArrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfArrayOfNumberOnly {\n"); + + sb.append(" arrayArrayNumber: ").append(toIndentedString(arrayArrayNumber)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ArrayOfNumberOnly.java new file mode 100644 index 00000000000..28875cb548b --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ArrayOfNumberOnly.java @@ -0,0 +1,91 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * ArrayOfNumberOnly + */ + +public class ArrayOfNumberOnly { + @JsonProperty("ArrayNumber") + @Valid + private List arrayNumber = null; + + public ArrayOfNumberOnly arrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + return this; + } + + public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { + if (this.arrayNumber == null) { + this.arrayNumber = new ArrayList<>(); + } + this.arrayNumber.add(arrayNumberItem); + return this; + } + + /** + * Get arrayNumber + * @return arrayNumber + **/ + @ApiModelProperty(value = "") + + @Valid + + public List getArrayNumber() { + return arrayNumber; + } + + public void setArrayNumber(List arrayNumber) { + this.arrayNumber = arrayNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayOfNumberOnly arrayOfNumberOnly = (ArrayOfNumberOnly) o; + return Objects.equals(this.arrayNumber, arrayOfNumberOnly.arrayNumber); + } + + @Override + public int hashCode() { + return Objects.hash(arrayNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayOfNumberOnly {\n"); + + sb.append(" arrayNumber: ").append(toIndentedString(arrayNumber)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ArrayTest.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ArrayTest.java new file mode 100644 index 00000000000..64e608900f8 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ArrayTest.java @@ -0,0 +1,160 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.virtualan.model.ReadOnlyFirst; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * ArrayTest + */ + +public class ArrayTest { + @JsonProperty("array_of_string") + @Valid + private List arrayOfString = null; + + @JsonProperty("array_array_of_integer") + @Valid + private List> arrayArrayOfInteger = null; + + @JsonProperty("array_array_of_model") + @Valid + private List> arrayArrayOfModel = null; + + public ArrayTest arrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + return this; + } + + public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { + if (this.arrayOfString == null) { + this.arrayOfString = new ArrayList<>(); + } + this.arrayOfString.add(arrayOfStringItem); + return this; + } + + /** + * Get arrayOfString + * @return arrayOfString + **/ + @ApiModelProperty(value = "") + + + public List getArrayOfString() { + return arrayOfString; + } + + public void setArrayOfString(List arrayOfString) { + this.arrayOfString = arrayOfString; + } + + public ArrayTest arrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + return this; + } + + public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) { + if (this.arrayArrayOfInteger == null) { + this.arrayArrayOfInteger = new ArrayList<>(); + } + this.arrayArrayOfInteger.add(arrayArrayOfIntegerItem); + return this; + } + + /** + * Get arrayArrayOfInteger + * @return arrayArrayOfInteger + **/ + @ApiModelProperty(value = "") + + @Valid + + public List> getArrayArrayOfInteger() { + return arrayArrayOfInteger; + } + + public void setArrayArrayOfInteger(List> arrayArrayOfInteger) { + this.arrayArrayOfInteger = arrayArrayOfInteger; + } + + public ArrayTest arrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + return this; + } + + public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelItem) { + if (this.arrayArrayOfModel == null) { + this.arrayArrayOfModel = new ArrayList<>(); + } + this.arrayArrayOfModel.add(arrayArrayOfModelItem); + return this; + } + + /** + * Get arrayArrayOfModel + * @return arrayArrayOfModel + **/ + @ApiModelProperty(value = "") + + @Valid + + public List> getArrayArrayOfModel() { + return arrayArrayOfModel; + } + + public void setArrayArrayOfModel(List> arrayArrayOfModel) { + this.arrayArrayOfModel = arrayArrayOfModel; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ArrayTest arrayTest = (ArrayTest) o; + return Objects.equals(this.arrayOfString, arrayTest.arrayOfString) && + Objects.equals(this.arrayArrayOfInteger, arrayTest.arrayArrayOfInteger) && + Objects.equals(this.arrayArrayOfModel, arrayTest.arrayArrayOfModel); + } + + @Override + public int hashCode() { + return Objects.hash(arrayOfString, arrayArrayOfInteger, arrayArrayOfModel); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ArrayTest {\n"); + + sb.append(" arrayOfString: ").append(toIndentedString(arrayOfString)).append("\n"); + sb.append(" arrayArrayOfInteger: ").append(toIndentedString(arrayArrayOfInteger)).append("\n"); + sb.append(" arrayArrayOfModel: ").append(toIndentedString(arrayArrayOfModel)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Capitalization.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Capitalization.java new file mode 100644 index 00000000000..7071e42a553 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Capitalization.java @@ -0,0 +1,203 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Capitalization + */ + +public class Capitalization { + @JsonProperty("smallCamel") + private String smallCamel = null; + + @JsonProperty("CapitalCamel") + private String capitalCamel = null; + + @JsonProperty("small_Snake") + private String smallSnake = null; + + @JsonProperty("Capital_Snake") + private String capitalSnake = null; + + @JsonProperty("SCA_ETH_Flow_Points") + private String scAETHFlowPoints = null; + + @JsonProperty("ATT_NAME") + private String ATT_NAME = null; + + public Capitalization smallCamel(String smallCamel) { + this.smallCamel = smallCamel; + return this; + } + + /** + * Get smallCamel + * @return smallCamel + **/ + @ApiModelProperty(value = "") + + + public String getSmallCamel() { + return smallCamel; + } + + public void setSmallCamel(String smallCamel) { + this.smallCamel = smallCamel; + } + + public Capitalization capitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + return this; + } + + /** + * Get capitalCamel + * @return capitalCamel + **/ + @ApiModelProperty(value = "") + + + public String getCapitalCamel() { + return capitalCamel; + } + + public void setCapitalCamel(String capitalCamel) { + this.capitalCamel = capitalCamel; + } + + public Capitalization smallSnake(String smallSnake) { + this.smallSnake = smallSnake; + return this; + } + + /** + * Get smallSnake + * @return smallSnake + **/ + @ApiModelProperty(value = "") + + + public String getSmallSnake() { + return smallSnake; + } + + public void setSmallSnake(String smallSnake) { + this.smallSnake = smallSnake; + } + + public Capitalization capitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + return this; + } + + /** + * Get capitalSnake + * @return capitalSnake + **/ + @ApiModelProperty(value = "") + + + public String getCapitalSnake() { + return capitalSnake; + } + + public void setCapitalSnake(String capitalSnake) { + this.capitalSnake = capitalSnake; + } + + public Capitalization scAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + return this; + } + + /** + * Get scAETHFlowPoints + * @return scAETHFlowPoints + **/ + @ApiModelProperty(value = "") + + + public String getScAETHFlowPoints() { + return scAETHFlowPoints; + } + + public void setScAETHFlowPoints(String scAETHFlowPoints) { + this.scAETHFlowPoints = scAETHFlowPoints; + } + + public Capitalization ATT_NAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + return this; + } + + /** + * Name of the pet + * @return ATT_NAME + **/ + @ApiModelProperty(value = "Name of the pet ") + + + public String getATTNAME() { + return ATT_NAME; + } + + public void setATTNAME(String ATT_NAME) { + this.ATT_NAME = ATT_NAME; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Capitalization capitalization = (Capitalization) o; + return Objects.equals(this.smallCamel, capitalization.smallCamel) && + Objects.equals(this.capitalCamel, capitalization.capitalCamel) && + Objects.equals(this.smallSnake, capitalization.smallSnake) && + Objects.equals(this.capitalSnake, capitalization.capitalSnake) && + Objects.equals(this.scAETHFlowPoints, capitalization.scAETHFlowPoints) && + Objects.equals(this.ATT_NAME, capitalization.ATT_NAME); + } + + @Override + public int hashCode() { + return Objects.hash(smallCamel, capitalCamel, smallSnake, capitalSnake, scAETHFlowPoints, ATT_NAME); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Capitalization {\n"); + + sb.append(" smallCamel: ").append(toIndentedString(smallCamel)).append("\n"); + sb.append(" capitalCamel: ").append(toIndentedString(capitalCamel)).append("\n"); + sb.append(" smallSnake: ").append(toIndentedString(smallSnake)).append("\n"); + sb.append(" capitalSnake: ").append(toIndentedString(capitalSnake)).append("\n"); + sb.append(" scAETHFlowPoints: ").append(toIndentedString(scAETHFlowPoints)).append("\n"); + sb.append(" ATT_NAME: ").append(toIndentedString(ATT_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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Cat.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Cat.java new file mode 100644 index 00000000000..a1f38af43e0 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Cat.java @@ -0,0 +1,80 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.virtualan.model.Animal; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Cat + */ + +public class Cat extends Animal { + @JsonProperty("declawed") + private Boolean declawed = null; + + public Cat declawed(Boolean declawed) { + this.declawed = declawed; + return this; + } + + /** + * Get declawed + * @return declawed + **/ + @ApiModelProperty(value = "") + + + public Boolean getDeclawed() { + return declawed; + } + + public void setDeclawed(Boolean declawed) { + this.declawed = declawed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Cat cat = (Cat) o; + return Objects.equals(this.declawed, cat.declawed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(declawed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Cat {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" declawed: ").append(toIndentedString(declawed)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Category.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Category.java new file mode 100644 index 00000000000..5a43da49eeb --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Category.java @@ -0,0 +1,103 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Category + */ + +public class Category { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("name") + private String name = null; + + public Category id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Category name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Category category = (Category) o; + return Objects.equals(this.id, category.id) && + Objects.equals(this.name, category.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ClassModel.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ClassModel.java new file mode 100644 index 00000000000..92b739c6db7 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ClassModel.java @@ -0,0 +1,79 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Model for testing model with \"_class\" property + */ +@ApiModel(description = "Model for testing model with \"_class\" property") + +public class ClassModel { + @JsonProperty("_class") + private String propertyClass = null; + + public ClassModel propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @ApiModelProperty(value = "") + + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ClassModel classModel = (ClassModel) o; + return Objects.equals(this.propertyClass, classModel.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ClassModel {\n"); + + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Client.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Client.java new file mode 100644 index 00000000000..f689ff66b2d --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Client.java @@ -0,0 +1,78 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Client + */ + +public class Client { + @JsonProperty("client") + private String client = null; + + public Client client(String client) { + this.client = client; + return this; + } + + /** + * Get client + * @return client + **/ + @ApiModelProperty(value = "") + + + public String getClient() { + return client; + } + + public void setClient(String client) { + this.client = client; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Client client = (Client) o; + return Objects.equals(this.client, client.client); + } + + @Override + public int hashCode() { + return Objects.hash(client); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Client {\n"); + + sb.append(" client: ").append(toIndentedString(client)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Dog.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Dog.java new file mode 100644 index 00000000000..7a5f1b21863 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Dog.java @@ -0,0 +1,80 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.virtualan.model.Animal; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Dog + */ + +public class Dog extends Animal { + @JsonProperty("breed") + private String breed = null; + + public Dog breed(String breed) { + this.breed = breed; + return this; + } + + /** + * Get breed + * @return breed + **/ + @ApiModelProperty(value = "") + + + public String getBreed() { + return breed; + } + + public void setBreed(String breed) { + this.breed = breed; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Dog dog = (Dog) o; + return Objects.equals(this.breed, dog.breed) && + super.equals(o); + } + + @Override + public int hashCode() { + return Objects.hash(breed, super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Dog {\n"); + sb.append(" ").append(toIndentedString(super.toString())).append("\n"); + sb.append(" breed: ").append(toIndentedString(breed)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/EnumArrays.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/EnumArrays.java new file mode 100644 index 00000000000..7f37a350cf4 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/EnumArrays.java @@ -0,0 +1,177 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * EnumArrays + */ + +public class EnumArrays { + /** + * Gets or Sets justSymbol + */ + public enum JustSymbolEnum { + GREATER_THAN_OR_EQUAL_TO(">="), + + DOLLAR("$"); + + private String value; + + JustSymbolEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static JustSymbolEnum fromValue(String text) { + for (JustSymbolEnum b : JustSymbolEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("just_symbol") + private JustSymbolEnum justSymbol = null; + + /** + * Gets or Sets arrayEnum + */ + public enum ArrayEnumEnum { + FISH("fish"), + + CRAB("crab"); + + private String value; + + ArrayEnumEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static ArrayEnumEnum fromValue(String text) { + for (ArrayEnumEnum b : ArrayEnumEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("array_enum") + @Valid + private List arrayEnum = null; + + public EnumArrays justSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + return this; + } + + /** + * Get justSymbol + * @return justSymbol + **/ + @ApiModelProperty(value = "") + + + public JustSymbolEnum getJustSymbol() { + return justSymbol; + } + + public void setJustSymbol(JustSymbolEnum justSymbol) { + this.justSymbol = justSymbol; + } + + public EnumArrays arrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + return this; + } + + public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { + if (this.arrayEnum == null) { + this.arrayEnum = new ArrayList<>(); + } + this.arrayEnum.add(arrayEnumItem); + return this; + } + + /** + * Get arrayEnum + * @return arrayEnum + **/ + @ApiModelProperty(value = "") + + + public List getArrayEnum() { + return arrayEnum; + } + + public void setArrayEnum(List arrayEnum) { + this.arrayEnum = arrayEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumArrays enumArrays = (EnumArrays) o; + return Objects.equals(this.justSymbol, enumArrays.justSymbol) && + Objects.equals(this.arrayEnum, enumArrays.arrayEnum); + } + + @Override + public int hashCode() { + return Objects.hash(justSymbol, arrayEnum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumArrays {\n"); + + sb.append(" justSymbol: ").append(toIndentedString(justSymbol)).append("\n"); + sb.append(" arrayEnum: ").append(toIndentedString(arrayEnum)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/EnumClass.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/EnumClass.java new file mode 100644 index 00000000000..408833a2482 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/EnumClass.java @@ -0,0 +1,43 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; +import javax.validation.constraints.*; + +import com.fasterxml.jackson.annotation.JsonCreator; + +/** + * Gets or Sets EnumClass + */ +public enum EnumClass { + + _ABC("_abc"), + + _EFG("-efg"), + + _XYZ_("(xyz)"); + + private String value; + + EnumClass(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumClass fromValue(String text) { + for (EnumClass b : EnumClass.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/EnumTest.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/EnumTest.java new file mode 100644 index 00000000000..297d624ea58 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/EnumTest.java @@ -0,0 +1,310 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import org.openapitools.virtualan.model.OuterEnum; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * EnumTest + */ + +public class EnumTest { + /** + * Gets or Sets enumString + */ + public enum EnumStringEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringEnum fromValue(String text) { + for (EnumStringEnum b : EnumStringEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_string") + private EnumStringEnum enumString = null; + + /** + * Gets or Sets enumStringRequired + */ + public enum EnumStringRequiredEnum { + UPPER("UPPER"), + + LOWER("lower"), + + EMPTY(""); + + private String value; + + EnumStringRequiredEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumStringRequiredEnum fromValue(String text) { + for (EnumStringRequiredEnum b : EnumStringRequiredEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_string_required") + private EnumStringRequiredEnum enumStringRequired = null; + + /** + * Gets or Sets enumInteger + */ + public enum EnumIntegerEnum { + NUMBER_1(1), + + NUMBER_MINUS_1(-1); + + private Integer value; + + EnumIntegerEnum(Integer value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumIntegerEnum fromValue(String text) { + for (EnumIntegerEnum b : EnumIntegerEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_integer") + private EnumIntegerEnum enumInteger = null; + + /** + * Gets or Sets enumNumber + */ + public enum EnumNumberEnum { + NUMBER_1_DOT_1(1.1), + + NUMBER_MINUS_1_DOT_2(-1.2); + + private Double value; + + EnumNumberEnum(Double value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static EnumNumberEnum fromValue(String text) { + for (EnumNumberEnum b : EnumNumberEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("enum_number") + private EnumNumberEnum enumNumber = null; + + @JsonProperty("outerEnum") + private OuterEnum outerEnum = null; + + public EnumTest enumString(EnumStringEnum enumString) { + this.enumString = enumString; + return this; + } + + /** + * Get enumString + * @return enumString + **/ + @ApiModelProperty(value = "") + + + public EnumStringEnum getEnumString() { + return enumString; + } + + public void setEnumString(EnumStringEnum enumString) { + this.enumString = enumString; + } + + public EnumTest enumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + return this; + } + + /** + * Get enumStringRequired + * @return enumStringRequired + **/ + @ApiModelProperty(required = true, value = "") + @NotNull + + + public EnumStringRequiredEnum getEnumStringRequired() { + return enumStringRequired; + } + + public void setEnumStringRequired(EnumStringRequiredEnum enumStringRequired) { + this.enumStringRequired = enumStringRequired; + } + + public EnumTest enumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + return this; + } + + /** + * Get enumInteger + * @return enumInteger + **/ + @ApiModelProperty(value = "") + + + public EnumIntegerEnum getEnumInteger() { + return enumInteger; + } + + public void setEnumInteger(EnumIntegerEnum enumInteger) { + this.enumInteger = enumInteger; + } + + public EnumTest enumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + return this; + } + + /** + * Get enumNumber + * @return enumNumber + **/ + @ApiModelProperty(value = "") + + + public EnumNumberEnum getEnumNumber() { + return enumNumber; + } + + public void setEnumNumber(EnumNumberEnum enumNumber) { + this.enumNumber = enumNumber; + } + + public EnumTest outerEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + return this; + } + + /** + * Get outerEnum + * @return outerEnum + **/ + @ApiModelProperty(value = "") + + @Valid + + public OuterEnum getOuterEnum() { + return outerEnum; + } + + public void setOuterEnum(OuterEnum outerEnum) { + this.outerEnum = outerEnum; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + EnumTest enumTest = (EnumTest) o; + return Objects.equals(this.enumString, enumTest.enumString) && + Objects.equals(this.enumStringRequired, enumTest.enumStringRequired) && + Objects.equals(this.enumInteger, enumTest.enumInteger) && + Objects.equals(this.enumNumber, enumTest.enumNumber) && + Objects.equals(this.outerEnum, enumTest.outerEnum); + } + + @Override + public int hashCode() { + return Objects.hash(enumString, enumStringRequired, enumInteger, enumNumber, outerEnum); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class EnumTest {\n"); + + sb.append(" enumString: ").append(toIndentedString(enumString)).append("\n"); + sb.append(" enumStringRequired: ").append(toIndentedString(enumStringRequired)).append("\n"); + sb.append(" enumInteger: ").append(toIndentedString(enumInteger)).append("\n"); + sb.append(" enumNumber: ").append(toIndentedString(enumNumber)).append("\n"); + sb.append(" outerEnum: ").append(toIndentedString(outerEnum)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FileSchemaTestClass.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FileSchemaTestClass.java new file mode 100644 index 00000000000..1494da4da30 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FileSchemaTestClass.java @@ -0,0 +1,116 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * FileSchemaTestClass + */ + +public class FileSchemaTestClass { + @JsonProperty("file") + private java.io.File file = null; + + @JsonProperty("files") + @Valid + private List files = null; + + public FileSchemaTestClass file(java.io.File file) { + this.file = file; + return this; + } + + /** + * Get file + * @return file + **/ + @ApiModelProperty(value = "") + + @Valid + + public java.io.File getFile() { + return file; + } + + public void setFile(java.io.File file) { + this.file = file; + } + + public FileSchemaTestClass files(List files) { + this.files = files; + return this; + } + + public FileSchemaTestClass addFilesItem(java.io.File filesItem) { + if (this.files == null) { + this.files = new ArrayList<>(); + } + this.files.add(filesItem); + return this; + } + + /** + * Get files + * @return files + **/ + @ApiModelProperty(value = "") + + @Valid + + public List getFiles() { + return files; + } + + public void setFiles(List files) { + this.files = files; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FileSchemaTestClass fileSchemaTestClass = (FileSchemaTestClass) o; + return Objects.equals(this.file, fileSchemaTestClass.file) && + Objects.equals(this.files, fileSchemaTestClass.files); + } + + @Override + public int hashCode() { + return Objects.hash(file, files); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FileSchemaTestClass {\n"); + + sb.append(" file: ").append(toIndentedString(file)).append("\n"); + sb.append(" files: ").append(toIndentedString(files)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FormatTest.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FormatTest.java new file mode 100644 index 00000000000..de411628665 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/FormatTest.java @@ -0,0 +1,402 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import java.time.LocalDate; +import java.time.OffsetDateTime; +import java.util.UUID; +import org.springframework.core.io.Resource; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * FormatTest + */ + +public class FormatTest { + @JsonProperty("integer") + private Integer integer = null; + + @JsonProperty("int32") + private Integer int32 = null; + + @JsonProperty("int64") + private Long int64 = null; + + @JsonProperty("number") + private BigDecimal number = null; + + @JsonProperty("float") + private Float _float = null; + + @JsonProperty("double") + private Double _double = null; + + @JsonProperty("string") + private String string = null; + + @JsonProperty("byte") + private byte[] _byte = null; + + @JsonProperty("binary") + private Resource binary = null; + + @JsonProperty("date") + private LocalDate date = null; + + @JsonProperty("dateTime") + private OffsetDateTime dateTime = null; + + @JsonProperty("uuid") + private UUID uuid = null; + + @JsonProperty("password") + private String password = null; + + public FormatTest integer(Integer integer) { + this.integer = integer; + return this; + } + + /** + * Get integer + * minimum: 10 + * maximum: 100 + * @return integer + **/ + @ApiModelProperty(value = "") + +@Min(10) @Max(100) + public Integer getInteger() { + return integer; + } + + public void setInteger(Integer integer) { + this.integer = integer; + } + + public FormatTest int32(Integer int32) { + this.int32 = int32; + return this; + } + + /** + * Get int32 + * minimum: 20 + * maximum: 200 + * @return int32 + **/ + @ApiModelProperty(value = "") + +@Min(20) @Max(200) + public Integer getInt32() { + return int32; + } + + public void setInt32(Integer int32) { + this.int32 = int32; + } + + public FormatTest int64(Long int64) { + this.int64 = int64; + return this; + } + + /** + * Get int64 + * @return int64 + **/ + @ApiModelProperty(value = "") + + + public Long getInt64() { + return int64; + } + + public void setInt64(Long int64) { + this.int64 = int64; + } + + public FormatTest number(BigDecimal number) { + this.number = number; + return this; + } + + /** + * Get number + * minimum: 32.1 + * maximum: 543.2 + * @return number + **/ + @ApiModelProperty(required = true, value = "") + @NotNull + + @Valid +@DecimalMin("32.1") @DecimalMax("543.2") + public BigDecimal getNumber() { + return number; + } + + public void setNumber(BigDecimal number) { + this.number = number; + } + + public FormatTest _float(Float _float) { + this._float = _float; + return this; + } + + /** + * Get _float + * minimum: 54.3 + * maximum: 987.6 + * @return _float + **/ + @ApiModelProperty(value = "") + +@DecimalMin("54.3") @DecimalMax("987.6") + public Float getFloat() { + return _float; + } + + public void setFloat(Float _float) { + this._float = _float; + } + + public FormatTest _double(Double _double) { + this._double = _double; + return this; + } + + /** + * Get _double + * minimum: 67.8 + * maximum: 123.4 + * @return _double + **/ + @ApiModelProperty(value = "") + +@DecimalMin("67.8") @DecimalMax("123.4") + public Double getDouble() { + return _double; + } + + public void setDouble(Double _double) { + this._double = _double; + } + + public FormatTest string(String string) { + this.string = string; + return this; + } + + /** + * Get string + * @return string + **/ + @ApiModelProperty(value = "") + +@Pattern(regexp="/[a-z]/i") + public String getString() { + return string; + } + + public void setString(String string) { + this.string = string; + } + + public FormatTest _byte(byte[] _byte) { + this._byte = _byte; + return this; + } + + /** + * Get _byte + * @return _byte + **/ + @ApiModelProperty(required = true, value = "") + @NotNull + +@Pattern(regexp="^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$") + public byte[] getByte() { + return _byte; + } + + public void setByte(byte[] _byte) { + this._byte = _byte; + } + + public FormatTest binary(Resource binary) { + this.binary = binary; + return this; + } + + /** + * Get binary + * @return binary + **/ + @ApiModelProperty(value = "") + + @Valid + + public Resource getBinary() { + return binary; + } + + public void setBinary(Resource binary) { + this.binary = binary; + } + + public FormatTest date(LocalDate date) { + this.date = date; + return this; + } + + /** + * Get date + * @return date + **/ + @ApiModelProperty(required = true, value = "") + @NotNull + + @Valid + + public LocalDate getDate() { + return date; + } + + public void setDate(LocalDate date) { + this.date = date; + } + + public FormatTest dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @ApiModelProperty(value = "") + + @Valid + + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + public FormatTest uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @ApiModelProperty(value = "") + + @Valid + + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public FormatTest password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(required = true, value = "") + @NotNull + +@Size(min=10,max=64) + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + FormatTest formatTest = (FormatTest) o; + return Objects.equals(this.integer, formatTest.integer) && + Objects.equals(this.int32, formatTest.int32) && + Objects.equals(this.int64, formatTest.int64) && + Objects.equals(this.number, formatTest.number) && + Objects.equals(this._float, formatTest._float) && + Objects.equals(this._double, formatTest._double) && + Objects.equals(this.string, formatTest.string) && + Objects.equals(this._byte, formatTest._byte) && + Objects.equals(this.binary, formatTest.binary) && + Objects.equals(this.date, formatTest.date) && + Objects.equals(this.dateTime, formatTest.dateTime) && + Objects.equals(this.uuid, formatTest.uuid) && + Objects.equals(this.password, formatTest.password); + } + + @Override + public int hashCode() { + return Objects.hash(integer, int32, int64, number, _float, _double, string, _byte, binary, date, dateTime, uuid, password); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class FormatTest {\n"); + + sb.append(" integer: ").append(toIndentedString(integer)).append("\n"); + sb.append(" int32: ").append(toIndentedString(int32)).append("\n"); + sb.append(" int64: ").append(toIndentedString(int64)).append("\n"); + sb.append(" number: ").append(toIndentedString(number)).append("\n"); + sb.append(" _float: ").append(toIndentedString(_float)).append("\n"); + sb.append(" _double: ").append(toIndentedString(_double)).append("\n"); + sb.append(" string: ").append(toIndentedString(string)).append("\n"); + sb.append(" _byte: ").append(toIndentedString(_byte)).append("\n"); + sb.append(" binary: ").append(toIndentedString(binary)).append("\n"); + sb.append(" date: ").append(toIndentedString(date)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" password: ").append(toIndentedString(password)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/HasOnlyReadOnly.java new file mode 100644 index 00000000000..45cc65677cb --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/HasOnlyReadOnly.java @@ -0,0 +1,103 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * HasOnlyReadOnly + */ + +public class HasOnlyReadOnly { + @JsonProperty("bar") + private String bar = null; + + @JsonProperty("foo") + private String foo = null; + + public HasOnlyReadOnly bar(String bar) { + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + **/ + @ApiModelProperty(readOnly = true, value = "") + + + public String getBar() { + return bar; + } + + public void setBar(String bar) { + this.bar = bar; + } + + public HasOnlyReadOnly foo(String foo) { + this.foo = foo; + return this; + } + + /** + * Get foo + * @return foo + **/ + @ApiModelProperty(readOnly = true, value = "") + + + public String getFoo() { + return foo; + } + + public void setFoo(String foo) { + this.foo = foo; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HasOnlyReadOnly hasOnlyReadOnly = (HasOnlyReadOnly) o; + return Objects.equals(this.bar, hasOnlyReadOnly.bar) && + Objects.equals(this.foo, hasOnlyReadOnly.foo); + } + + @Override + public int hashCode() { + return Objects.hash(bar, foo); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class HasOnlyReadOnly {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" foo: ").append(toIndentedString(foo)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/MapTest.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/MapTest.java new file mode 100644 index 00000000000..14296751f1e --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/MapTest.java @@ -0,0 +1,218 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.openapitools.virtualan.model.StringBooleanMap; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * MapTest + */ + +public class MapTest { + @JsonProperty("map_map_of_string") + @Valid + private Map> mapMapOfString = null; + + /** + * Gets or Sets inner + */ + public enum InnerEnum { + UPPER("UPPER"), + + LOWER("lower"); + + private String value; + + InnerEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static InnerEnum fromValue(String text) { + for (InnerEnum b : InnerEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("map_of_enum_string") + @Valid + private Map mapOfEnumString = null; + + @JsonProperty("direct_map") + @Valid + private Map directMap = null; + + @JsonProperty("indirect_map") + private StringBooleanMap indirectMap = null; + + public MapTest mapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + return this; + } + + public MapTest putMapMapOfStringItem(String key, Map mapMapOfStringItem) { + if (this.mapMapOfString == null) { + this.mapMapOfString = new HashMap<>(); + } + this.mapMapOfString.put(key, mapMapOfStringItem); + return this; + } + + /** + * Get mapMapOfString + * @return mapMapOfString + **/ + @ApiModelProperty(value = "") + + @Valid + + public Map> getMapMapOfString() { + return mapMapOfString; + } + + public void setMapMapOfString(Map> mapMapOfString) { + this.mapMapOfString = mapMapOfString; + } + + public MapTest mapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + return this; + } + + public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) { + if (this.mapOfEnumString == null) { + this.mapOfEnumString = new HashMap<>(); + } + this.mapOfEnumString.put(key, mapOfEnumStringItem); + return this; + } + + /** + * Get mapOfEnumString + * @return mapOfEnumString + **/ + @ApiModelProperty(value = "") + + + public Map getMapOfEnumString() { + return mapOfEnumString; + } + + public void setMapOfEnumString(Map mapOfEnumString) { + this.mapOfEnumString = mapOfEnumString; + } + + public MapTest directMap(Map directMap) { + this.directMap = directMap; + return this; + } + + public MapTest putDirectMapItem(String key, Boolean directMapItem) { + if (this.directMap == null) { + this.directMap = new HashMap<>(); + } + this.directMap.put(key, directMapItem); + return this; + } + + /** + * Get directMap + * @return directMap + **/ + @ApiModelProperty(value = "") + + + public Map getDirectMap() { + return directMap; + } + + public void setDirectMap(Map directMap) { + this.directMap = directMap; + } + + public MapTest indirectMap(StringBooleanMap indirectMap) { + this.indirectMap = indirectMap; + return this; + } + + /** + * Get indirectMap + * @return indirectMap + **/ + @ApiModelProperty(value = "") + + @Valid + + public StringBooleanMap getIndirectMap() { + return indirectMap; + } + + public void setIndirectMap(StringBooleanMap indirectMap) { + this.indirectMap = indirectMap; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MapTest mapTest = (MapTest) o; + return Objects.equals(this.mapMapOfString, mapTest.mapMapOfString) && + Objects.equals(this.mapOfEnumString, mapTest.mapOfEnumString) && + Objects.equals(this.directMap, mapTest.directMap) && + Objects.equals(this.indirectMap, mapTest.indirectMap); + } + + @Override + public int hashCode() { + return Objects.hash(mapMapOfString, mapOfEnumString, directMap, indirectMap); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MapTest {\n"); + + sb.append(" mapMapOfString: ").append(toIndentedString(mapMapOfString)).append("\n"); + sb.append(" mapOfEnumString: ").append(toIndentedString(mapOfEnumString)).append("\n"); + sb.append(" directMap: ").append(toIndentedString(directMap)).append("\n"); + sb.append(" indirectMap: ").append(toIndentedString(indirectMap)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/MixedPropertiesAndAdditionalPropertiesClass.java new file mode 100644 index 00000000000..8a55f4585d2 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -0,0 +1,146 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.openapitools.virtualan.model.Animal; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * MixedPropertiesAndAdditionalPropertiesClass + */ + +public class MixedPropertiesAndAdditionalPropertiesClass { + @JsonProperty("uuid") + private UUID uuid = null; + + @JsonProperty("dateTime") + private OffsetDateTime dateTime = null; + + @JsonProperty("map") + @Valid + private Map map = null; + + public MixedPropertiesAndAdditionalPropertiesClass uuid(UUID uuid) { + this.uuid = uuid; + return this; + } + + /** + * Get uuid + * @return uuid + **/ + @ApiModelProperty(value = "") + + @Valid + + public UUID getUuid() { + return uuid; + } + + public void setUuid(UUID uuid) { + this.uuid = uuid; + } + + public MixedPropertiesAndAdditionalPropertiesClass dateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + return this; + } + + /** + * Get dateTime + * @return dateTime + **/ + @ApiModelProperty(value = "") + + @Valid + + public OffsetDateTime getDateTime() { + return dateTime; + } + + public void setDateTime(OffsetDateTime dateTime) { + this.dateTime = dateTime; + } + + public MixedPropertiesAndAdditionalPropertiesClass map(Map map) { + this.map = map; + return this; + } + + public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal mapItem) { + if (this.map == null) { + this.map = new HashMap<>(); + } + this.map.put(key, mapItem); + return this; + } + + /** + * Get map + * @return map + **/ + @ApiModelProperty(value = "") + + @Valid + + public Map getMap() { + return map; + } + + public void setMap(Map map) { + this.map = map; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + MixedPropertiesAndAdditionalPropertiesClass mixedPropertiesAndAdditionalPropertiesClass = (MixedPropertiesAndAdditionalPropertiesClass) o; + return Objects.equals(this.uuid, mixedPropertiesAndAdditionalPropertiesClass.uuid) && + Objects.equals(this.dateTime, mixedPropertiesAndAdditionalPropertiesClass.dateTime) && + Objects.equals(this.map, mixedPropertiesAndAdditionalPropertiesClass.map); + } + + @Override + public int hashCode() { + return Objects.hash(uuid, dateTime, map); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class MixedPropertiesAndAdditionalPropertiesClass {\n"); + + sb.append(" uuid: ").append(toIndentedString(uuid)).append("\n"); + sb.append(" dateTime: ").append(toIndentedString(dateTime)).append("\n"); + sb.append(" map: ").append(toIndentedString(map)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Model200Response.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Model200Response.java new file mode 100644 index 00000000000..27598e36568 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Model200Response.java @@ -0,0 +1,104 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Model for testing model name starting with number + */ +@ApiModel(description = "Model for testing model name starting with number") + +public class Model200Response { + @JsonProperty("name") + private Integer name = null; + + @JsonProperty("class") + private String propertyClass = null; + + public Model200Response name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + + + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + public Model200Response propertyClass(String propertyClass) { + this.propertyClass = propertyClass; + return this; + } + + /** + * Get propertyClass + * @return propertyClass + **/ + @ApiModelProperty(value = "") + + + public String getPropertyClass() { + return propertyClass; + } + + public void setPropertyClass(String propertyClass) { + this.propertyClass = propertyClass; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Model200Response _200response = (Model200Response) o; + return Objects.equals(this.name, _200response.name) && + Objects.equals(this.propertyClass, _200response.propertyClass); + } + + @Override + public int hashCode() { + return Objects.hash(name, propertyClass); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Model200Response {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" propertyClass: ").append(toIndentedString(propertyClass)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ModelApiResponse.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ModelApiResponse.java new file mode 100644 index 00000000000..2966dd98906 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ModelApiResponse.java @@ -0,0 +1,128 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * ModelApiResponse + */ + +public class ModelApiResponse { + @JsonProperty("code") + private Integer code = null; + + @JsonProperty("type") + private String type = null; + + @JsonProperty("message") + private String message = null; + + public ModelApiResponse code(Integer code) { + this.code = code; + return this; + } + + /** + * Get code + * @return code + **/ + @ApiModelProperty(value = "") + + + public Integer getCode() { + return code; + } + + public void setCode(Integer code) { + this.code = code; + } + + public ModelApiResponse type(String type) { + this.type = type; + return this; + } + + /** + * Get type + * @return type + **/ + @ApiModelProperty(value = "") + + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public ModelApiResponse message(String message) { + this.message = message; + return this; + } + + /** + * Get message + * @return message + **/ + @ApiModelProperty(value = "") + + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelApiResponse _apiResponse = (ModelApiResponse) o; + return Objects.equals(this.code, _apiResponse.code) && + Objects.equals(this.type, _apiResponse.type) && + Objects.equals(this.message, _apiResponse.message); + } + + @Override + public int hashCode() { + return Objects.hash(code, type, message); + } + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ModelReturn.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ModelReturn.java new file mode 100644 index 00000000000..ca8e032976d --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ModelReturn.java @@ -0,0 +1,79 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Model for testing reserved words + */ +@ApiModel(description = "Model for testing reserved words") + +public class ModelReturn { + @JsonProperty("return") + private Integer _return = null; + + public ModelReturn _return(Integer _return) { + this._return = _return; + return this; + } + + /** + * Get _return + * @return _return + **/ + @ApiModelProperty(value = "") + + + public Integer getReturn() { + return _return; + } + + public void setReturn(Integer _return) { + this._return = _return; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ModelReturn _return = (ModelReturn) o; + return Objects.equals(this._return, _return._return); + } + + @Override + public int hashCode() { + return Objects.hash(_return); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ModelReturn {\n"); + + sb.append(" _return: ").append(toIndentedString(_return)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Name.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Name.java new file mode 100644 index 00000000000..13c0933b1be --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Name.java @@ -0,0 +1,155 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Model for testing model name same as property name + */ +@ApiModel(description = "Model for testing model name same as property name") + +public class Name { + @JsonProperty("name") + private Integer name = null; + + @JsonProperty("snake_case") + private Integer snakeCase = null; + + @JsonProperty("property") + private String property = null; + + @JsonProperty("123Number") + private Integer _123number = null; + + public Name name(Integer name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(required = true, value = "") + @NotNull + + + public Integer getName() { + return name; + } + + public void setName(Integer name) { + this.name = name; + } + + public Name snakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + return this; + } + + /** + * Get snakeCase + * @return snakeCase + **/ + @ApiModelProperty(readOnly = true, value = "") + + + public Integer getSnakeCase() { + return snakeCase; + } + + public void setSnakeCase(Integer snakeCase) { + this.snakeCase = snakeCase; + } + + public Name property(String property) { + this.property = property; + return this; + } + + /** + * Get property + * @return property + **/ + @ApiModelProperty(value = "") + + + public String getProperty() { + return property; + } + + public void setProperty(String property) { + this.property = property; + } + + public Name _123number(Integer _123number) { + this._123number = _123number; + return this; + } + + /** + * Get _123number + * @return _123number + **/ + @ApiModelProperty(readOnly = true, value = "") + + + public Integer get123number() { + return _123number; + } + + public void set123number(Integer _123number) { + this._123number = _123number; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Name name = (Name) o; + return Objects.equals(this.name, name.name) && + Objects.equals(this.snakeCase, name.snakeCase) && + Objects.equals(this.property, name.property) && + Objects.equals(this._123number, name._123number); + } + + @Override + public int hashCode() { + return Objects.hash(name, snakeCase, property, _123number); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class Name {\n"); + + sb.append(" name: ").append(toIndentedString(name)).append("\n"); + sb.append(" snakeCase: ").append(toIndentedString(snakeCase)).append("\n"); + sb.append(" property: ").append(toIndentedString(property)).append("\n"); + sb.append(" _123number: ").append(toIndentedString(_123number)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/NumberOnly.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/NumberOnly.java new file mode 100644 index 00000000000..56a6e6eb908 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/NumberOnly.java @@ -0,0 +1,80 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * NumberOnly + */ + +public class NumberOnly { + @JsonProperty("JustNumber") + private BigDecimal justNumber = null; + + public NumberOnly justNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + return this; + } + + /** + * Get justNumber + * @return justNumber + **/ + @ApiModelProperty(value = "") + + @Valid + + public BigDecimal getJustNumber() { + return justNumber; + } + + public void setJustNumber(BigDecimal justNumber) { + this.justNumber = justNumber; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + NumberOnly numberOnly = (NumberOnly) o; + return Objects.equals(this.justNumber, numberOnly.justNumber); + } + + @Override + public int hashCode() { + return Objects.hash(justNumber); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class NumberOnly {\n"); + + sb.append(" justNumber: ").append(toIndentedString(justNumber)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Order.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Order.java new file mode 100644 index 00000000000..d424a8c4a9c --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Order.java @@ -0,0 +1,239 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.time.OffsetDateTime; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Order + */ + +public class Order { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("petId") + private Long petId = null; + + @JsonProperty("quantity") + private Integer quantity = null; + + @JsonProperty("shipDate") + private OffsetDateTime shipDate = null; + + /** + * Order Status + */ + public enum StatusEnum { + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("status") + private StatusEnum status = null; + + @JsonProperty("complete") + private Boolean complete = false; + + public Order id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Order petId(Long petId) { + this.petId = petId; + return this; + } + + /** + * Get petId + * @return petId + **/ + @ApiModelProperty(value = "") + + + public Long getPetId() { + return petId; + } + + public void setPetId(Long petId) { + this.petId = petId; + } + + public Order quantity(Integer quantity) { + this.quantity = quantity; + return this; + } + + /** + * Get quantity + * @return quantity + **/ + @ApiModelProperty(value = "") + + + public Integer getQuantity() { + return quantity; + } + + public void setQuantity(Integer quantity) { + this.quantity = quantity; + } + + public Order shipDate(OffsetDateTime shipDate) { + this.shipDate = shipDate; + return this; + } + + /** + * Get shipDate + * @return shipDate + **/ + @ApiModelProperty(value = "") + + @Valid + + public OffsetDateTime getShipDate() { + return shipDate; + } + + public void setShipDate(OffsetDateTime shipDate) { + this.shipDate = shipDate; + } + + public Order status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * Order Status + * @return status + **/ + @ApiModelProperty(value = "Order Status") + + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + public Order complete(Boolean complete) { + this.complete = complete; + return this; + } + + /** + * Get complete + * @return complete + **/ + @ApiModelProperty(value = "") + + + public Boolean getComplete() { + return complete; + } + + public void setComplete(Boolean complete) { + this.complete = complete; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Order order = (Order) o; + return Objects.equals(this.id, order.id) && + Objects.equals(this.petId, order.petId) && + Objects.equals(this.quantity, order.quantity) && + Objects.equals(this.shipDate, order.shipDate) && + Objects.equals(this.status, order.status) && + Objects.equals(this.complete, order.complete); + } + + @Override + public int hashCode() { + return Objects.hash(id, petId, quantity, shipDate, status, complete); + } + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OuterComposite.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OuterComposite.java new file mode 100644 index 00000000000..18fa8134225 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OuterComposite.java @@ -0,0 +1,130 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + + @Valid + + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + + + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + + + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OuterEnum.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OuterEnum.java new file mode 100644 index 00000000000..cd7f3b134e9 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/OuterEnum.java @@ -0,0 +1,43 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonValue; +import javax.validation.Valid; +import javax.validation.constraints.*; + +import com.fasterxml.jackson.annotation.JsonCreator; + +/** + * Gets or Sets OuterEnum + */ +public enum OuterEnum { + + PLACED("placed"), + + APPROVED("approved"), + + DELIVERED("delivered"); + + private String value; + + OuterEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static OuterEnum fromValue(String text) { + for (OuterEnum b : OuterEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Pet.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Pet.java new file mode 100644 index 00000000000..beaa5cd32e3 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Pet.java @@ -0,0 +1,260 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.util.ArrayList; +import java.util.List; +import org.openapitools.virtualan.model.Category; +import org.openapitools.virtualan.model.Tag; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Pet + */ + +public class Pet { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("category") + private Category category = null; + + @JsonProperty("name") + private String name = null; + + @JsonProperty("photoUrls") + @Valid + private List photoUrls = new ArrayList<>(); + + @JsonProperty("tags") + @Valid + private List tags = null; + + /** + * pet status in the store + */ + public enum StatusEnum { + AVAILABLE("available"), + + PENDING("pending"), + + SOLD("sold"); + + private String value; + + StatusEnum(String value) { + this.value = value; + } + + @Override + @JsonValue + public String toString() { + return String.valueOf(value); + } + + @JsonCreator + public static StatusEnum fromValue(String text) { + for (StatusEnum b : StatusEnum.values()) { + if (String.valueOf(b.value).equals(text)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + text + "'"); + } + } + + @JsonProperty("status") + private StatusEnum status = null; + + public Pet id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Pet category(Category category) { + this.category = category; + return this; + } + + /** + * Get category + * @return category + **/ + @ApiModelProperty(value = "") + + @Valid + + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + public Pet name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(example = "doggie", required = true, value = "") + @NotNull + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Pet photoUrls(List photoUrls) { + this.photoUrls = photoUrls; + return this; + } + + public Pet addPhotoUrlsItem(String photoUrlsItem) { + this.photoUrls.add(photoUrlsItem); + return this; + } + + /** + * Get photoUrls + * @return photoUrls + **/ + @ApiModelProperty(required = true, value = "") + @NotNull + + + public List getPhotoUrls() { + return photoUrls; + } + + public void setPhotoUrls(List photoUrls) { + this.photoUrls = photoUrls; + } + + public Pet tags(List tags) { + this.tags = tags; + return this; + } + + public Pet addTagsItem(Tag tagsItem) { + if (this.tags == null) { + this.tags = new ArrayList<>(); + } + this.tags.add(tagsItem); + return this; + } + + /** + * Get tags + * @return tags + **/ + @ApiModelProperty(value = "") + + @Valid + + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public Pet status(StatusEnum status) { + this.status = status; + return this; + } + + /** + * pet status in the store + * @return status + **/ + @ApiModelProperty(value = "pet status in the store") + + + public StatusEnum getStatus() { + return status; + } + + public void setStatus(StatusEnum status) { + this.status = status; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Pet pet = (Pet) o; + return Objects.equals(this.id, pet.id) && + Objects.equals(this.category, pet.category) && + Objects.equals(this.name, pet.name) && + Objects.equals(this.photoUrls, pet.photoUrls) && + Objects.equals(this.tags, pet.tags) && + Objects.equals(this.status, pet.status); + } + + @Override + public int hashCode() { + return Objects.hash(id, category, name, photoUrls, tags, status); + } + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ReadOnlyFirst.java new file mode 100644 index 00000000000..d0735af1ae3 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/ReadOnlyFirst.java @@ -0,0 +1,103 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * ReadOnlyFirst + */ + +public class ReadOnlyFirst { + @JsonProperty("bar") + private String bar = null; + + @JsonProperty("baz") + private String baz = null; + + public ReadOnlyFirst bar(String bar) { + this.bar = bar; + return this; + } + + /** + * Get bar + * @return bar + **/ + @ApiModelProperty(readOnly = true, value = "") + + + public String getBar() { + return bar; + } + + public void setBar(String bar) { + this.bar = bar; + } + + public ReadOnlyFirst baz(String baz) { + this.baz = baz; + return this; + } + + /** + * Get baz + * @return baz + **/ + @ApiModelProperty(value = "") + + + public String getBaz() { + return baz; + } + + public void setBaz(String baz) { + this.baz = baz; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + ReadOnlyFirst readOnlyFirst = (ReadOnlyFirst) o; + return Objects.equals(this.bar, readOnlyFirst.bar) && + Objects.equals(this.baz, readOnlyFirst.baz); + } + + @Override + public int hashCode() { + return Objects.hash(bar, baz); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class ReadOnlyFirst {\n"); + + sb.append(" bar: ").append(toIndentedString(bar)).append("\n"); + sb.append(" baz: ").append(toIndentedString(baz)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/SpecialModelName.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/SpecialModelName.java new file mode 100644 index 00000000000..baaaa7f81e3 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/SpecialModelName.java @@ -0,0 +1,78 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * SpecialModelName + */ + +public class SpecialModelName { + @JsonProperty("$special[property.name]") + private Long $specialPropertyName = null; + + public SpecialModelName $specialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + return this; + } + + /** + * Get $specialPropertyName + * @return $specialPropertyName + **/ + @ApiModelProperty(value = "") + + + public Long get$SpecialPropertyName() { + return $specialPropertyName; + } + + public void set$SpecialPropertyName(Long $specialPropertyName) { + this.$specialPropertyName = $specialPropertyName; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + SpecialModelName $specialModelName = (SpecialModelName) o; + return Objects.equals(this.$specialPropertyName, $specialModelName.$specialPropertyName); + } + + @Override + public int hashCode() { + return Objects.hash($specialPropertyName); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class SpecialModelName {\n"); + + sb.append(" $specialPropertyName: ").append(toIndentedString($specialPropertyName)).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/StringBooleanMap.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/StringBooleanMap.java new file mode 100644 index 00000000000..095b736ebbc --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/StringBooleanMap.java @@ -0,0 +1,51 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import java.util.HashMap; +import java.util.Map; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * StringBooleanMap + */ + +public class StringBooleanMap extends HashMap { + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + return true; + } + + @Override + public int hashCode() { + return Objects.hash(super.hashCode()); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class StringBooleanMap {\n"); + sb.append(" ").append(toIndentedString(super.toString())).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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Tag.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Tag.java new file mode 100644 index 00000000000..59c62dba854 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/Tag.java @@ -0,0 +1,103 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * Tag + */ + +public class Tag { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("name") + private String name = null; + + public Tag id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Tag name(String name) { + this.name = name; + return this; + } + + /** + * Get name + * @return name + **/ + @ApiModelProperty(value = "") + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + Tag tag = (Tag) o; + return Objects.equals(this.id, tag.id) && + Objects.equals(this.name, tag.name); + } + + @Override + public int hashCode() { + return Objects.hash(id, name); + } + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/User.java b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/User.java new file mode 100644 index 00000000000..ab17265faa4 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/java/org/openapitools/virtualan/model/User.java @@ -0,0 +1,253 @@ +package org.openapitools.virtualan.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * User + */ + +public class User { + @JsonProperty("id") + private Long id = null; + + @JsonProperty("username") + private String username = null; + + @JsonProperty("firstName") + private String firstName = null; + + @JsonProperty("lastName") + private String lastName = null; + + @JsonProperty("email") + private String email = null; + + @JsonProperty("password") + private String password = null; + + @JsonProperty("phone") + private String phone = null; + + @JsonProperty("userStatus") + private Integer userStatus = null; + + public User id(Long id) { + this.id = id; + return this; + } + + /** + * Get id + * @return id + **/ + @ApiModelProperty(value = "") + + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public User username(String username) { + this.username = username; + return this; + } + + /** + * Get username + * @return username + **/ + @ApiModelProperty(value = "") + + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public User firstName(String firstName) { + this.firstName = firstName; + return this; + } + + /** + * Get firstName + * @return firstName + **/ + @ApiModelProperty(value = "") + + + public String getFirstName() { + return firstName; + } + + public void setFirstName(String firstName) { + this.firstName = firstName; + } + + public User lastName(String lastName) { + this.lastName = lastName; + return this; + } + + /** + * Get lastName + * @return lastName + **/ + @ApiModelProperty(value = "") + + + public String getLastName() { + return lastName; + } + + public void setLastName(String lastName) { + this.lastName = lastName; + } + + public User email(String email) { + this.email = email; + return this; + } + + /** + * Get email + * @return email + **/ + @ApiModelProperty(value = "") + + + public String getEmail() { + return email; + } + + public void setEmail(String email) { + this.email = email; + } + + public User password(String password) { + this.password = password; + return this; + } + + /** + * Get password + * @return password + **/ + @ApiModelProperty(value = "") + + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public User phone(String phone) { + this.phone = phone; + return this; + } + + /** + * Get phone + * @return phone + **/ + @ApiModelProperty(value = "") + + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public User userStatus(Integer userStatus) { + this.userStatus = userStatus; + return this; + } + + /** + * User Status + * @return userStatus + **/ + @ApiModelProperty(value = "User Status") + + + public Integer getUserStatus() { + return userStatus; + } + + public void setUserStatus(Integer userStatus) { + this.userStatus = userStatus; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + User user = (User) o; + return Objects.equals(this.id, user.id) && + Objects.equals(this.username, user.username) && + Objects.equals(this.firstName, user.firstName) && + Objects.equals(this.lastName, user.lastName) && + Objects.equals(this.email, user.email) && + Objects.equals(this.password, user.password) && + Objects.equals(this.phone, user.phone) && + Objects.equals(this.userStatus, user.userStatus); + } + + @Override + public int hashCode() { + return Objects.hash(id, username, firstName, lastName, email, password, phone, userStatus); + } + + @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 String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-virtualan/src/main/resources/application.properties b/samples/server/petstore/springboot-virtualan/src/main/resources/application.properties new file mode 100644 index 00000000000..cf5e33b6869 --- /dev/null +++ b/samples/server/petstore/springboot-virtualan/src/main/resources/application.properties @@ -0,0 +1,8 @@ +springfox.documentation.swagger.v2.path=/api-docs +server.port=80 +spring.jackson.date-format=org.openapitools.RFC3339DateFormat +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false +virtual.datasource.driver-class-name=org.hsqldb.jdbcDriver +virtual.datasource.jdbcurl=jdbc:hsqldb:mem:dataSource +virtual.datasource.username=sa +virtual.datasource.password= diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiUtil.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiUtil.java index c5f5cc143a1..3ecc0972d94 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiUtil.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/ApiUtil.java @@ -8,8 +8,10 @@ import java.io.IOException; public class ApiUtil { public static void setExampleResponse(NativeWebRequest req, String contentType, String example) { try { - req.getNativeResponse(HttpServletResponse.class).addHeader("Content-Type", contentType); - req.getNativeResponse(HttpServletResponse.class).getOutputStream().print(example); + HttpServletResponse res = req.getNativeResponse(HttpServletResponse.class); + res.setCharacterEncoding("UTF-8"); + res.addHeader("Content-Type", contentType); + res.getWriter().print(example); } catch (IOException e) { throw new RuntimeException(e); } 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 bf4af01c58b..ac562e64128 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 @@ -51,14 +51,6 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -91,14 +83,6 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -111,14 +95,6 @@ public interface FakeApi { produces = { "*/*" }, method = RequestMethod.POST) default ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { - getRequest().ifPresent(request -> { - for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { - if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "null"); - break; - } - } - }); return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -178,7 +154,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="double", required=true) Double _double,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true, defaultValue="null") @RequestParam(value="byte", required=true) byte[] _byte,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="integer", required=false) Integer integer,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int32", required=false) Integer int32,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="int64", required=false) Long int64,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="float", required=false) Float _float,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="string", required=false) String string,@ApiParam(value = "file detail") @Valid @RequestPart("file") MultipartFile binary,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="date", required=false) LocalDate date,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="dateTime", required=false) OffsetDateTime dateTime,@ApiParam(value = "None", defaultValue="null") @RequestParam(value="password", required=false) String password,@ApiParam(value = "None", defaultValue="null") @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 = "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) { return new ResponseEntity<>(HttpStatus.NOT_IMPLEMENTED); } @@ -191,7 +167,7 @@ public interface FakeApi { @RequestMapping(value = "/fake", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default 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=">, $", defaultValue="$") @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) { + default ResponseEntity testEnumParameters(@ApiParam(value = "Header parameter enum test (string array)" , allowableValues=">, $", defaultValue="new ArrayList<>()") @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 = ">, $", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "enum_query_string_array", required = false, defaultValue="new ArrayList<>()") 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=">, $", defaultValue="$") @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); } @@ -215,7 +191,7 @@ public interface FakeApi { @RequestMapping(value = "/fake/jsonFormData", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.GET) - default ResponseEntity testJsonFormData(@ApiParam(value = "field1", required=true, defaultValue="null") @RequestParam(value="param", required=true) String param,@ApiParam(value = "field2", required=true, defaultValue="null") @RequestParam(value="param2", required=true) String param2) { + default 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); } @@ -233,7 +209,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", defaultValue="null") @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 detail") @Valid @RequestPart("file") 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/PetApi.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/api/PetApi.java index cd7fb1b1a17..4fadfa5b944 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 @@ -82,7 +82,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default 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) { + default ResponseEntity> findPetsByStatus(@NotNull @ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold", defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "status", required = true, defaultValue="new ArrayList<>()") List status) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -112,7 +112,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true) @Valid @RequestParam(value = "tags", required = true) List tags) { + default ResponseEntity> findPetsByTags(@NotNull @ApiParam(value = "Tags to filter by", required = true, defaultValue = "new ArrayList<>()") @Valid @RequestParam(value = "tags", required = true, defaultValue="new ArrayList<>()") List tags) { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("application/json"))) { @@ -188,7 +188,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - default 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", defaultValue="null") @RequestParam(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet", defaultValue="null") @RequestParam(value="status", required=false) String status) { + default 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); } @@ -206,7 +206,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", defaultValue="null") @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 detail") @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/model/Animal.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Animal.java index 5bc21a6e60b..b9df0761fa2 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Animal.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Animal.java @@ -22,7 +22,7 @@ import javax.validation.constraints.*; public class Animal { @JsonProperty("className") - private String className = null; + private String className; @JsonProperty("color") private String color = "red"; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Capitalization.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Capitalization.java index 2f67e3d6ed8..cf8e0184c75 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Capitalization.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Capitalization.java @@ -14,22 +14,22 @@ import javax.validation.constraints.*; public class Capitalization { @JsonProperty("smallCamel") - private String smallCamel = null; + private String smallCamel; @JsonProperty("CapitalCamel") - private String capitalCamel = null; + private String capitalCamel; @JsonProperty("small_Snake") - private String smallSnake = null; + private String smallSnake; @JsonProperty("Capital_Snake") - private String capitalSnake = null; + private String capitalSnake; @JsonProperty("SCA_ETH_Flow_Points") - private String scAETHFlowPoints = null; + private String scAETHFlowPoints; @JsonProperty("ATT_NAME") - private String ATT_NAME = null; + private String ATT_NAME; public Capitalization smallCamel(String smallCamel) { this.smallCamel = smallCamel; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Cat.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Cat.java index b0ee4437409..db751abc2d8 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Cat.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Cat.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Cat extends Animal { @JsonProperty("declawed") - private Boolean declawed = null; + private Boolean declawed; public Cat declawed(Boolean declawed) { this.declawed = declawed; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Category.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Category.java index ede08450019..ab96fdce16a 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Category.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Category.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Category { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Category id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ClassModel.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ClassModel.java index b7c7d9330a0..1a44b03b0bc 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ClassModel.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ClassModel.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ClassModel { @JsonProperty("_class") - private String propertyClass = null; + private String propertyClass; public ClassModel propertyClass(String propertyClass) { this.propertyClass = propertyClass; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Client.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Client.java index 68e888388b1..cf73d18603d 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Client.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Client.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class Client { @JsonProperty("client") - private String client = null; + private String client; public Client client(String client) { this.client = client; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Dog.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Dog.java index 9b877bb8029..59f5507d573 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Dog.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Dog.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class Dog extends Animal { @JsonProperty("breed") - private String breed = null; + private String breed; public Dog breed(String breed) { this.breed = breed; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/EnumArrays.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/EnumArrays.java index 7c15608894d..1bf86d35fa3 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/EnumArrays.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/EnumArrays.java @@ -48,7 +48,7 @@ public class EnumArrays { } @JsonProperty("just_symbol") - private JustSymbolEnum justSymbol = null; + private JustSymbolEnum justSymbol; /** * Gets or Sets arrayEnum diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/EnumTest.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/EnumTest.java index 26a8bce4e7c..dcb97236e4b 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/EnumTest.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/EnumTest.java @@ -49,7 +49,7 @@ public class EnumTest { } @JsonProperty("enum_string") - private EnumStringEnum enumString = null; + private EnumStringEnum enumString; /** * Gets or Sets enumStringRequired @@ -85,7 +85,7 @@ public class EnumTest { } @JsonProperty("enum_string_required") - private EnumStringRequiredEnum enumStringRequired = null; + private EnumStringRequiredEnum enumStringRequired; /** * Gets or Sets enumInteger @@ -119,7 +119,7 @@ public class EnumTest { } @JsonProperty("enum_integer") - private EnumIntegerEnum enumInteger = null; + private EnumIntegerEnum enumInteger; /** * Gets or Sets enumNumber @@ -153,7 +153,7 @@ public class EnumTest { } @JsonProperty("enum_number") - private EnumNumberEnum enumNumber = null; + private EnumNumberEnum enumNumber; @JsonProperty("outerEnum") private OuterEnum outerEnum = null; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/FormatTest.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/FormatTest.java index 31638e0ed66..6b1af9b08be 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/FormatTest.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/FormatTest.java @@ -19,43 +19,43 @@ import javax.validation.constraints.*; public class FormatTest { @JsonProperty("integer") - private Integer integer = null; + private Integer integer; @JsonProperty("int32") - private Integer int32 = null; + private Integer int32; @JsonProperty("int64") - private Long int64 = null; + private Long int64; @JsonProperty("number") - private BigDecimal number = null; + private BigDecimal number; @JsonProperty("float") - private Float _float = null; + private Float _float; @JsonProperty("double") - private Double _double = null; + private Double _double; @JsonProperty("string") - private String string = null; + private String string; @JsonProperty("byte") - private byte[] _byte = null; + private byte[] _byte; @JsonProperty("binary") - private Resource binary = null; + private Resource binary; @JsonProperty("date") - private LocalDate date = null; + private LocalDate date; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("password") - private String password = null; + private String password; public FormatTest integer(Integer integer) { this.integer = integer; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/HasOnlyReadOnly.java index 13a6378b53e..1818546ce32 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/HasOnlyReadOnly.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class HasOnlyReadOnly { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("foo") - private String foo = null; + private String foo; public HasOnlyReadOnly bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/MapTest.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/MapTest.java index a6acaa59d1a..93a2b1e7b22 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/MapTest.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/MapTest.java @@ -9,7 +9,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.openapitools.model.StringBooleanMap; import javax.validation.Valid; import javax.validation.constraints.*; @@ -62,7 +61,8 @@ public class MapTest { private Map directMap = null; @JsonProperty("indirect_map") - private StringBooleanMap indirectMap = null; + @Valid + private Map indirectMap = null; public MapTest mapMapOfString(Map> mapMapOfString) { this.mapMapOfString = mapMapOfString; @@ -149,24 +149,31 @@ public class MapTest { this.directMap = directMap; } - public MapTest indirectMap(StringBooleanMap indirectMap) { + public MapTest indirectMap(Map indirectMap) { this.indirectMap = indirectMap; return this; } + public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { + if (this.indirectMap == null) { + this.indirectMap = new HashMap<>(); + } + this.indirectMap.put(key, indirectMapItem); + return this; + } + /** * Get indirectMap * @return indirectMap **/ @ApiModelProperty(value = "") - @Valid - public StringBooleanMap getIndirectMap() { + public Map getIndirectMap() { return indirectMap; } - public void setIndirectMap(StringBooleanMap indirectMap) { + public void setIndirectMap(Map indirectMap) { this.indirectMap = indirectMap; } diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java index 452da256d01..5f1212179a3 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -20,10 +20,10 @@ import javax.validation.constraints.*; public class MixedPropertiesAndAdditionalPropertiesClass { @JsonProperty("uuid") - private UUID uuid = null; + private UUID uuid; @JsonProperty("dateTime") - private OffsetDateTime dateTime = null; + private OffsetDateTime dateTime; @JsonProperty("map") @Valid diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Model200Response.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Model200Response.java index fdbe2056875..6a77de5e22a 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Model200Response.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Model200Response.java @@ -15,10 +15,10 @@ import javax.validation.constraints.*; public class Model200Response { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("class") - private String propertyClass = null; + private String propertyClass; public Model200Response name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ModelApiResponse.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ModelApiResponse.java index deb0fd9924f..a05b204bece 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ModelApiResponse.java @@ -14,13 +14,13 @@ import javax.validation.constraints.*; public class ModelApiResponse { @JsonProperty("code") - private Integer code = null; + private Integer code; @JsonProperty("type") - private String type = null; + private String type; @JsonProperty("message") - private String message = null; + private String message; public ModelApiResponse code(Integer code) { this.code = code; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ModelReturn.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ModelReturn.java index 10684b30f81..b21e712510d 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ModelReturn.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ModelReturn.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class ModelReturn { @JsonProperty("return") - private Integer _return = null; + private Integer _return; public ModelReturn _return(Integer _return) { this._return = _return; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Name.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Name.java index ba33f48731a..ba9701e1b7d 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Name.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Name.java @@ -15,16 +15,16 @@ import javax.validation.constraints.*; public class Name { @JsonProperty("name") - private Integer name = null; + private Integer name; @JsonProperty("snake_case") - private Integer snakeCase = null; + private Integer snakeCase; @JsonProperty("property") - private String property = null; + private String property; @JsonProperty("123Number") - private Integer _123number = null; + private Integer _123number; public Name name(Integer name) { this.name = name; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/NumberOnly.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/NumberOnly.java index 158b899847f..275529bafe1 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/NumberOnly.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/NumberOnly.java @@ -15,7 +15,7 @@ import javax.validation.constraints.*; public class NumberOnly { @JsonProperty("JustNumber") - private BigDecimal justNumber = null; + private BigDecimal justNumber; public NumberOnly justNumber(BigDecimal justNumber) { this.justNumber = justNumber; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Order.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Order.java index 946ce8f756d..0a09f15f309 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Order.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Order.java @@ -16,16 +16,16 @@ import javax.validation.constraints.*; public class Order { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("petId") - private Long petId = null; + private Long petId; @JsonProperty("quantity") - private Integer quantity = null; + private Integer quantity; @JsonProperty("shipDate") - private OffsetDateTime shipDate = null; + private OffsetDateTime shipDate; /** * Order Status @@ -61,7 +61,7 @@ public class Order { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; @JsonProperty("complete") private Boolean complete = false; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/OuterComposite.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/OuterComposite.java index c343b0b39ed..f522765ede1 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/OuterComposite.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/OuterComposite.java @@ -15,13 +15,13 @@ import javax.validation.constraints.*; public class OuterComposite { @JsonProperty("my_number") - private BigDecimal myNumber = null; + private BigDecimal myNumber; @JsonProperty("my_string") - private String myString = null; + private String myString; @JsonProperty("my_boolean") - private Boolean myBoolean = null; + private Boolean myBoolean; public OuterComposite myNumber(BigDecimal myNumber) { this.myNumber = myNumber; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Pet.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Pet.java index 502146abefc..d3bca13a64b 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Pet.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Pet.java @@ -19,13 +19,13 @@ import javax.validation.constraints.*; public class Pet { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("category") private Category category = null; @JsonProperty("name") - private String name = null; + private String name; @JsonProperty("photoUrls") @Valid @@ -69,7 +69,7 @@ public class Pet { } @JsonProperty("status") - private StatusEnum status = null; + private StatusEnum status; public Pet id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ReadOnlyFirst.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ReadOnlyFirst.java index 321c3bddc68..f0c6b763e9f 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/ReadOnlyFirst.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class ReadOnlyFirst { @JsonProperty("bar") - private String bar = null; + private String bar; @JsonProperty("baz") - private String baz = null; + private String baz; public ReadOnlyFirst bar(String bar) { this.bar = bar; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/SpecialModelName.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/SpecialModelName.java index 14741b1d224..6b445cfa0d9 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/SpecialModelName.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/SpecialModelName.java @@ -14,7 +14,7 @@ import javax.validation.constraints.*; public class SpecialModelName { @JsonProperty("$special[property.name]") - private Long $specialPropertyName = null; + private Long $specialPropertyName; public SpecialModelName $specialPropertyName(Long $specialPropertyName) { this.$specialPropertyName = $specialPropertyName; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Tag.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Tag.java index c9655217d9c..d9a99a54704 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Tag.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/Tag.java @@ -14,10 +14,10 @@ import javax.validation.constraints.*; public class Tag { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("name") - private String name = null; + private String name; public Tag id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/User.java b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/User.java index b1e7e56281a..d934073c84f 100644 --- a/samples/server/petstore/springboot/src/main/java/org/openapitools/model/User.java +++ b/samples/server/petstore/springboot/src/main/java/org/openapitools/model/User.java @@ -14,28 +14,28 @@ import javax.validation.constraints.*; public class User { @JsonProperty("id") - private Long id = null; + private Long id; @JsonProperty("username") - private String username = null; + private String username; @JsonProperty("firstName") - private String firstName = null; + private String firstName; @JsonProperty("lastName") - private String lastName = null; + private String lastName; @JsonProperty("email") - private String email = null; + private String email; @JsonProperty("password") - private String password = null; + private String password; @JsonProperty("phone") - private String phone = null; + private String phone; @JsonProperty("userStatus") - private Integer userStatus = null; + private Integer userStatus; public User id(Long id) { this.id = id; diff --git a/samples/server/petstore/springboot/src/main/resources/application.properties b/samples/server/petstore/springboot/src/main/resources/application.properties index 13b0dc6ab96..ceca4a9e0d0 100644 --- a/samples/server/petstore/springboot/src/main/resources/application.properties +++ b/samples/server/petstore/springboot/src/main/resources/application.properties @@ -1,4 +1,4 @@ springfox.documentation.swagger.v2.path=/api-docs server.port=80 spring.jackson.date-format=org.openapitools.RFC3339DateFormat -spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false diff --git a/shippable.yml b/shippable.yml index 27c3ccec46e..a112f3bbf7b 100644 --- a/shippable.yml +++ b/shippable.yml @@ -1,7 +1,7 @@ language: java jdk: -- oraclejdk8 +- openjdk9 build: cache: true @@ -10,9 +10,10 @@ build: - $HOME/.stack - $SHIPPABLE_REPO_DIR/samples/client/petstore/elixir/deps ci: + - java -version - mvn --quiet clean install # ensure all modifications created by 'mature' generators are in the git repo - - ./bin/utils/ensure-up-to-date + # below move to CircleCI ./bin/utils/ensure-up-to-date # prepare environment for tests - sudo apt-get update -qq # install stack @@ -24,6 +25,8 @@ build: - wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.deb - sudo apt-get update - sudo apt-get install elixir + # install elm + - curl -SL https://github.com/elm/compiler/releases/download/0.19.0/binaries-for-linux.tar.gz | tar xzv -C /usr/local/bin # install rebar3 - wget https://s3.amazonaws.com/rebar3/rebar3 && chmod +x rebar3 && cp rebar3 /usr/bin # install php @@ -39,3 +42,5 @@ build: - ./bin/run-all-petstore # generate all petstore samples (openapi3) - ./bin/openapi3/run-all-petstore + # generate test scripts + - ./bin/tests/run-all-test